Commit f20841ca authored by Erik Verbruggen's avatar Erik Verbruggen

Fixes for the QML designer settings page.

parent 5d95c35e
...@@ -37,7 +37,13 @@ static const char *qmlGroup = "Qml"; ...@@ -37,7 +37,13 @@ static const char *qmlGroup = "Qml";
static const char *qmlDesignerGroup = "Designer"; static const char *qmlDesignerGroup = "Designer";
static const char *snapToGridKey = "SnapToGrid"; static const char *snapToGridKey = "SnapToGrid";
static const char *showBoundingRectanglesKey = "ShowBoundingRectangles"; static const char *showBoundingRectanglesKey = "ShowBoundingRectangles";
static const char *onlyShowItemsWithContentsKey = "OnlyShowItemsWithContents";
DesignerSettings::DesignerSettings()
: snapToGrid(false)
, showBoundingRectangles(false)
, onlyShowItemsWithContents(false)
{}
void DesignerSettings::fromSettings(QSettings *settings) void DesignerSettings::fromSettings(QSettings *settings)
{ {
settings->beginGroup(QLatin1String(qmlGroup)); settings->beginGroup(QLatin1String(qmlGroup));
...@@ -45,6 +51,8 @@ void DesignerSettings::fromSettings(QSettings *settings) ...@@ -45,6 +51,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
snapToGrid = settings->value(QLatin1String(snapToGridKey), false).toBool(); snapToGrid = settings->value(QLatin1String(snapToGridKey), false).toBool();
showBoundingRectangles = settings->value( showBoundingRectangles = settings->value(
QLatin1String(showBoundingRectanglesKey), false).toBool(); QLatin1String(showBoundingRectanglesKey), false).toBool();
onlyShowItemsWithContents = settings->value(
QLatin1String(onlyShowItemsWithContentsKey), false).toBool();
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();
} }
...@@ -56,6 +64,8 @@ void DesignerSettings::toSettings(QSettings *settings) const ...@@ -56,6 +64,8 @@ void DesignerSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(snapToGridKey), snapToGrid); settings->setValue(QLatin1String(snapToGridKey), snapToGrid);
settings->setValue(QLatin1String(showBoundingRectanglesKey), settings->setValue(QLatin1String(showBoundingRectanglesKey),
showBoundingRectangles); showBoundingRectangles);
settings->setValue(QLatin1String(onlyShowItemsWithContentsKey),
onlyShowItemsWithContents);
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();
} }
......
...@@ -40,6 +40,8 @@ QT_END_NAMESPACE ...@@ -40,6 +40,8 @@ QT_END_NAMESPACE
namespace QmlDesigner { namespace QmlDesigner {
struct DesignerSettings { struct DesignerSettings {
DesignerSettings();
void fromSettings(QSettings *); void fromSettings(QSettings *);
void toSettings(QSettings *) const; void toSettings(QSettings *) const;
...@@ -47,6 +49,7 @@ struct DesignerSettings { ...@@ -47,6 +49,7 @@ struct DesignerSettings {
bool snapToGrid; bool snapToGrid;
bool showBoundingRectangles; bool showBoundingRectangles;
bool onlyShowItemsWithContents;
}; };
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "designmode.h" #include "designmode.h"
#include "qmldesignerconstants.h" #include "qmldesignerconstants.h"
#include "pluginmanager.h" #include "pluginmanager.h"
#include "settingspage.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/dialogs/iwizard.h> #include <coreplugin/dialogs/iwizard.h>
...@@ -99,6 +100,7 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error ...@@ -99,6 +100,7 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
m_designerCore->pluginManager()->setPluginPaths(QStringList() << pluginPath); m_designerCore->pluginManager()->setPluginPaths(QStringList() << pluginPath);
addAutoReleasedObject(new DesignMode); addAutoReleasedObject(new DesignMode);
addAutoReleasedObject(new SettingsPage);
error_message->clear(); error_message->clear();
......
...@@ -49,6 +49,8 @@ DesignerSettings SettingsPageWidget::settings() const ...@@ -49,6 +49,8 @@ DesignerSettings SettingsPageWidget::settings() const
DesignerSettings ds; DesignerSettings ds;
ds.snapToGrid = m_ui.snapToGridCheckbox->isChecked(); ds.snapToGrid = m_ui.snapToGridCheckbox->isChecked();
ds.showBoundingRectangles = m_ui.showBoundingRectanglesCheckbox->isChecked(); ds.showBoundingRectangles = m_ui.showBoundingRectanglesCheckbox->isChecked();
ds.onlyShowItemsWithContents =
m_ui.onlyShowItemsWithContentsCheckBox->isChecked();
return ds; return ds;
} }
...@@ -56,6 +58,7 @@ void SettingsPageWidget::setSettings(const DesignerSettings &s) ...@@ -56,6 +58,7 @@ void SettingsPageWidget::setSettings(const DesignerSettings &s)
{ {
m_ui.snapToGridCheckbox->setChecked(s.snapToGrid); m_ui.snapToGridCheckbox->setChecked(s.snapToGrid);
m_ui.showBoundingRectanglesCheckbox->setChecked(s.showBoundingRectangles); m_ui.showBoundingRectanglesCheckbox->setChecked(s.showBoundingRectangles);
m_ui.onlyShowItemsWithContentsCheckBox->setChecked(s.onlyShowItemsWithContents);
} }
QString SettingsPageWidget::searchKeywords() const QString SettingsPageWidget::searchKeywords() const
...@@ -63,7 +66,8 @@ QString SettingsPageWidget::searchKeywords() const ...@@ -63,7 +66,8 @@ QString SettingsPageWidget::searchKeywords() const
QString rc; QString rc;
QTextStream(&rc) QTextStream(&rc)
<< m_ui.snapToGridCheckbox->text() << m_ui.snapToGridCheckbox->text()
<< m_ui.showBoundingRectanglesCheckbox->text() << ' ' << m_ui.showBoundingRectanglesCheckbox->text()
<< ' ' << m_ui.onlyShowItemsWithContentsCheckBox->text()
<< ' ' << m_ui.groupBox->title(); << ' ' << m_ui.groupBox->title();
rc.remove(QLatin1Char('&')); rc.remove(QLatin1Char('&'));
return rc; return rc;
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="onlyShowItemsWithContentsCheckBox">
<property name="text">
<string>Only Show Items with Contents</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
......
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