Commit 0cd0dd7c authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QtQuickToolBar: Changing context menu

Instead of the "Disable permanently" action, I added
a checkable action "Show depending on context".

If the Quick Toolbar is forced by a shortcut it can
be enabled now.
parent 00c8e760
......@@ -178,9 +178,10 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
addAction(m_resetAction.data());
connect(m_resetAction.data(), SIGNAL(triggered(bool)), this, SLOT(onResetPosition(bool)));
QAction *disableAction = new QAction(tr("Disable permanently"), this);
addAction(disableAction);
connect(disableAction, SIGNAL(triggered()), this, SLOT(onDisable()));
m_disableAction = new QAction(tr("Show depending on context"), this);
addAction(m_disableAction.data());
m_disableAction->setCheckable(true);
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
m_pinned = false;
}
......@@ -205,6 +206,7 @@ void ContextPaneWidget::activate(const QPoint &pos, const QPoint &alternative, c
rePosition(pos, alternative, alternative2);
raise();
m_resetAction->setChecked(Internal::BauhausPlugin::pluginInstance()->settings().pinContextPane);
m_disableAction->setChecked(Internal::BauhausPlugin::pluginInstance()->settings().enableContextPane);
}
void ContextPaneWidget::rePosition(const QPoint &position, const QPoint &alternative, const QPoint &alternative2)
......@@ -358,13 +360,15 @@ void ContextPaneWidget::onShowColorDialog(bool checked, const QPoint &p)
}
}
void ContextPaneWidget::onDisable()
void ContextPaneWidget::onDisable(bool b)
{
DesignerSettings designerSettings = Internal::BauhausPlugin::pluginInstance()->settings();
designerSettings.enableContextPane = false;
designerSettings.enableContextPane = b;
Internal::BauhausPlugin::pluginInstance()->setSettings(designerSettings);
hide();
colorDialog()->hide();
if (!b) {
hide();
colorDialog()->hide();
}
}
void ContextPaneWidget::onResetPosition(bool toggle)
......
......@@ -69,7 +69,7 @@ signals:
void removeAndChangeProperty(const QString &, const QString &, const QVariant &, bool);
private slots:
void onDisable();
void onDisable(bool);
void onResetPosition(bool toggle);
protected:
......@@ -95,6 +95,7 @@ private:
ContextPaneWidgetRectangle *m_rectangleWidget;
QWeakPointer<BauhausColorDialog> m_bauhausColorDialog;
QWeakPointer<QAction> m_resetAction;
QWeakPointer<QAction> m_disableAction;
QString m_colorName;
QPoint m_originalPos;
bool m_pinned;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment