summaryrefslogtreecommitdiffstats
path: root/tools/designer/src/components/formeditor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/designer/src/components/formeditor')
-rw-r--r--tools/designer/src/components/formeditor/default_actionprovider.cpp15
-rw-r--r--tools/designer/src/components/formeditor/default_actionprovider.h4
-rw-r--r--tools/designer/src/components/formeditor/formwindowmanager.cpp22
3 files changed, 28 insertions, 13 deletions
diff --git a/tools/designer/src/components/formeditor/default_actionprovider.cpp b/tools/designer/src/components/formeditor/default_actionprovider.cpp
index 42d1f81cd..41333f8e8 100644
--- a/tools/designer/src/components/formeditor/default_actionprovider.cpp
+++ b/tools/designer/src/components/formeditor/default_actionprovider.cpp
@@ -73,9 +73,8 @@ enum { indicatorSize = 2 };
// Position an indicator horizontally over the rectangle, indicating
// 'Insert before' (left or right according to layout direction)
-static inline QRect horizontalIndicatorRect(const QRect &rect)
+static inline QRect horizontalIndicatorRect(const QRect &rect, Qt::LayoutDirection layoutDirection)
{
- const Qt::LayoutDirection layoutDirection = QApplication::layoutDirection();
// Position right?
QRect rc = QRect(rect.x(), 0, indicatorSize, rect.height() - 1);
if (layoutDirection == Qt::RightToLeft)
@@ -91,13 +90,13 @@ static inline QRect verticalIndicatorRect(const QRect &rect)
// Determine the geometry of the indicator by retrieving
// the action under mouse and positioning the bar within its geometry.
-QRect ActionProviderBase::indicatorGeometry(const QPoint &pos) const
+QRect ActionProviderBase::indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const
{
QAction *action = actionAt(pos);
if (!action)
return QRect();
QRect rc = actionGeometry(action);
- return orientation() == Qt::Horizontal ? horizontalIndicatorRect(rc) : verticalIndicatorRect(rc);
+ return orientation() == Qt::Horizontal ? horizontalIndicatorRect(rc, layoutDirection) : verticalIndicatorRect(rc);
}
// Adjust the indicator while dragging. (-1,1) is called to finish a DND operation
@@ -107,7 +106,7 @@ void ActionProviderBase::adjustIndicator(const QPoint &pos)
m_indicator->hide();
return;
}
- const QRect ig = indicatorGeometry(pos);
+ const QRect ig = indicatorGeometry(pos, m_indicator->layoutDirection());
if (ig.isValid()) {
m_indicator->setGeometry(ig);
QPalette p = m_indicator->palette();
@@ -145,9 +144,9 @@ Qt::Orientation QToolBarActionProvider::orientation() const
return m_widget->orientation();
}
-QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos) const
+QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const
{
- const QRect actionRect = ActionProviderBase::indicatorGeometry(pos);
+ const QRect actionRect = ActionProviderBase::indicatorGeometry(pos, layoutDirection);
if (actionRect.isValid())
return actionRect;
// Toolbar differs in that is has no dummy placeholder to 'insert before'
@@ -155,7 +154,7 @@ QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos) const
const QRect freeArea = ToolBarEventFilter::freeArea(m_widget);
if (!freeArea.contains(pos))
return QRect();
- return orientation() == Qt::Horizontal ? horizontalIndicatorRect(freeArea) : verticalIndicatorRect(freeArea);
+ return orientation() == Qt::Horizontal ? horizontalIndicatorRect(freeArea, layoutDirection) : verticalIndicatorRect(freeArea);
}
// ------------- QMenuBarActionProvider
diff --git a/tools/designer/src/components/formeditor/default_actionprovider.h b/tools/designer/src/components/formeditor/default_actionprovider.h
index 3660f1107..270ea3601 100644
--- a/tools/designer/src/components/formeditor/default_actionprovider.h
+++ b/tools/designer/src/components/formeditor/default_actionprovider.h
@@ -66,7 +66,7 @@ public:
virtual Qt::Orientation orientation() const = 0;
protected:
- virtual QRect indicatorGeometry(const QPoint &pos) const;
+ virtual QRect indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const;
private:
QWidget *m_indicator;
@@ -84,7 +84,7 @@ public:
Qt::Orientation orientation() const;
protected:
- virtual QRect indicatorGeometry(const QPoint &pos) const;
+ virtual QRect indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const;
private:
QToolBar *m_widget;
diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp
index 993bae905..a2a0a4053 100644
--- a/tools/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp
@@ -443,7 +443,8 @@ void FormWindowManager::setupActions()
m_actionVerticalLayout->setEnabled(false);
connect(m_actionVerticalLayout, SIGNAL(triggered()), this, SLOT(createLayout()));
- QAction *actionFormLayout = new QAction(createIconSet(QLatin1String("editform.png")), tr("Lay Out in a &Form Layout"), this);
+ QIcon formIcon = QIcon::fromTheme("designer-form-layout", createIconSet(QLatin1String("editform.png")));
+ QAction *actionFormLayout = new QAction(formIcon, tr("Lay Out in a &Form Layout"), this);
actionFormLayout->setObjectName(QLatin1String("__qt_form_layout_action"));
actionFormLayout->setShortcut(Qt::CTRL + Qt::Key_6);
actionFormLayout->setStatusTip(tr("Lays out the selected widgets in a form layout"));
@@ -510,15 +511,30 @@ void FormWindowManager::setupActions()
m_actionUndo = m_undoGroup->createUndoAction(this);
m_actionUndo->setEnabled(false);
- m_actionUndo->setIcon(createIconSet(QLatin1String("undo.png")));
+
+ m_actionUndo->setIcon(QIcon::fromTheme("edit-undo", createIconSet(QLatin1String("undo.png"))));
m_actionRedo = m_undoGroup->createRedoAction(this);
m_actionRedo->setEnabled(false);
- m_actionRedo->setIcon(createIconSet(QLatin1String("redo.png")));
+ m_actionRedo->setIcon(QIcon::fromTheme("edit-redo", createIconSet(QLatin1String("redo.png"))));
m_actionShowFormWindowSettingsDialog = new QAction(tr("Form &Settings..."), this);
m_actionShowFormWindowSettingsDialog->setObjectName(QLatin1String("__qt_form_settings_action"));
connect(m_actionShowFormWindowSettingsDialog, SIGNAL(triggered()), this, SLOT(slotActionShowFormWindowSettingsDialog()));
m_actionShowFormWindowSettingsDialog->setEnabled(false);
+
+
+ m_actionCopy->setIcon(QIcon::fromTheme("edit-copy", m_actionCopy->icon()));
+ m_actionCut->setIcon(QIcon::fromTheme("edit-cut", m_actionCut->icon()));
+ m_actionPaste->setIcon(QIcon::fromTheme("edit-paste", m_actionPaste->icon()));
+
+ // These do not currently exist, but will allow theme authors to fill in the gaps
+ m_actionBreakLayout->setIcon(QIcon::fromTheme("designer-break-layout", m_actionBreakLayout->icon()));
+ m_actionGridLayout->setIcon(QIcon::fromTheme("designer-grid-layout", m_actionGridLayout->icon()));
+ m_actionHorizontalLayout->setIcon(QIcon::fromTheme("designer-horizontal-layout", m_actionHorizontalLayout->icon()));
+ m_actionVerticalLayout->setIcon(QIcon::fromTheme("designer-vertical-layout", m_actionVerticalLayout->icon()));
+ m_actionSplitHorizontal->setIcon(QIcon::fromTheme("designer-split-horizontal", m_actionSplitHorizontal->icon()));
+ m_actionSplitVertical->setIcon(QIcon::fromTheme("designer-split-vertical", m_actionSplitVertical->icon()));
+ m_actionAdjustSize->setIcon(QIcon::fromTheme("designer-adjust-size", m_actionAdjustSize->icon()));
}
void FormWindowManager::slotActionCutActivated()