QmlDesigner: Adding support for Controls 2 styles

The environment variable used for styling is the same as for
Controls 1.0.

I added a combo box that allows to easliy choose the styles shipped by us:
Default, Material and Universal.

I also set the environment variable for labs Controls so this can be used
with Qt 5.6.

Change-Id: I73a4dd2b4132175638c99cf9be65f1ab1b7e6d8e
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-06-16 10:22:34 +02:00
parent 4a74b6184f
commit 62acb38d56
3 changed files with 47 additions and 5 deletions

View File

@@ -365,8 +365,11 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
#else #else
const QString controlsStyle; const QString controlsStyle;
#endif #endif
if (!controlsStyle.isEmpty()) if (!controlsStyle.isEmpty()) {
environment.set(QLatin1String("QT_QUICK_CONTROLS_STYLE"), controlsStyle); environment.set(QLatin1String("QT_QUICK_CONTROLS_STYLE"), controlsStyle);
environment.set(QLatin1String("QT_LABS_CONTROLS_STYLE"), controlsStyle);
}
if (!m_qrcMapping.isEmpty()) { if (!m_qrcMapping.isEmpty()) {
environment.set(QLatin1String("QMLDESIGNER_RC_PATHS"), m_qrcMapping); environment.set(QLatin1String("QMLDESIGNER_RC_PATHS"), m_qrcMapping);

View File

@@ -54,6 +54,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
connect(m_ui.designerEnableDebuggerCheckBox, &QCheckBox::toggled, [=](bool checked) { connect(m_ui.designerEnableDebuggerCheckBox, &QCheckBox::toggled, [=](bool checked) {
if (checked && ! m_ui.designerShowDebuggerCheckBox->isChecked()) if (checked && ! m_ui.designerShowDebuggerCheckBox->isChecked())
m_ui.designerShowDebuggerCheckBox->setChecked(true); m_ui.designerShowDebuggerCheckBox->setChecked(true);
@@ -76,6 +77,10 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
m_ui.puppetBuildPathLineEdit, &QLineEdit::setEnabled); m_ui.puppetBuildPathLineEdit, &QLineEdit::setEnabled);
connect(m_ui.resetStyle, &QPushButton::clicked, connect(m_ui.resetStyle, &QPushButton::clicked,
m_ui.styleLineEdit, &QLineEdit::clear); m_ui.styleLineEdit, &QLineEdit::clear);
connect(m_ui.controls2StyleComboBox, &QComboBox::currentTextChanged, [=]() {
m_ui.styleLineEdit->setText(m_ui.controls2StyleComboBox->currentText());
}
);
m_ui.forwardPuppetOutputComboBox->addItems(puppetModes()); m_ui.forwardPuppetOutputComboBox->addItems(puppetModes());
m_ui.debugPuppetComboBox->addItems(puppetModes()); m_ui.debugPuppetComboBox->addItems(puppetModes());
@@ -177,6 +182,8 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS).toBool()); DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS).toBool());
m_ui.showWarnExceptionsCheckBox->setChecked(settings.value( m_ui.showWarnExceptionsCheckBox->setChecked(settings.value(
DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT).toBool()); DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT).toBool());
m_ui.controls2StyleComboBox->setCurrentText(m_ui.styleLineEdit->text());
} }
SettingsPage::SettingsPage() : SettingsPage::SettingsPage() :

View File

@@ -113,29 +113,61 @@
<property name="title"> <property name="title">
<string>Styling</string> <string>Styling</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QGridLayout" name="gridLayout_5">
<item> <item row="0" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Controls style:</string> <string>Controls style:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QLineEdit" name="styleLineEdit"> <widget class="QLineEdit" name="styleLineEdit">
<property name="placeholderText"> <property name="placeholderText">
<string>Default style</string> <string>Default style</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2">
<widget class="QPushButton" name="resetStyle"> <widget class="QPushButton" name="resetStyle">
<property name="text"> <property name="text">
<string>Reset Style</string> <string>Reset Style</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Controls 2 style</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="controls2StyleComboBox">
<item>
<property name="text">
<string>Default</string>
</property>
</item>
<item>
<property name="text">
<string>Material</string>
</property>
</item>
<item>
<property name="text">
<string>Universal</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
<zorder>label_3</zorder>
<zorder>styleLineEdit</zorder>
<zorder>label_6</zorder>
<zorder>controls2StyleComboBox</zorder>
<zorder>resetStyle</zorder>
<zorder>groupBox_6</zorder>
</widget> </widget>
</item> </item>
</layout> </layout>