forked from qt-creator/qt-creator
Removed extra toolbar from quick designer, improved settings page
This commit is contained in:
@@ -28,6 +28,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "formeditorwidget.h"
|
#include "formeditorwidget.h"
|
||||||
|
#include "qmldesignerplugin.h"
|
||||||
|
#include "designersettings.h"
|
||||||
|
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -42,7 +44,6 @@
|
|||||||
#include <formeditorgraphicsview.h>
|
#include <formeditorgraphicsview.h>
|
||||||
#include <formeditorscene.h>
|
#include <formeditorscene.h>
|
||||||
#include <formeditorview.h>
|
#include <formeditorview.h>
|
||||||
#include "numberseriesaction.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -82,14 +83,8 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
// addActions(m_toolActionGroup->actions());
|
// addActions(m_toolActionGroup->actions());
|
||||||
// upperActions.append(m_toolActionGroup->actions());
|
// upperActions.append(m_toolActionGroup->actions());
|
||||||
|
|
||||||
QAction *separatorAction = new QAction(this);
|
|
||||||
separatorAction->setSeparator(true);
|
|
||||||
// addAction(separatorAction);
|
|
||||||
// upperActions.append(separatorAction);
|
|
||||||
|
|
||||||
QActionGroup *layoutActionGroup = new QActionGroup(this);
|
QActionGroup *layoutActionGroup = new QActionGroup(this);
|
||||||
layoutActionGroup->setExclusive(true);
|
layoutActionGroup->setExclusive(false);
|
||||||
|
|
||||||
m_snappingAction = layoutActionGroup->addAction("Toogle Snapping (Press Key E)");
|
m_snappingAction = layoutActionGroup->addAction("Toogle Snapping (Press Key E)");
|
||||||
m_snappingAction->setShortcut(Qt::Key_E);
|
m_snappingAction->setShortcut(Qt::Key_E);
|
||||||
m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
@@ -106,17 +101,10 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
m_snappingAndAnchoringAction->setVisible(false);
|
m_snappingAndAnchoringAction->setVisible(false);
|
||||||
m_snappingAndAnchoringAction->setIcon(QPixmap(":/icon/layout/snapping_and_anchoring.png"));
|
m_snappingAndAnchoringAction->setIcon(QPixmap(":/icon/layout/snapping_and_anchoring.png"));
|
||||||
|
|
||||||
m_noSnappingAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key T)");
|
|
||||||
m_noSnappingAction->setShortcut(Qt::Key_T);
|
|
||||||
m_noSnappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
|
||||||
m_noSnappingAction->setCheckable(true);
|
|
||||||
m_noSnappingAction->setChecked(false);
|
|
||||||
m_noSnappingAction->setIcon(QPixmap(":/icon/layout/no_snapping.png"));
|
|
||||||
|
|
||||||
addActions(layoutActionGroup->actions());
|
addActions(layoutActionGroup->actions());
|
||||||
upperActions.append(layoutActionGroup->actions());
|
upperActions.append(layoutActionGroup->actions());
|
||||||
|
|
||||||
separatorAction = new QAction(this);
|
QAction *separatorAction = new QAction(this);
|
||||||
separatorAction->setSeparator(true);
|
separatorAction->setSeparator(true);
|
||||||
addAction(separatorAction);
|
addAction(separatorAction);
|
||||||
upperActions.append(separatorAction);
|
upperActions.append(separatorAction);
|
||||||
@@ -142,9 +130,9 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
upperActions.append(m_selectOnlyContentItemsAction.data());
|
upperActions.append(m_selectOnlyContentItemsAction.data());
|
||||||
|
|
||||||
|
|
||||||
ToolBox *upperToolBox = new ToolBox(this);
|
m_toolBox = new ToolBox(this);
|
||||||
upperToolBox->setActions(upperActions);
|
fillLayout->addWidget(m_toolBox.data());
|
||||||
fillLayout->addWidget(upperToolBox);
|
m_toolBox->setLeftSideActions(upperActions);
|
||||||
|
|
||||||
m_graphicsView = new FormEditorGraphicsView(this);
|
m_graphicsView = new FormEditorGraphicsView(this);
|
||||||
fillLayout->addWidget(m_graphicsView.data());
|
fillLayout->addWidget(m_graphicsView.data());
|
||||||
@@ -157,36 +145,11 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
|
|||||||
|
|
||||||
QList<QAction*> lowerActions;
|
QList<QAction*> lowerActions;
|
||||||
|
|
||||||
m_zoomAction = new ZoomAction(toolActionGroup());
|
m_zoomAction = new ZoomAction(m_toolActionGroup.data());
|
||||||
connect(m_zoomAction.data(), SIGNAL(zoomLevelChanged(double)), SLOT(setZoomLevel(double)));
|
connect(m_zoomAction.data(), SIGNAL(zoomLevelChanged(double)), SLOT(setZoomLevel(double)));
|
||||||
addAction(m_zoomAction.data());
|
addAction(m_zoomAction.data());
|
||||||
lowerActions.append(m_zoomAction.data());
|
upperActions.append(m_zoomAction.data());
|
||||||
|
m_toolBox->addRightSideAction(m_zoomAction.data());
|
||||||
QActionGroup *layoutMarginActionGroup = new QActionGroup(this);
|
|
||||||
|
|
||||||
m_snappingMarginAction = new NumberSeriesAction(layoutMarginActionGroup);
|
|
||||||
m_snappingMarginAction->addEntry(tr("no margins (0)"), 0);
|
|
||||||
m_snappingMarginAction->addEntry(tr("small margin (2)"), 2);
|
|
||||||
m_snappingMarginAction->addEntry(tr("medium margin (6)"), 6);
|
|
||||||
m_snappingMarginAction->addEntry(tr("large margin (10)"), 10);
|
|
||||||
m_snappingMarginAction->setCurrentEntryIndex(2);
|
|
||||||
layoutMarginActionGroup->addAction(m_snappingMarginAction.data());
|
|
||||||
|
|
||||||
|
|
||||||
m_snappingSpacingAction = new NumberSeriesAction(layoutMarginActionGroup);
|
|
||||||
m_snappingSpacingAction->addEntry(tr("no spacing (0)"), 0);
|
|
||||||
m_snappingSpacingAction->addEntry(tr("small spacing (2)"), 2);
|
|
||||||
m_snappingSpacingAction->addEntry(tr("medium spacing (4)"), 4);
|
|
||||||
m_snappingSpacingAction->addEntry(tr("large spacing (6)"), 6);
|
|
||||||
m_snappingSpacingAction->setCurrentEntryIndex(1);
|
|
||||||
layoutMarginActionGroup->addAction(m_snappingSpacingAction.data());
|
|
||||||
|
|
||||||
addActions(layoutMarginActionGroup->actions());
|
|
||||||
lowerActions.append(layoutMarginActionGroup->actions());
|
|
||||||
|
|
||||||
m_lowerToolBox = new ToolBox(this);
|
|
||||||
lowerToolBox()->setActions(lowerActions);
|
|
||||||
fillLayout->addWidget(lowerToolBox());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorWidget::enterEvent(QEvent *event)
|
void FormEditorWidget::enterEvent(QEvent *event)
|
||||||
@@ -198,6 +161,7 @@ void FormEditorWidget::enterEvent(QEvent *event)
|
|||||||
void FormEditorWidget::changeTransformTool(bool checked)
|
void FormEditorWidget::changeTransformTool(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked)
|
||||||
|
|
||||||
m_formEditorView->changeToTransformTools();
|
m_formEditorView->changeToTransformTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,19 +239,21 @@ QActionGroup *FormEditorWidget::toolActionGroup() const
|
|||||||
return m_toolActionGroup.data();
|
return m_toolActionGroup.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolBox *FormEditorWidget::lowerToolBox() const
|
ToolBox *FormEditorWidget::toolBox() const
|
||||||
{
|
{
|
||||||
return m_lowerToolBox.data();
|
return m_toolBox.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
double FormEditorWidget::spacing() const
|
double FormEditorWidget::spacing() const
|
||||||
{
|
{
|
||||||
return m_snappingSpacingAction->currentValue().toDouble();
|
DesignerSettings settings = Internal::BauhausPlugin::pluginInstance()->settings();
|
||||||
|
return settings.itemSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
double FormEditorWidget::margins() const
|
double FormEditorWidget::margins() const
|
||||||
{
|
{
|
||||||
return m_snappingMarginAction->currentValue().toDouble();
|
DesignerSettings settings = Internal::BauhausPlugin::pluginInstance()->settings();
|
||||||
|
return settings.snapMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorWidget::setFeedbackNode(const QmlItemNode &node)
|
void FormEditorWidget::setFeedbackNode(const QmlItemNode &node)
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class FormEditorView;
|
|||||||
class FormEditorScene;
|
class FormEditorScene;
|
||||||
class FormEditorGraphicsView;
|
class FormEditorGraphicsView;
|
||||||
class ToolBox;
|
class ToolBox;
|
||||||
class NumberSeriesAction;
|
|
||||||
class QmlItemNode;
|
class QmlItemNode;
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ public:
|
|||||||
QAction *snappingAndAnchoringAction() const;
|
QAction *snappingAndAnchoringAction() const;
|
||||||
|
|
||||||
void setScene(FormEditorScene *scene);
|
void setScene(FormEditorScene *scene);
|
||||||
ToolBox *lowerToolBox() const;
|
ToolBox *toolBox() const;
|
||||||
|
|
||||||
double spacing() const;
|
double spacing() const;
|
||||||
double margins() const;
|
double margins() const;
|
||||||
@@ -84,15 +83,13 @@ private:
|
|||||||
QWeakPointer<FormEditorView> m_formEditorView;
|
QWeakPointer<FormEditorView> m_formEditorView;
|
||||||
QWeakPointer<FormEditorGraphicsView> m_graphicsView;
|
QWeakPointer<FormEditorGraphicsView> m_graphicsView;
|
||||||
QWeakPointer<ZoomAction> m_zoomAction;
|
QWeakPointer<ZoomAction> m_zoomAction;
|
||||||
|
QWeakPointer<ToolBox> m_toolBox;
|
||||||
QWeakPointer<QAction> m_anchorToolAction;
|
QWeakPointer<QAction> m_anchorToolAction;
|
||||||
QWeakPointer<QAction> m_transformToolAction;
|
QWeakPointer<QAction> m_transformToolAction;
|
||||||
QWeakPointer<QActionGroup> m_toolActionGroup;
|
QWeakPointer<QActionGroup> m_toolActionGroup;
|
||||||
QWeakPointer<ToolBox> m_lowerToolBox;
|
|
||||||
QWeakPointer<QAction> m_snappingAction;
|
QWeakPointer<QAction> m_snappingAction;
|
||||||
QWeakPointer<QAction> m_snappingAndAnchoringAction;
|
QWeakPointer<QAction> m_snappingAndAnchoringAction;
|
||||||
QWeakPointer<QAction> m_noSnappingAction;
|
QWeakPointer<QAction> m_noSnappingAction;
|
||||||
QWeakPointer<NumberSeriesAction> m_snappingMarginAction;
|
|
||||||
QWeakPointer<NumberSeriesAction> m_snappingSpacingAction;
|
|
||||||
QWeakPointer<QAction> m_showBoundingRectAction;
|
QWeakPointer<QAction> m_showBoundingRectAction;
|
||||||
QWeakPointer<QAction> m_selectOnlyContentItemsAction;
|
QWeakPointer<QAction> m_selectOnlyContentItemsAction;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "toolbox.h"
|
#include "toolbox.h"
|
||||||
|
#include "utils/styledbar.h"
|
||||||
|
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -38,49 +39,59 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ToolBox::ToolBox(QWidget *parentWidget)
|
ToolBox::ToolBox(QWidget *parentWidget)
|
||||||
: QWidget(parentWidget),
|
: Utils::StyledBar(parentWidget),
|
||||||
m_toolBar(new QToolBar("Sidebar", this))
|
m_leftToolBar(new QToolBar("LeftSidebar", this)),
|
||||||
|
m_rightToolBar(new QToolBar("RightSidebar", this))
|
||||||
{
|
{
|
||||||
QHBoxLayout *fillLayout = new QHBoxLayout(this);
|
QHBoxLayout *fillLayout = new QHBoxLayout(this);
|
||||||
fillLayout->setMargin(0);
|
fillLayout->setMargin(0);
|
||||||
|
fillLayout->setSpacing(0);
|
||||||
|
|
||||||
|
m_leftToolBar->setFloatable(true);
|
||||||
|
m_leftToolBar->setMovable(true);
|
||||||
|
m_leftToolBar->setOrientation(Qt::Horizontal);
|
||||||
|
m_leftToolBar->setIconSize(QSize(24, 24));
|
||||||
|
|
||||||
|
QToolBar *stretchToolbar = new QToolBar(this);
|
||||||
|
stretchToolbar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
|
m_rightToolBar->setOrientation(Qt::Horizontal);
|
||||||
|
m_rightToolBar->setIconSize(QSize(24, 24));
|
||||||
|
fillLayout->addWidget(m_leftToolBar);
|
||||||
|
fillLayout->addWidget(stretchToolbar);
|
||||||
|
fillLayout->addWidget(m_rightToolBar);
|
||||||
|
|
||||||
setLayout(fillLayout);
|
setLayout(fillLayout);
|
||||||
//setContentsMargins(4, 12, 4, 4);
|
|
||||||
|
|
||||||
m_toolBar->setFloatable(true);
|
|
||||||
m_toolBar->setMovable(true);
|
|
||||||
m_toolBar->setOrientation(Qt::Horizontal);
|
|
||||||
m_toolBar->setIconSize(QSize(24, 24));
|
|
||||||
fillLayout->addWidget(m_toolBar);
|
|
||||||
|
|
||||||
|
|
||||||
// QPalette toolPalette(palette());
|
|
||||||
// QColor newColor(palette().color(QPalette::Window));
|
|
||||||
// newColor.setAlphaF(0.7);
|
|
||||||
// toolPalette.setColor(QPalette::Window, newColor);
|
|
||||||
// setPalette(toolPalette);
|
|
||||||
// setBackgroundRole(QPalette::Window);
|
|
||||||
// setAutoFillBackground(true);
|
|
||||||
// setAttribute(Qt::WA_NoSystemBackground, true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolBox::setLeftSideActions(const QList<QAction*> &actions)
|
||||||
|
|
||||||
void ToolBox::setActions(const QList<QAction*> &actions)
|
|
||||||
{
|
{
|
||||||
m_toolBar->clear();
|
m_leftToolBar->clear();
|
||||||
m_toolBar->addActions(actions);
|
m_leftToolBar->addActions(actions);
|
||||||
resize(sizeHint());
|
resize(sizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBox::addAction(QAction *action)
|
void ToolBox::setRightSideActions(const QList<QAction*> &actions)
|
||||||
{
|
{
|
||||||
m_toolBar->addAction(action);
|
m_rightToolBar->clear();
|
||||||
|
m_rightToolBar->addActions(actions);
|
||||||
|
resize(sizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolBox::addLeftSideAction(QAction *action)
|
||||||
|
{
|
||||||
|
m_leftToolBar->addAction(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToolBox::addRightSideAction(QAction *action)
|
||||||
|
{
|
||||||
|
m_rightToolBar->addAction(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<QAction*> ToolBox::actions() const
|
QList<QAction*> ToolBox::actions() const
|
||||||
{
|
{
|
||||||
return m_toolBar->actions();
|
return QList<QAction*>() << m_leftToolBar->actions() << m_rightToolBar->actions();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#ifndef TOOLBOX_H
|
#ifndef TOOLBOX_H
|
||||||
#define TOOLBOX_H
|
#define TOOLBOX_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include "utils/styledbar.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
@@ -38,16 +38,19 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class ToolBox : public QWidget
|
class ToolBox : public Utils::StyledBar
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ToolBox(QWidget *parentWidget);
|
ToolBox(QWidget *parentWidget);
|
||||||
void setActions(const QList<QAction*> &actions);
|
void setLeftSideActions(const QList<QAction*> &actions);
|
||||||
void addAction(QAction *action);
|
void setRightSideActions(const QList<QAction*> &actions);
|
||||||
|
void addLeftSideAction(QAction *action);
|
||||||
|
void addRightSideAction(QAction *action);
|
||||||
QList<QAction*> actions() const;
|
QList<QAction*> actions() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QToolBar *m_toolBar;
|
QToolBar *m_leftToolBar;
|
||||||
|
QToolBar *m_rightToolBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ void DesignDocumentController::loadCurrentModel()
|
|||||||
m_d->componentAction = new ComponentAction(m_d->formEditorView->widget());
|
m_d->componentAction = new ComponentAction(m_d->formEditorView->widget());
|
||||||
m_d->componentAction->setModel(m_d->model.data());
|
m_d->componentAction->setModel(m_d->model.data());
|
||||||
connect(m_d->componentAction.data(), SIGNAL(currentComponentChanged(ModelNode)), SLOT(changeCurrentModelTo(ModelNode)));
|
connect(m_d->componentAction.data(), SIGNAL(currentComponentChanged(ModelNode)), SLOT(changeCurrentModelTo(ModelNode)));
|
||||||
m_d->formEditorView->widget()->lowerToolBox()->addAction(m_d->componentAction.data());
|
m_d->formEditorView->widget()->toolBox()->addAction(m_d->componentAction.data());
|
||||||
}
|
}
|
||||||
// Disable switching between in file components for the time being
|
// Disable switching between in file components for the time being
|
||||||
m_d->componentAction->setVisible(false);
|
m_d->componentAction->setVisible(false);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
QString fileName() const
|
QString fileName() const
|
||||||
{ return m_fileName.toString(); }
|
{ return m_fileName.toString(); }
|
||||||
|
|
||||||
void setText(const QString &text)
|
void setText(const QString &/*text*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,27 +35,22 @@
|
|||||||
using namespace QmlDesigner;
|
using namespace QmlDesigner;
|
||||||
|
|
||||||
static const char *snapToGridKey = "SnapToGrid";
|
static const char *snapToGridKey = "SnapToGrid";
|
||||||
static const char *showBoundingRectanglesKey = "ShowBoundingRectangles";
|
|
||||||
static const char *onlyShowItemsWithContentsKey = "OnlyShowItemsWithContents";
|
|
||||||
|
|
||||||
DesignerSettings::DesignerSettings()
|
DesignerSettings::DesignerSettings()
|
||||||
: snapToGrid(false)
|
: openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)
|
||||||
, showBoundingRectangles(false)
|
|
||||||
, onlyShowItemsWithContents(false)
|
|
||||||
, openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)
|
|
||||||
{}
|
{}
|
||||||
void DesignerSettings::fromSettings(QSettings *settings)
|
void DesignerSettings::fromSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
|
||||||
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
||||||
snapToGrid = settings->value(QLatin1String(snapToGridKey), false).toBool();
|
|
||||||
showBoundingRectangles = settings->value(
|
|
||||||
QLatin1String(showBoundingRectanglesKey), false).toBool();
|
|
||||||
onlyShowItemsWithContents = settings->value(
|
|
||||||
QLatin1String(onlyShowItemsWithContentsKey), false).toBool();
|
|
||||||
openDesignMode = settings->value(
|
openDesignMode = settings->value(
|
||||||
QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY),
|
QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY),
|
||||||
bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool();
|
bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool();
|
||||||
|
itemSpacing = settings->value(
|
||||||
|
QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(0)).toInt();
|
||||||
|
snapMargin = settings->value(
|
||||||
|
QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), QVariant(0)).toInt();
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
@@ -64,20 +59,18 @@ void DesignerSettings::toSettings(QSettings *settings) const
|
|||||||
{
|
{
|
||||||
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
|
||||||
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
||||||
settings->setValue(QLatin1String(snapToGridKey), snapToGrid);
|
|
||||||
settings->setValue(QLatin1String(showBoundingRectanglesKey),
|
|
||||||
showBoundingRectangles);
|
|
||||||
settings->setValue(QLatin1String(onlyShowItemsWithContentsKey),
|
|
||||||
onlyShowItemsWithContents);
|
|
||||||
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_SNAPMARGIN_KEY), snapMargin);
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesignerSettings::equals(const DesignerSettings &other) const
|
bool DesignerSettings::equals(const DesignerSettings &other) const
|
||||||
{
|
{
|
||||||
return snapToGrid == other.snapToGrid
|
return openDesignMode == other.openDesignMode
|
||||||
&& showBoundingRectangles == other.showBoundingRectangles
|
&& snapMargin == other.snapMargin
|
||||||
&& onlyShowItemsWithContents == other.onlyShowItemsWithContents
|
&& itemSpacing == other.itemSpacing;
|
||||||
&& openDesignMode == other.openDesignMode;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,11 +47,9 @@ public:
|
|||||||
void toSettings(QSettings *) const;
|
void toSettings(QSettings *) const;
|
||||||
|
|
||||||
bool equals(const DesignerSettings &other) const;
|
bool equals(const DesignerSettings &other) const;
|
||||||
|
|
||||||
bool snapToGrid;
|
|
||||||
bool showBoundingRectangles;
|
|
||||||
bool onlyShowItemsWithContents;
|
|
||||||
bool openDesignMode;
|
bool openDesignMode;
|
||||||
|
int itemSpacing;
|
||||||
|
int snapMargin;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
|
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ const char * const FORM_MIMETYPE = "application/x-qmldesigner";
|
|||||||
const char * const QML_SETTINGS_GROUP = "QML";
|
const char * const QML_SETTINGS_GROUP = "QML";
|
||||||
const char * const QML_DESIGNER_SETTINGS_GROUP = "Designer";
|
const char * const QML_DESIGNER_SETTINGS_GROUP = "Designer";
|
||||||
const char * const QML_OPENDESIGNMODE_SETTINGS_KEY = "OpenDesignMode";
|
const char * const QML_OPENDESIGNMODE_SETTINGS_KEY = "OpenDesignMode";
|
||||||
|
const char * const QML_ITEMSPACING_KEY = "ItemSpacing";
|
||||||
|
const char * const QML_SNAPMARGIN_KEY = "SnapMargin";
|
||||||
enum { QML_OPENDESIGNMODE_DEFAULT = 1 };
|
enum { QML_OPENDESIGNMODE_DEFAULT = 1 };
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -49,29 +49,25 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
|||||||
DesignerSettings SettingsPageWidget::settings() const
|
DesignerSettings SettingsPageWidget::settings() const
|
||||||
{
|
{
|
||||||
DesignerSettings ds;
|
DesignerSettings ds;
|
||||||
ds.snapToGrid = m_ui.snapToGridCheckbox->isChecked();
|
|
||||||
ds.showBoundingRectangles = m_ui.showBoundingRectanglesCheckbox->isChecked();
|
|
||||||
ds.onlyShowItemsWithContents =
|
|
||||||
m_ui.onlyShowItemsWithContentsCheckBox->isChecked();
|
|
||||||
ds.openDesignMode = m_ui.editorModeComboBox->currentIndex() == EditModeDesign;
|
ds.openDesignMode = m_ui.editorModeComboBox->currentIndex() == EditModeDesign;
|
||||||
|
ds.itemSpacing = m_ui.spinItemSpacing->value();
|
||||||
|
ds.snapMargin = m_ui.spinSnapMargin->value();
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPageWidget::setSettings(const DesignerSettings &s)
|
void SettingsPageWidget::setSettings(const DesignerSettings &s)
|
||||||
{
|
{
|
||||||
m_ui.snapToGridCheckbox->setChecked(s.snapToGrid);
|
|
||||||
m_ui.showBoundingRectanglesCheckbox->setChecked(s.showBoundingRectangles);
|
|
||||||
m_ui.onlyShowItemsWithContentsCheckBox->setChecked(s.onlyShowItemsWithContents);
|
|
||||||
m_ui.editorModeComboBox->setCurrentIndex(s.openDesignMode ? EditModeDesign : EditModeEdit);
|
m_ui.editorModeComboBox->setCurrentIndex(s.openDesignMode ? EditModeDesign : EditModeEdit);
|
||||||
|
m_ui.spinItemSpacing->setValue(s.itemSpacing);
|
||||||
|
m_ui.spinSnapMargin->setValue(s.snapMargin);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPageWidget::searchKeywords() const
|
QString SettingsPageWidget::searchKeywords() const
|
||||||
{
|
{
|
||||||
QString rc;
|
QString rc;
|
||||||
QTextStream(&rc)
|
QTextStream(&rc)
|
||||||
<< m_ui.snapToGridCheckbox->text()
|
<< ' ' << m_ui.snapMarginLabel
|
||||||
<< ' ' << m_ui.showBoundingRectanglesCheckbox->text()
|
<< ' ' << m_ui.itemSpacingLabel;
|
||||||
<< ' ' << m_ui.onlyShowItemsWithContentsCheckBox->text();
|
|
||||||
rc.remove(QLatin1Char('&'));
|
rc.remove(QLatin1Char('&'));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,36 +6,142 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>494</width>
|
<width>433</width>
|
||||||
<height>467</height>
|
<height>428</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0" rowspan="2" colspan="3">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="snapToGridCheckbox">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>&Snap to guides</string>
|
<string>Files</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="showBoundingRectanglesCheckbox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show &bounding rectangles</string>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="editorModeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open file in:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="editorModeComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Design mode</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit mode</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="onlyShowItemsWithContentsCheckBox">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Only select items with content</string>
|
<string>Snapping</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
|
<property name="margin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="itemSpacingLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Item spacing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinItemSpacing">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="snapMarginLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Snap margin</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QSpinBox" name="spinSnapMargin">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="4" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -48,45 +154,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="editorModeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Open file in:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="editorModeComboBox">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Design mode</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Edit mode</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
|
||||||
<tabstop>snapToGridCheckbox</tabstop>
|
|
||||||
<tabstop>showBoundingRectanglesCheckbox</tabstop>
|
|
||||||
<tabstop>onlyShowItemsWithContentsCheckBox</tabstop>
|
|
||||||
<tabstop>editorModeComboBox</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user