diff options
author | Tasuku Suzuki <stasuku@gmail.com> | 2013-12-21 16:15:32 +0900 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-10 02:02:59 +0100 |
commit | 372392cf6e14ececbaff8aa54d2a7230ad17ba5f (patch) | |
tree | 598f8c824548440a35e481be681c437652c97f5a /src/qdbus/qdbusviewer/logviewer.cpp | |
parent | 2aba84b72e3ff110209da3ba1bdca07d3d21522c (diff) |
add "Clear" to context menu of log viewer in qdbusviewer
Change-Id: Id4da5fcfdbe462e22a4227699c3e13ecf0cd363a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/qdbus/qdbusviewer/logviewer.cpp')
-rw-r--r-- | src/qdbus/qdbusviewer/logviewer.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/qdbus/qdbusviewer/logviewer.cpp b/src/qdbus/qdbusviewer/logviewer.cpp new file mode 100644 index 000000000..a230eb65f --- /dev/null +++ b/src/qdbus/qdbusviewer/logviewer.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Tasuku Suzuki <stasuku@gmail.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "logviewer.h" + +#include <QtGui/QContextMenuEvent> +#include <QtWidgets/QMenu> + +LogViewer::LogViewer(QWidget *parent) + : QTextBrowser(parent) +{ +} + +void LogViewer::contextMenuEvent(QContextMenuEvent *event) +{ + QMenu *menu = createStandardContextMenu(); + QAction *action = menu->addAction(tr("Clear")); + connect(action, SIGNAL(triggered()), this, SLOT(clear())); + menu->exec(event->globalPos()); + delete menu; +} |