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