forked from qt-creator/qt-creator
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:
@@ -365,8 +365,11 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
||||
#else
|
||||
const QString controlsStyle;
|
||||
#endif
|
||||
if (!controlsStyle.isEmpty())
|
||||
if (!controlsStyle.isEmpty()) {
|
||||
environment.set(QLatin1String("QT_QUICK_CONTROLS_STYLE"), controlsStyle);
|
||||
environment.set(QLatin1String("QT_LABS_CONTROLS_STYLE"), controlsStyle);
|
||||
}
|
||||
|
||||
|
||||
if (!m_qrcMapping.isEmpty()) {
|
||||
environment.set(QLatin1String("QMLDESIGNER_RC_PATHS"), m_qrcMapping);
|
||||
|
||||
@@ -54,6 +54,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
connect(m_ui.designerEnableDebuggerCheckBox, &QCheckBox::toggled, [=](bool checked) {
|
||||
if (checked && ! m_ui.designerShowDebuggerCheckBox->isChecked())
|
||||
m_ui.designerShowDebuggerCheckBox->setChecked(true);
|
||||
@@ -76,6 +77,10 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||
m_ui.puppetBuildPathLineEdit, &QLineEdit::setEnabled);
|
||||
connect(m_ui.resetStyle, &QPushButton::clicked,
|
||||
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.debugPuppetComboBox->addItems(puppetModes());
|
||||
@@ -177,6 +182,8 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
|
||||
DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS).toBool());
|
||||
m_ui.showWarnExceptionsCheckBox->setChecked(settings.value(
|
||||
DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT).toBool());
|
||||
|
||||
m_ui.controls2StyleComboBox->setCurrentText(m_ui.styleLineEdit->text());
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage() :
|
||||
|
||||
@@ -113,29 +113,61 @@
|
||||
<property name="title">
|
||||
<string>Styling</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Controls style:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="styleLineEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Default style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="resetStyle">
|
||||
<property name="text">
|
||||
<string>Reset Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<zorder>label_3</zorder>
|
||||
<zorder>styleLineEdit</zorder>
|
||||
<zorder>label_6</zorder>
|
||||
<zorder>controls2StyleComboBox</zorder>
|
||||
<zorder>resetStyle</zorder>
|
||||
<zorder>groupBox_6</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user