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();
|
QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(0)).toInt();
|
||||||
snapMargin = settings->value(
|
snapMargin = settings->value(
|
||||||
QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), QVariant(0)).toInt();
|
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();
|
||||||
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_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode);
|
||||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing);
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing);
|
||||||
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), snapMargin);
|
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();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
@@ -77,7 +71,5 @@ bool DesignerSettings::equals(const DesignerSettings &other) const
|
|||||||
{
|
{
|
||||||
return openDesignMode == other.openDesignMode
|
return openDesignMode == other.openDesignMode
|
||||||
&& snapMargin == other.snapMargin
|
&& snapMargin == other.snapMargin
|
||||||
&& itemSpacing == other.itemSpacing
|
&& itemSpacing == other.itemSpacing;
|
||||||
&& enableContextPane == other.enableContextPane
|
|
||||||
&& pinContextPane == other.pinContextPane;
|
|
||||||
}
|
}
|
||||||
|
@@ -49,9 +49,7 @@ public:
|
|||||||
bool equals(const DesignerSettings &other) const;
|
bool equals(const DesignerSettings &other) const;
|
||||||
bool openDesignMode;
|
bool openDesignMode;
|
||||||
int itemSpacing;
|
int itemSpacing;
|
||||||
int snapMargin;
|
int snapMargin;
|
||||||
bool enableContextPane;
|
|
||||||
bool pinContextPane;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
|
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#include "qmlcontextpane.h"
|
#include "qmlcontextpane.h"
|
||||||
#include <contextpanewidget.h>
|
#include <contextpanewidget.h>
|
||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
|
#include <quicktoolbarsettingspage.h>
|
||||||
|
|
||||||
#include <utils/changeset.h>
|
#include <utils/changeset.h>
|
||||||
#include <qmljs/parser/qmljsast_p.h>
|
#include <qmljs/parser/qmljsast_p.h>
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
#include <qmljs/qmljsscopebuilder.h>
|
#include <qmljs/qmljsscopebuilder.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <texteditor/tabsettings.h>
|
#include <texteditor/tabsettings.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <colorwidget.h>
|
#include <colorwidget.h>
|
||||||
#include <QDebug>
|
#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)
|
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();
|
contextWidget()->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -147,9 +149,10 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document:
|
|||||||
p2.setX(p1.x());
|
p2.setX(p1.x());
|
||||||
contextWidget()->setType(prototypes);
|
contextWidget()->setType(prototypes);
|
||||||
if (!update)
|
if (!update)
|
||||||
contextWidget()->activate(p3 , p1, p2);
|
contextWidget()->activate(p3 , p1, p2, QuickToolBarSettings::get().pinContextPane);
|
||||||
else
|
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()->setPath(doc->path());
|
||||||
contextWidget()->setProperties(&propertyReader);
|
contextWidget()->setProperties(&propertyReader);
|
||||||
m_doc = doc;
|
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()
|
ContextPaneWidget* QmlContextPane::contextWidget()
|
||||||
{
|
{
|
||||||
if (m_widget.isNull()) { //lazily recreate widget
|
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(propertyChanged(QString,QVariant)), this, SLOT(onPropertyChanged(QString,QVariant)));
|
||||||
connect(m_widget.data(), SIGNAL(removeProperty(QString)), this, SLOT(onPropertyRemoved(QString)));
|
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(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();
|
return m_widget.data();
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,9 @@ public slots:
|
|||||||
void onPropertyChanged(const QString &, const QVariant &);
|
void onPropertyChanged(const QString &, const QVariant &);
|
||||||
void onPropertyRemoved(const QString &);
|
void onPropertyRemoved(const QString &);
|
||||||
void onPropertyRemovedAndChange(const QString &, const QString &, const QVariant &, bool removeFirst = true);
|
void onPropertyRemovedAndChange(const QString &, const QString &, const QVariant &, bool removeFirst = true);
|
||||||
|
void onPinnedChanged(bool);
|
||||||
|
void onEnabledChanged(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ContextPaneWidget* contextWidget();
|
ContextPaneWidget* contextWidget();
|
||||||
QWeakPointer<ContextPaneWidget> m_widget;
|
QWeakPointer<ContextPaneWidget> m_widget;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
include(../../libs/utils/utils.pri)
|
include(../../libs/utils/utils.pri)
|
||||||
include(../../libs/qmljs/qmljs.pri)
|
include(../../libs/qmljs/qmljs.pri)
|
||||||
|
include(../../libs/qmleditorwidgets/qmleditorwidgets.pri)
|
||||||
include(../coreplugin/coreplugin.pri)
|
include(../coreplugin/coreplugin.pri)
|
||||||
include(../texteditor/texteditor.pri)
|
include(../texteditor/texteditor.pri)
|
||||||
include(../qmljseditor/qmljseditor.pri)
|
include(../qmljseditor/qmljseditor.pri)
|
||||||
|
@@ -34,8 +34,6 @@
|
|||||||
#include "designmodewidget.h"
|
#include "designmodewidget.h"
|
||||||
#include "settingspage.h"
|
#include "settingspage.h"
|
||||||
#include "designmodecontext.h"
|
#include "designmodecontext.h"
|
||||||
#include "qmlcontextpane.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <qmljseditor/qmljseditorconstants.h>
|
#include <qmljseditor/qmljseditorconstants.h>
|
||||||
|
|
||||||
@@ -145,9 +143,8 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
|
|||||||
|
|
||||||
addAutoReleasedObject(new SettingsPage);
|
addAutoReleasedObject(new SettingsPage);
|
||||||
|
|
||||||
m_settings.fromSettings(core->settings());
|
|
||||||
|
|
||||||
addAutoReleasedObject(new QmlContextPane);
|
m_settings.fromSettings(core->settings());
|
||||||
|
|
||||||
error_message->clear();
|
error_message->clear();
|
||||||
|
|
||||||
|
@@ -15,7 +15,6 @@ include(components/pluginmanager/pluginmanager.pri)
|
|||||||
include(components/themeloader/qts60stylethemeio.pri)
|
include(components/themeloader/qts60stylethemeio.pri)
|
||||||
include(components/stateseditor/stateseditor.pri)
|
include(components/stateseditor/stateseditor.pri)
|
||||||
include(components/resources/resources.pri)
|
include(components/resources/resources.pri)
|
||||||
include(components/easingpane/easingpane.pri)
|
|
||||||
|
|
||||||
HEADERS += qmldesignerconstants.h \
|
HEADERS += qmldesignerconstants.h \
|
||||||
qmldesignerplugin.h \
|
qmldesignerplugin.h \
|
||||||
@@ -24,8 +23,7 @@ HEADERS += qmldesignerconstants.h \
|
|||||||
designersettings.h \
|
designersettings.h \
|
||||||
settingspage.h \
|
settingspage.h \
|
||||||
designmodecontext.h \
|
designmodecontext.h \
|
||||||
styledoutputpaneplaceholder.h \
|
styledoutputpaneplaceholder.h
|
||||||
qmlcontextpane.h
|
|
||||||
|
|
||||||
SOURCES += qmldesignerplugin.cpp \
|
SOURCES += qmldesignerplugin.cpp \
|
||||||
designmodewidget.cpp \
|
designmodewidget.cpp \
|
||||||
@@ -33,8 +31,7 @@ SOURCES += qmldesignerplugin.cpp \
|
|||||||
designersettings.cpp \
|
designersettings.cpp \
|
||||||
settingspage.cpp \
|
settingspage.cpp \
|
||||||
designmodecontext.cpp \
|
designmodecontext.cpp \
|
||||||
styledoutputpaneplaceholder.cpp \
|
styledoutputpaneplaceholder.cpp
|
||||||
qmlcontextpane.cpp
|
|
||||||
|
|
||||||
FORMS += settingspage.ui
|
FORMS += settingspage.ui
|
||||||
|
|
||||||
|
@@ -49,8 +49,6 @@ DesignerSettings SettingsPageWidget::settings() const
|
|||||||
DesignerSettings ds;
|
DesignerSettings ds;
|
||||||
ds.itemSpacing = m_ui.spinItemSpacing->value();
|
ds.itemSpacing = m_ui.spinItemSpacing->value();
|
||||||
ds.snapMargin = m_ui.spinSnapMargin->value();
|
ds.snapMargin = m_ui.spinSnapMargin->value();
|
||||||
ds.enableContextPane = m_ui.textEditHelperCheckBox->isChecked();
|
|
||||||
ds.pinContextPane = m_ui.textEditHelperCheckBoxPin->isChecked();
|
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +56,6 @@ void SettingsPageWidget::setSettings(const DesignerSettings &s)
|
|||||||
{
|
{
|
||||||
m_ui.spinItemSpacing->setValue(s.itemSpacing);
|
m_ui.spinItemSpacing->setValue(s.itemSpacing);
|
||||||
m_ui.spinSnapMargin->setValue(s.snapMargin);
|
m_ui.spinSnapMargin->setValue(s.snapMargin);
|
||||||
m_ui.textEditHelperCheckBox->setChecked(s.enableContextPane);
|
|
||||||
m_ui.textEditHelperCheckBoxPin->setChecked(s.pinContextPane);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPageWidget::searchKeywords() const
|
QString SettingsPageWidget::searchKeywords() const
|
||||||
|
@@ -99,32 +99,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<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">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
Reference in New Issue
Block a user