forked from qt-creator/qt-creator
DebuggerTreeView: Move base class to utils
Change-Id: I3313789be5f835d218cad5ed5f3143aee18e9f5f Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
137
src/libs/utils/basetreeview.cpp
Normal file
137
src/libs/utils/basetreeview.cpp
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** 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, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "basetreeview.h"
|
||||||
|
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
BaseTreeView::BaseTreeView(QWidget *parent)
|
||||||
|
: QTreeView(parent)
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
setFrameStyle(QFrame::NoFrame);
|
||||||
|
setRootIsDecorated(false);
|
||||||
|
setIconSize(QSize(10, 10));
|
||||||
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
setUniformRowHeights(true);
|
||||||
|
|
||||||
|
header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
|
header()->setClickable(true);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
|
SLOT(rowActivatedHelper(QModelIndex)));
|
||||||
|
connect(header(), SIGNAL(sectionClicked(int)),
|
||||||
|
SLOT(headerSectionClicked(int)));
|
||||||
|
|
||||||
|
m_adjustColumnsAction = new QAction(tr("Adjust Column Widths to Contents"), 0);
|
||||||
|
m_alwaysAdjustColumnsAction = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::setAlwaysAdjustColumnsAction(QAction *action)
|
||||||
|
{
|
||||||
|
m_alwaysAdjustColumnsAction = action;
|
||||||
|
connect(action, SIGNAL(toggled(bool)),
|
||||||
|
SLOT(setAlwaysResizeColumnsToContents(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::addBaseContextActions(QMenu *menu)
|
||||||
|
{
|
||||||
|
menu->addSeparator();
|
||||||
|
if (m_alwaysAdjustColumnsAction)
|
||||||
|
menu->addAction(m_alwaysAdjustColumnsAction);
|
||||||
|
menu->addAction(m_adjustColumnsAction);
|
||||||
|
menu->addSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BaseTreeView::handleBaseContextAction(QAction *act)
|
||||||
|
{
|
||||||
|
if (act == 0)
|
||||||
|
return true;
|
||||||
|
if (act == m_adjustColumnsAction) {
|
||||||
|
resizeColumnsToContents();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (act == m_alwaysAdjustColumnsAction) {
|
||||||
|
if (act->isChecked())
|
||||||
|
resizeColumnsToContents();
|
||||||
|
// Action triggered automatically.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::setModel(QAbstractItemModel *model)
|
||||||
|
{
|
||||||
|
QTreeView::setModel(model);
|
||||||
|
if (header() && m_alwaysAdjustColumnsAction)
|
||||||
|
setAlwaysResizeColumnsToContents(m_alwaysAdjustColumnsAction->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::mousePressEvent(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
QTreeView::mousePressEvent(ev);
|
||||||
|
if (!indexAt(ev->pos()).isValid())
|
||||||
|
resizeColumnsToContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::resizeColumnsToContents()
|
||||||
|
{
|
||||||
|
const int columnCount = model()->columnCount();
|
||||||
|
for (int c = 0 ; c != columnCount; ++c)
|
||||||
|
resizeColumnToContents(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::setAlwaysResizeColumnsToContents(bool on)
|
||||||
|
{
|
||||||
|
QHeaderView::ResizeMode mode = on
|
||||||
|
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
|
||||||
|
header()->setResizeMode(0, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::headerSectionClicked(int logicalIndex)
|
||||||
|
{
|
||||||
|
resizeColumnToContents(logicalIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTreeView::reset()
|
||||||
|
{
|
||||||
|
QTreeView::reset();
|
||||||
|
if (header() && m_alwaysAdjustColumnsAction
|
||||||
|
&& m_alwaysAdjustColumnsAction->isChecked())
|
||||||
|
resizeColumnsToContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Utils
|
76
src/libs/utils/basetreeview.h
Normal file
76
src/libs/utils/basetreeview.h
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** 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, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BASETREEVIEW_H
|
||||||
|
#define BASETREEVIEW_H
|
||||||
|
|
||||||
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include <QTreeView>
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT BaseTreeView : public QTreeView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
BaseTreeView(QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setAlwaysAdjustColumnsAction(QAction *action);
|
||||||
|
virtual void addBaseContextActions(QMenu *menu);
|
||||||
|
bool handleBaseContextAction(QAction *action);
|
||||||
|
|
||||||
|
void setModel(QAbstractItemModel *model);
|
||||||
|
virtual void rowActivated(const QModelIndex &) {}
|
||||||
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void resizeColumnsToContents();
|
||||||
|
void setAlwaysResizeColumnsToContents(bool on);
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
|
||||||
|
void headerSectionClicked(int logicalIndex);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QAction *m_alwaysAdjustColumnsAction;
|
||||||
|
QAction *m_adjustColumnsAction;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Utils
|
||||||
|
|
||||||
|
#endif // BASETREEVIEW_H
|
@@ -97,7 +97,8 @@ SOURCES += $$PWD/environment.cpp \
|
|||||||
$$PWD/json.cpp \
|
$$PWD/json.cpp \
|
||||||
$$PWD/portlist.cpp \
|
$$PWD/portlist.cpp \
|
||||||
$$PWD/tcpportsgatherer.cpp \
|
$$PWD/tcpportsgatherer.cpp \
|
||||||
$$PWD/appmainwindow.cpp
|
$$PWD/appmainwindow.cpp \
|
||||||
|
$$PWD/basetreeview.cpp
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@@ -211,7 +212,8 @@ HEADERS += \
|
|||||||
$$PWD/runextensions.h \
|
$$PWD/runextensions.h \
|
||||||
$$PWD/portlist.h \
|
$$PWD/portlist.h \
|
||||||
$$PWD/tcpportsgatherer.h \
|
$$PWD/tcpportsgatherer.h \
|
||||||
$$PWD/appmainwindow.h
|
$$PWD/appmainwindow.h \
|
||||||
|
$$PWD/basetreeview.h
|
||||||
|
|
||||||
FORMS += $$PWD/filewizardpage.ui \
|
FORMS += $$PWD/filewizardpage.ui \
|
||||||
$$PWD/projectintropage.ui \
|
$$PWD/projectintropage.ui \
|
||||||
|
@@ -40,9 +40,6 @@
|
|||||||
#include <find/treeviewfind.h>
|
#include <find/treeviewfind.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <QContextMenuEvent>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QHeaderView>
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
@@ -50,107 +47,20 @@ namespace Debugger {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
BaseTreeView::BaseTreeView(QWidget *parent)
|
BaseTreeView::BaseTreeView(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: Utils::BaseTreeView(parent)
|
||||||
{
|
{
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
||||||
|
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
setAlternatingRowColors(act->isChecked());
|
setAlternatingRowColors(act->isChecked());
|
||||||
setRootIsDecorated(false);
|
|
||||||
setIconSize(QSize(10, 10));
|
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
||||||
setUniformRowHeights(true);
|
|
||||||
|
|
||||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
|
||||||
header()->setClickable(true);
|
|
||||||
|
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
connect(act, SIGNAL(toggled(bool)),
|
||||||
SLOT(setAlternatingRowColorsHelper(bool)));
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
|
||||||
SLOT(rowActivatedHelper(QModelIndex)));
|
|
||||||
connect(header(), SIGNAL(sectionClicked(int)),
|
|
||||||
SLOT(headerSectionClicked(int)));
|
|
||||||
|
|
||||||
m_adjustColumnsAction = new QAction(tr("Adjust Column Widths to Contents"), 0);
|
|
||||||
m_alwaysAdjustColumnsAction = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::setAlwaysAdjustColumnsAction(QAction *action)
|
|
||||||
{
|
|
||||||
m_alwaysAdjustColumnsAction = action;
|
|
||||||
connect(action, SIGNAL(toggled(bool)),
|
|
||||||
SLOT(setAlwaysResizeColumnsToContents(bool)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTreeView::addBaseContextActions(QMenu *menu)
|
void BaseTreeView::addBaseContextActions(QMenu *menu)
|
||||||
{
|
{
|
||||||
menu->addSeparator();
|
Utils::BaseTreeView::addBaseContextActions(menu);
|
||||||
if (m_alwaysAdjustColumnsAction)
|
|
||||||
menu->addAction(m_alwaysAdjustColumnsAction);
|
|
||||||
menu->addAction(m_adjustColumnsAction);
|
|
||||||
menu->addSeparator();
|
|
||||||
menu->addAction(debuggerCore()->action(SettingsDialog));
|
menu->addAction(debuggerCore()->action(SettingsDialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTreeView::handleBaseContextAction(QAction *act)
|
|
||||||
{
|
|
||||||
if (act == 0)
|
|
||||||
return true;
|
|
||||||
if (act == m_adjustColumnsAction) {
|
|
||||||
resizeColumnsToContents();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (act == m_alwaysAdjustColumnsAction) {
|
|
||||||
if (act->isChecked())
|
|
||||||
resizeColumnsToContents();
|
|
||||||
// Action triggered automatically.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::setModel(QAbstractItemModel *model)
|
|
||||||
{
|
|
||||||
QTreeView::setModel(model);
|
|
||||||
if (header() && m_alwaysAdjustColumnsAction)
|
|
||||||
setAlwaysResizeColumnsToContents(m_alwaysAdjustColumnsAction->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::mousePressEvent(QMouseEvent *ev)
|
|
||||||
{
|
|
||||||
QTreeView::mousePressEvent(ev);
|
|
||||||
if (!indexAt(ev->pos()).isValid())
|
|
||||||
resizeColumnsToContents();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::resizeColumnsToContents()
|
|
||||||
{
|
|
||||||
const int columnCount = model()->columnCount();
|
|
||||||
for (int c = 0 ; c != columnCount; ++c)
|
|
||||||
resizeColumnToContents(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::setAlwaysResizeColumnsToContents(bool on)
|
|
||||||
{
|
|
||||||
QHeaderView::ResizeMode mode = on
|
|
||||||
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
|
|
||||||
header()->setResizeMode(0, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::headerSectionClicked(int logicalIndex)
|
|
||||||
{
|
|
||||||
resizeColumnToContents(logicalIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTreeView::reset()
|
|
||||||
{
|
|
||||||
QTreeView::reset();
|
|
||||||
if (header() && m_alwaysAdjustColumnsAction
|
|
||||||
&& m_alwaysAdjustColumnsAction->isChecked())
|
|
||||||
resizeColumnsToContents();
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseWindow::BaseWindow(QTreeView *treeView, QWidget *parent)
|
BaseWindow::BaseWindow(QTreeView *treeView, QWidget *parent)
|
||||||
: QWidget(parent), m_treeView(treeView)
|
: QWidget(parent), m_treeView(treeView)
|
||||||
{
|
{
|
||||||
|
@@ -33,39 +33,18 @@
|
|||||||
#ifndef DEBUGGER_BASEWINDOW_H
|
#ifndef DEBUGGER_BASEWINDOW_H
|
||||||
#define DEBUGGER_BASEWINDOW_H
|
#define DEBUGGER_BASEWINDOW_H
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <utils/basetreeview.h>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BaseTreeView : public QTreeView
|
class BaseTreeView : public Utils::BaseTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseTreeView(QWidget *parent = 0);
|
explicit BaseTreeView(QWidget *parent = 0);
|
||||||
|
|
||||||
void setAlwaysAdjustColumnsAction(QAction *action);
|
|
||||||
void addBaseContextActions(QMenu *menu);
|
void addBaseContextActions(QMenu *menu);
|
||||||
bool handleBaseContextAction(QAction *action);
|
|
||||||
|
|
||||||
void setModel(QAbstractItemModel *model);
|
|
||||||
virtual void rowActivated(const QModelIndex &) {}
|
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void resizeColumnsToContents();
|
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
|
|
||||||
void headerSectionClicked(int logicalIndex);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QAction *m_alwaysAdjustColumnsAction;
|
|
||||||
QAction *m_adjustColumnsAction;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseWindow : public QWidget
|
class BaseWindow : public QWidget
|
||||||
|
@@ -166,7 +166,6 @@ public:
|
|||||||
RegisterTreeView::RegisterTreeView(QWidget *parent)
|
RegisterTreeView::RegisterTreeView(QWidget *parent)
|
||||||
: BaseTreeView(parent)
|
: BaseTreeView(parent)
|
||||||
{
|
{
|
||||||
setAlwaysAdjustColumnsAction(debuggerCore()->action(UseAlternatingRowColors));
|
|
||||||
setItemDelegate(new RegisterDelegate(this));
|
setItemDelegate(new RegisterDelegate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -292,28 +292,13 @@ bool QmlJSPropertyInspectorModel::contentsValid() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QmlJSPropertyInspector::QmlJSPropertyInspector(QWidget *parent)
|
QmlJSPropertyInspector::QmlJSPropertyInspector(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: Utils::BaseTreeView(parent)
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
setExpandsOnDoubleClick(true);
|
|
||||||
|
|
||||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
|
||||||
header()->setClickable(true);
|
|
||||||
setRootIsDecorated(false);
|
|
||||||
|
|
||||||
setItemDelegateForColumn(PROPERTY_VALUE_COLUMN, new PropertyEditDelegate(this));
|
setItemDelegateForColumn(PROPERTY_VALUE_COLUMN, new PropertyEditDelegate(this));
|
||||||
|
|
||||||
setModel(&m_model);
|
setModel(&m_model);
|
||||||
//Add an empty Row to make the headers visible!
|
//Add an empty Row to make the headers visible!
|
||||||
addRow(QString(), QString(), QString(), -1, false);
|
addRow(QString(), QString(), QString(), -1, false);
|
||||||
connect(header(), SIGNAL(sectionClicked(int)),
|
|
||||||
SLOT(headerSectionClicked(int)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlJSPropertyInspector::headerSectionClicked(int logicalIndex)
|
|
||||||
{
|
|
||||||
resizeColumnToContents(logicalIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSPropertyInspector::clear()
|
void QmlJSPropertyInspector::clear()
|
||||||
@@ -491,8 +476,6 @@ void QmlJSPropertyInspector::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QModelIndex itemIndex = indexAt(ev->pos());
|
QModelIndex itemIndex = indexAt(ev->pos());
|
||||||
if (!itemIndex.isValid())
|
|
||||||
return;
|
|
||||||
bool isEditable = false;
|
bool isEditable = false;
|
||||||
bool isColor = false;
|
bool isColor = false;
|
||||||
if (itemIndex.isValid()) {
|
if (itemIndex.isValid()) {
|
||||||
@@ -507,6 +490,7 @@ void QmlJSPropertyInspector::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction colorAction(tr("Choose color"), this);
|
QAction colorAction(tr("Choose color"), this);
|
||||||
if (isColor)
|
if (isColor)
|
||||||
menu.addAction(&colorAction);
|
menu.addAction(&colorAction);
|
||||||
|
addBaseContextActions(&menu);
|
||||||
|
|
||||||
QAction *action = menu.exec(ev->globalPos());
|
QAction *action = menu.exec(ev->globalPos());
|
||||||
if (action == 0)
|
if (action == 0)
|
||||||
@@ -516,6 +500,7 @@ void QmlJSPropertyInspector::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
openExpressionEditor(itemIndex);
|
openExpressionEditor(itemIndex);
|
||||||
if (action == &colorAction)
|
if (action == &colorAction)
|
||||||
openColorSelector(itemIndex);
|
openColorSelector(itemIndex);
|
||||||
|
handleBaseContextAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSPropertyInspector::openExpressionEditor(const QModelIndex &itemIndex)
|
void QmlJSPropertyInspector::openExpressionEditor(const QModelIndex &itemIndex)
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#define PROPERTYINSPECTOR_H
|
#define PROPERTYINSPECTOR_H
|
||||||
|
|
||||||
#include <qmljsprivateapi.h>
|
#include <qmljsprivateapi.h>
|
||||||
#include <QTreeView>
|
#include <utils/basetreeview.h>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
@@ -108,7 +108,7 @@ private:
|
|||||||
bool m_contentsValid;
|
bool m_contentsValid;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QmlJSPropertyInspector : public QTreeView
|
class QmlJSPropertyInspector : public Utils::BaseTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -138,9 +138,6 @@ public slots:
|
|||||||
void openExpressionEditor(const QModelIndex &itemIndex);
|
void openExpressionEditor(const QModelIndex &itemIndex);
|
||||||
void openColorSelector(const QModelIndex &itemIndex);
|
void openColorSelector(const QModelIndex &itemIndex);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void headerSectionClicked(int logicalIndex);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PropertyEditDelegate;
|
friend class PropertyEditDelegate;
|
||||||
void buildPropertyTree(const QmlDebugObjectReference &);
|
void buildPropertyTree(const QmlDebugObjectReference &);
|
||||||
|
Reference in New Issue
Block a user