QmlJSInspector: Moved the property filter back into the QML observer dock

Changed around the way the background is drawn on the crumble path, so
that the background extends below the filter line edit.

Reviewed-by: Kai Koehne
This commit is contained in:
Thorbjørn Lindeijer
2011-02-16 18:01:50 +01:00
parent c74da9b7c5
commit 7f90d08c18
6 changed files with 42 additions and 43 deletions

View File

@@ -94,10 +94,9 @@ private:
CrumblePathButton::CrumblePathButton(const QString &title, QWidget *parent) CrumblePathButton::CrumblePathButton(const QString &title, QWidget *parent)
: QPushButton(title, parent), m_isHovering(false), m_isPressed(false), m_isSelected(false), m_isEnd(true) : QPushButton(title, parent), m_isHovering(false), m_isPressed(false), m_isSelected(false), m_isEnd(true)
{ {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
setToolTip(title); setToolTip(title);
setMinimumHeight(24); setMinimumHeight(24);
setMaximumHeight(24);
setMouseTracking(true); setMouseTracking(true);
m_textPos.setX(18); m_textPos.setX(18);
m_textPos.setY(height()); m_textPos.setY(height());
@@ -218,15 +217,12 @@ QVariant CrumblePathButton::data() const
struct CrumblePathPrivate { struct CrumblePathPrivate {
explicit CrumblePathPrivate(CrumblePath *q); explicit CrumblePathPrivate(CrumblePath *q);
QColor m_baseColor;
QList<CrumblePathButton*> m_buttons; QList<CrumblePathButton*> m_buttons;
QWidget *m_background;
}; };
CrumblePathPrivate::CrumblePathPrivate(CrumblePath *q) : CrumblePathPrivate::CrumblePathPrivate(CrumblePath *q)
m_baseColor(StyleHelper::baseColor()),
m_background(new QWidget(q))
{ {
Q_UNUSED(q)
} }
// //
@@ -238,9 +234,6 @@ CrumblePath::CrumblePath(QWidget *parent) :
setMinimumHeight(25); setMinimumHeight(25);
setMaximumHeight(25); setMaximumHeight(25);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
setBackgroundStyle();
d->m_background->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
} }
CrumblePath::~CrumblePath() CrumblePath::~CrumblePath()
@@ -262,11 +255,6 @@ QVariant CrumblePath::dataForIndex(int index) const
return QVariant(); return QVariant();
} }
void CrumblePath::setBackgroundStyle()
{
d->m_background->setStyleSheet("QWidget { background-color:" + d->m_baseColor.name() + ";}");
}
void CrumblePath::pushElement(const QString &title, const QVariant data) void CrumblePath::pushElement(const QString &title, const QVariant data)
{ {
CrumblePathButton *newButton = new CrumblePathButton(title, this); CrumblePathButton *newButton = new CrumblePathButton(title, this);
@@ -377,9 +365,6 @@ void CrumblePath::resizeButtons()
} }
} }
d->m_background->setGeometry(0,0, width(), height());
d->m_background->update();
} }
void CrumblePath::mapClickToIndex() void CrumblePath::mapClickToIndex()
@@ -393,14 +378,4 @@ void CrumblePath::mapClickToIndex()
} }
} }
void CrumblePath::paintEvent(QPaintEvent *event)
{
if (StyleHelper::baseColor() != d->m_baseColor) {
d->m_baseColor = StyleHelper::baseColor();
setBackgroundStyle();
}
QWidget::paintEvent(event);
}
} // namespace Utils } // namespace Utils

View File

@@ -65,7 +65,6 @@ signals:
protected: protected:
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
void paintEvent(QPaintEvent *);
private slots: private slots:
void mapClickToIndex(); void mapClickToIndex();

View File

