forked from qt-creator/qt-creator
QmlDesigner: remove QuickToolBar from QmlDesigner
QuickToolBar is moved to QmlJsEditor For some widgets and resources QmlDesigner relies now on lib/qmleditorwidgets
This commit is contained in:
@@ -51,10 +51,6 @@ void DesignerSettings::fromSettings(QSettings *settings)
|
||||
QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(0)).toInt();
|
||||
snapMargin = settings->value(
|
||||
QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), QVariant(0)).toInt();
|
||||
enableContextPane = settings->value(
|
||||
QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANE_KEY), QVariant(1)).toBool();
|
||||
pinContextPane = settings->value(
|
||||
QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANEPIN_KEY), QVariant(0)).toBool();
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
}
|
||||
@@ -66,8 +62,6 @@ void DesignerSettings::toSettings(QSettings *settings) const
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), snapMargin);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANE_KEY), enableContextPane);
|
||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANEPIN_KEY), pinContextPane);
|
||||
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
@@ -77,7 +71,5 @@ bool DesignerSettings::equals(const DesignerSettings &other) const
|
||||
{
|
||||
return openDesignMode == other.openDesignMode
|
||||
&& snapMargin == other.snapMargin
|
||||
&& itemSpacing == other.itemSpacing
|
||||
&& enableContextPane == other.enableContextPane
|
||||
&& pinContextPane == other.pinContextPane;
|
||||
&& itemSpacing == other.itemSpacing;
|
||||
}
|
||||
|
@@ -50,8 +50,6 @@ public:
|
||||
bool openDesignMode;
|
||||
int itemSpacing;
|
||||
int snapMargin;
|
||||
bool enableContextPane;
|
||||
bool pinContextPane;
|
||||
};
|
||||
|
||||
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "qmlcontextpane.h"
|
||||
#include <contextpanewidget.h>
|
||||
#include <qmldesignerplugin.h>
|
||||
#include <quicktoolbarsettingspage.h>
|
||||
|
||||
#include <utils/changeset.h>
|
||||
#include <qmljs/parser/qmljsast_p.h>
|
||||
@@ -14,6 +15,7 @@
|
||||
#include <qmljs/qmljsscopebuilder.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/tabsettings.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <colorwidget.h>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -68,7 +70,7 @@ QmlContextPane::~QmlContextPane()
|
||||
|
||||
void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document::Ptr doc, const QmlJS::Snapshot &snapshot, AST::Node *node, bool update, bool force)
|
||||
{
|
||||
if (!Internal::BauhausPlugin::pluginInstance()->settings().enableContextPane && !force && !update) {
|
||||
if (!QuickToolBarSettings::get().enableContextPane && !force && !update) {
|
||||
contextWidget()->hide();
|
||||
return;
|
||||
}
|
||||
@@ -147,9 +149,10 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document:
|
||||
p2.setX(p1.x());
|
||||
contextWidget()->setType(prototypes);
|
||||
if (!update)
|
||||
contextWidget()->activate(p3 , p1, p2);
|
||||
contextWidget()->activate(p3 , p1, p2, QuickToolBarSettings::get().pinContextPane);
|
||||
else
|
||||
contextWidget()->rePosition(p3 , p1, p2);
|
||||
contextWidget()->rePosition(p3 , p1, p2, QuickToolBarSettings::get().pinContextPane);
|
||||
contextWidget()->setOptions(QuickToolBarSettings::get().enableContextPane, QuickToolBarSettings::get().pinContextPane);
|
||||
contextWidget()->setPath(doc->path());
|
||||
contextWidget()->setProperties(&propertyReader);
|
||||
m_doc = doc;
|
||||
@@ -340,6 +343,21 @@ void QmlContextPane::onPropertyRemovedAndChange(const QString &remove, const QSt
|
||||
|
||||
}
|
||||
|
||||
void QmlContextPane::onPinnedChanged(bool b)
|
||||
{
|
||||
QuickToolBarSettings settings = QuickToolBarSettings::get();
|
||||
settings.pinContextPane = b;
|
||||
settings.set();
|
||||
}
|
||||
|
||||
void QmlContextPane::onEnabledChanged(bool b)
|
||||
{
|
||||
QuickToolBarSettings settings = QuickToolBarSettings::get();
|
||||
settings.pinContextPane = b;
|
||||
settings.enableContextPane = b;
|
||||
settings.set();
|
||||
}
|
||||
|
||||
ContextPaneWidget* QmlContextPane::contextWidget()
|
||||
{
|
||||
if (m_widget.isNull()) { //lazily recreate widget
|
||||
@@ -347,6 +365,8 @@ ContextPaneWidget* QmlContextPane::contextWidget()
|
||||
connect(m_widget.data(), SIGNAL(propertyChanged(QString,QVariant)), this, SLOT(onPropertyChanged(QString,QVariant)));
|
||||
connect(m_widget.data(), SIGNAL(removeProperty(QString)), this, SLOT(onPropertyRemoved(QString)));
|
||||
connect(m_widget.data(), SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)), this, SLOT(onPropertyRemovedAndChange(QString,QString,QVariant, bool)));
|
||||
connect(m_widget.data(), SIGNAL(enabledChanged(bool)), this, SLOT(onEnabledChanged(bool)));
|
||||
connect(m_widget.data(), SIGNAL(pinnedChanged(bool)), this, SLOT(onPinnedChanged(bool)));
|
||||
}
|
||||
return m_widget.data();
|
||||
}
|
||||
|
@@ -39,6 +39,9 @@ public slots:
|
||||
void onPropertyChanged(const QString &, const QVariant &);
|
||||
void onPropertyRemoved(const QString &);
|
||||
void onPropertyRemovedAndChange(const QString &, const QString &, const QVariant &, bool removeFirst = true);
|
||||
void onPinnedChanged(bool);
|
||||
void onEnabledChanged(bool);
|
||||
|
||||
private:
|
||||
ContextPaneWidget* contextWidget();
|
||||
QWeakPointer<ContextPaneWidget> m_widget;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
include(../../libs/utils/utils.pri)
|
||||
include(../../libs/qmljs/qmljs.pri)
|
||||
include(../../libs/qmleditorwidgets/qmleditorwidgets.pri)
|
||||
include(../coreplugin/coreplugin.pri)
|
||||
include(../texteditor/texteditor.pri)
|
||||
include(../qmljseditor/qmljseditor.pri)
|
||||
|
@@ -34,8 +34,6 @@
|
||||
#include "designmodewidget.h"
|
||||
#include "settingspage.h"
|
||||
#include "designmodecontext.h"
|
||||
#include "qmlcontextpane.h"
|
||||
|
||||
|
||||
#include <qmljseditor/qmljseditorconstants.h>
|
||||
|
||||
@@ -145,9 +143,8 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
|
||||
|
||||
addAutoReleasedObject(new SettingsPage);
|
||||
|
||||
m_settings.fromSettings(core->settings());
|
||||
|
||||
addAutoReleasedObject(new QmlContextPane);
|
||||
m_settings.fromSettings(core->settings());
|
||||
|
||||
error_message->clear();
|
||||
|
||||
|
@@ -15,7 +15,6 @@ include(components/pluginmanager/pluginmanager.pri)
|
||||
include(components/themeloader/qts60stylethemeio.pri)
|
||||
include(components/stateseditor/stateseditor.pri)
|
||||
include(components/resources/resources.pri)
|
||||
include(components/easingpane/easingpane.pri)
|
||||
|
||||
HEADERS += qmldesignerconstants.h \
|
||||
qmldesignerplugin.h \
|
||||
@@ -24,8 +23,7 @@ HEADERS += qmldesignerconstants.h \
|
||||
designersettings.h \
|
||||
settingspage.h \
|
||||
designmodecontext.h \
|
||||
styledoutputpaneplaceholder.h \
|
||||
qmlcontextpane.h
|
||||
styledoutputpaneplaceholder.h
|
||||
|
||||
SOURCES += qmldesignerplugin.cpp \
|
||||
designmodewidget.cpp \
|
||||
@@ -33,8 +31,7 @@ SOURCES += qmldesignerplugin.cpp \
|
||||
designersettings.cpp \
|
||||
settingspage.cpp \
|
||||
designmodecontext.cpp \
|
||||
styledoutputpaneplaceholder.cpp \
|
||||
qmlcontextpane.cpp
|
||||
styledoutputpaneplaceholder.cpp
|
||||
|
||||
FORMS += settingspage.ui
|
||||
|
||||
|
@@ -49,8 +49,6 @@ DesignerSettings SettingsPageWidget::settings() const
|
||||
DesignerSettings ds;
|
||||
ds.itemSpacing = m_ui.spinItemSpacing->value();
|
||||
ds.snapMargin = m_ui.spinSnapMargin->value();
|
||||
ds.enableContextPane = m_ui.textEditHelperCheckBox->isChecked();
|
||||
ds.pinContextPane = m_ui.textEditHelperCheckBoxPin->isChecked();
|
||||
return ds;
|
||||
}
|
||||
|
||||
@@ -58,8 +56,6 @@ void SettingsPageWidget::setSettings(const DesignerSettings &s)
|
||||
{
|
||||
m_ui.spinItemSpacing->setValue(s.itemSpacing);
|
||||
m_ui.spinSnapMargin->setValue(s.snapMargin);
|
||||
m_ui.textEditHelperCheckBox->setChecked(s.enableContextPane);
|
||||
m_ui.textEditHelperCheckBoxPin->setChecked(s.pinContextPane);
|
||||
}
|
||||
|
||||
QString SettingsPageWidget::searchKeywords() const
|
||||
|
@@ -99,32 +99,6 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Quick Toolbars</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="textEditHelperCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Quick Toolbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="textEditHelperCheckBoxPin">
|
||||
<property name="toolTip">
|
||||
<string>If enabled the toolbar will remain pinned to an absolute position.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pin Quick Toolbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
Reference in New Issue
Block a user