@@ -81,7 +81,6 @@ QmlInspectorToolBar::QmlInspectorToolBar(QObject *parent) :
m_menuPauseAction(0), m_menuPauseAction(0),
m_playIcon(QIcon(QLatin1String(":/qml/images/play-small.png"))), m_playIcon(QIcon(QLatin1String(":/qml/images/play-small.png"))),
m_pauseIcon(QIcon(QLatin1String(":/qml/images/pause-small.png"))), m_pauseIcon(QIcon(QLatin1String(":/qml/images/pause-small.png"))),
m_filterExp(0),
m_colorBox(0), m_colorBox(0),
m_emitSignals(true), m_emitSignals(true),
m_isRunning(false), m_isRunning(false),
@@ -102,7 +101,6 @@ void QmlInspectorToolBar::setEnabled(bool value)
m_zoomAction->setEnabled(value); m_zoomAction->setEnabled(value);
m_colorPickerAction->setEnabled(value); m_colorPickerAction->setEnabled(value);
m_colorBox->setEnabled(value); m_colorBox->setEnabled(value);
m_filterExp->setEnabled(value);
} }
void QmlInspectorToolBar::enable() void QmlInspectorToolBar::enable()
@@ -304,10 +302,6 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
m_colorBox->setOuterBorderColor(QColor(58, 58, 58)); m_colorBox->setOuterBorderColor(QColor(58, 58, 58));
toolBarLayout->addWidget(m_colorBox); toolBarLayout->addWidget(m_colorBox);
m_filterExp = new QLineEdit(m_barWidget);
m_filterExp->setPlaceholderText("<filter property list>");
toolBarLayout->addWidget(m_filterExp);
setEnabled(false); setEnabled(false);
connect(m_fromQmlAction, SIGNAL(triggered()), SLOT(activateFromQml())); connect(m_fromQmlAction, SIGNAL(triggered()), SLOT(activateFromQml()));
@@ -318,7 +312,6 @@ void QmlInspectorToolBar::createActions(const Core::Context &context)
connect(m_selectAction, SIGNAL(triggered()), SLOT(activateSelectToolOnClick())); connect(m_selectAction, SIGNAL(triggered()), SLOT(activateSelectToolOnClick()));
connect(m_zoomAction, SIGNAL(triggered()), SLOT(activateZoomOnClick())); connect(m_zoomAction, SIGNAL(triggered()), SLOT(activateZoomOnClick()));
connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
connect(m_filterExp, SIGNAL(textChanged(QString)), SIGNAL(filterTextChanged(QString)));
Debugger::DebuggerMainWindow *mw = Debugger::DebuggerPlugin::mainWindow(); Debugger::DebuggerMainWindow *mw = Debugger::DebuggerPlugin::mainWindow();
activeDebugLanguagesChanged(mw->activeDebugLanguages()); activeDebugLanguagesChanged(mw->activeDebugLanguages());

View File

@@ -42,7 +42,6 @@
QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QColor) QT_FORWARD_DECLARE_CLASS(QColor)
QT_FORWARD_DECLARE_CLASS(QToolButton) QT_FORWARD_DECLARE_CLASS(QToolButton)
QT_FORWARD_DECLARE_CLASS(QLineEdit)
namespace Core { namespace Core {
class Context; class Context;
@@ -50,7 +49,6 @@ namespace Core {
namespace Utils { namespace Utils {
class StyledBar; class StyledBar;
class FilterLineEdit;
} }
namespace QmlJSInspector { namespace QmlJSInspector {
@@ -102,7 +100,6 @@ signals:
void showAppOnTopSelected(bool isChecked); void showAppOnTopSelected(bool isChecked);
void animationSpeedChanged(qreal slowdownFactor = 1.0f); void animationSpeedChanged(qreal slowdownFactor = 1.0f);
void filterTextChanged(const QString &);
private slots: private slots:
void activateDesignModeOnClick(); void activateDesignModeOnClick();
@@ -149,8 +146,6 @@ private:
QIcon m_playIcon; QIcon m_playIcon;
QIcon m_pauseIcon; QIcon m_pauseIcon;
QLineEdit *m_filterExp;
ToolBarColorBox *m_colorBox; ToolBarColorBox *m_colorBox;
bool m_emitSignals; bool m_emitSignals;

View File

@@ -52,6 +52,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <utils/stylehelper.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
@@ -94,6 +95,7 @@
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QPainter>
#include <QtGui/QSpinBox> #include <QtGui/QSpinBox>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QTextBlock> #include <QtGui/QTextBlock>
@@ -114,6 +116,24 @@ enum {
ConnectionAttemptSimultaneousInterval = 500 ConnectionAttemptSimultaneousInterval = 500
}; };
/**
* A widget that has the base color.
*/
class StyledBackground : public QWidget
{
public:
explicit StyledBackground(QWidget *parent = 0)
: QWidget(parent)
{}
protected:
void paintEvent(QPaintEvent *e)
{
QPainter p(this);
p.fillRect(e->rect(), Utils::StyleHelper::baseColor());
}
};
InspectorUi *InspectorUi::m_instance = 0; InspectorUi *InspectorUi::m_instance = 0;
QmlJS::ModelManagerInterface *modelManager() QmlJS::ModelManagerInterface *modelManager()
@@ -126,6 +146,7 @@ InspectorUi::InspectorUi(QObject *parent)
, m_listeningToEditorManager(false) , m_listeningToEditorManager(false)
, m_toolBar(0) , m_toolBar(0)
, m_crumblePath(0) , m_crumblePath(0)
, m_filterExp(0)
, m_propertyInspector(0) , m_propertyInspector(0)
, m_settings(new InspectorSettings(this)) , m_settings(new InspectorSettings(this))
, m_clientProxy(0) , m_clientProxy(0)
@@ -708,11 +729,24 @@ void InspectorUi::setupDockWidgets()
observerWidget->setWindowTitle(tr("QML Observer")); observerWidget->setWindowTitle(tr("QML Observer"));
observerWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR); observerWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
QWidget *pathAndFilterWidget = new StyledBackground;
pathAndFilterWidget->setMaximumHeight(m_crumblePath->height());
m_filterExp = new QLineEdit;
m_filterExp->setPlaceholderText("Filter properties");
m_filterExp->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
QHBoxLayout *pathAndFilterLayout = new QHBoxLayout(pathAndFilterWidget);
pathAndFilterLayout->setMargin(0);
pathAndFilterLayout->setSpacing(0);
pathAndFilterLayout->addWidget(m_crumblePath);
pathAndFilterLayout->addWidget(m_filterExp);
QVBoxLayout *wlay = new QVBoxLayout(observerWidget); QVBoxLayout *wlay = new QVBoxLayout(observerWidget);
wlay->setMargin(0); wlay->setMargin(0);
wlay->setSpacing(0); wlay->setSpacing(0);
observerWidget->setLayout(wlay); observerWidget->setLayout(wlay);
wlay->addWidget(m_crumblePath); wlay->addWidget(pathAndFilterWidget);
wlay->addWidget(m_propertyInspector); wlay->addWidget(m_propertyInspector);
QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage, observerWidget); QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage, observerWidget);
@@ -858,7 +892,7 @@ void InspectorUi::connectSignals()
connect(m_toolBar, SIGNAL(showAppOnTopSelected(bool)), connect(m_toolBar, SIGNAL(showAppOnTopSelected(bool)),
m_clientProxy, SLOT(showAppOnTop(bool))); m_clientProxy, SLOT(showAppOnTop(bool)));
connect(m_toolBar, SIGNAL(filterTextChanged(QString)), connect(m_filterExp, SIGNAL(textChanged(QString)),
m_propertyInspector, SLOT(filterBy(QString))); m_propertyInspector, SLOT(filterBy(QString)));
} }

View File

@@ -45,6 +45,8 @@
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtCore/QObject> #include <QtCore/QObject>
QT_FORWARD_DECLARE_CLASS(QLineEdit)
namespace ProjectExplorer { namespace ProjectExplorer {
class Project; class Project;
class Environment; class Environment;
@@ -157,6 +159,7 @@ private:
bool m_listeningToEditorManager; bool m_listeningToEditorManager;
QmlInspectorToolBar *m_toolBar; QmlInspectorToolBar *m_toolBar;
ContextCrumblePath *m_crumblePath; ContextCrumblePath *m_crumblePath;
QLineEdit *m_filterExp;
QmlJSPropertyInspector *m_propertyInspector; QmlJSPropertyInspector *m_propertyInspector;
InspectorSettings *m_settings; InspectorSettings *m_settings;