summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-09-14 18:34:28 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-09-16 17:08:44 +0000
commit5cd1c07e5d88c3c8521c1af45d47b519d6e1faba (patch)
tree3e10d812b62e4a35934bb5f9b3931be04e07c443
parent0833db3f366eb59f08d4497dc424dd46b08da7ae (diff)
Designer: Fix a crash on startup when built without clipboard
Change-Id: I4559c14316d63325554466c710ef0d8017e5876f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit b5da5f522616f99b000ed1c64a5cc1de0c3f8937) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp6
-rw-r--r--src/designer/src/designer/qdesigner_actions.cpp2
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowmanager.cpp6
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowmanager.h10
4 files changed, 20 insertions, 4 deletions
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp
index da856c212..ac7ef775e 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -1786,6 +1786,7 @@ static inline QString pasteCommandDescription(int widgetCount, int actionCount)
return FormWindow::tr("Paste (%1 widgets, %2 actions)").arg(widgetCount).arg(actionCount);
}
+#if QT_CONFIG(clipboard)
static void positionPastedWidgetsAtMousePosition(FormWindow *fw, const QPoint &contextMenuPosition, QWidget *parent, const QWidgetList &l)
{
// Try to position pasted widgets at mouse position (current mouse position for Ctrl-V or position of context menu)
@@ -1818,7 +1819,6 @@ static void positionPastedWidgetsAtMousePosition(FormWindow *fw, const QPoint &c
(*it)->move((*it)->pos() + offset);
}
-#if QT_CONFIG(clipboard)
void FormWindow::paste(PasteMode pasteMode)
{
// Avoid QDesignerResource constructing widgets that are not used as
@@ -2303,11 +2303,15 @@ QMenu *FormWindow::createPopupMenu(QWidget *w)
popup->addAction(manager->action(QDesignerFormWindowManagerInterface::RaiseAction));
popup->addSeparator();
}
+#if QT_CONFIG(clipboard)
popup->addAction(manager->action(QDesignerFormWindowManagerInterface::CutAction));
popup->addAction(manager->action(QDesignerFormWindowManagerInterface::CopyAction));
+#endif
}
+#if QT_CONFIG(clipboard)
popup->addAction(manager->action(QDesignerFormWindowManagerInterface::PasteAction));
+#endif
if (QAction *selectAncestorAction = createSelectAncestorSubMenu(w))
popup->addAction(selectAncestorAction);
diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp
index 0c5d5a94c..7b86200f0 100644
--- a/src/designer/src/designer/qdesigner_actions.cpp
+++ b/src/designer/src/designer/qdesigner_actions.cpp
@@ -295,9 +295,11 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_editActions->addAction(createSeparator(this));
+#if QT_CONFIG(clipboard)
m_editActions->addAction(formWindowManager->action(QDesignerFormWindowManagerInterface::CutAction));
m_editActions->addAction(formWindowManager->action(QDesignerFormWindowManagerInterface::CopyAction));
m_editActions->addAction(formWindowManager->action(QDesignerFormWindowManagerInterface::PasteAction));
+#endif
m_editActions->addAction(formWindowManager->action(QDesignerFormWindowManagerInterface::DeleteAction));
m_editActions->addAction(formWindowManager->action(QDesignerFormWindowManagerInterface::SelectAllAction));
diff --git a/src/designer/src/lib/sdk/abstractformwindowmanager.cpp b/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
index 387f0665c..b94e04672 100644
--- a/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
@@ -147,10 +147,12 @@ QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface() = de
Use action() instead.
*/
+#if QT_CONFIG(clipboard)
QAction *QDesignerFormWindowManagerInterface::actionCut() const
{
return action(CutAction);
}
+#endif
/*!
Allows you to intervene and control \QD's "copy" action. The
@@ -161,10 +163,12 @@ QAction *QDesignerFormWindowManagerInterface::actionCut() const
Use action() instead.
*/
+#if QT_CONFIG(clipboard)
QAction *QDesignerFormWindowManagerInterface::actionCopy() const
{
return action(CopyAction);
}
+#endif
/*!
Allows you to intervene and control \QD's "paste" action. The
@@ -175,10 +179,12 @@ QAction *QDesignerFormWindowManagerInterface::actionCopy() const
Use action() instead.
*/
+#if QT_CONFIG(clipboard)
QAction *QDesignerFormWindowManagerInterface::actionPaste() const
{
return action(PasteAction);
}
+#endif
/*!
Allows you to intervene and control \QD's "delete" action. The function
diff --git a/src/designer/src/lib/sdk/abstractformwindowmanager.h b/src/designer/src/lib/sdk/abstractformwindowmanager.h
index 4f826660f..6a330a7de 100644
--- a/src/designer/src/lib/sdk/abstractformwindowmanager.h
+++ b/src/designer/src/lib/sdk/abstractformwindowmanager.h
@@ -54,16 +54,18 @@ public:
enum Action
{
+#if QT_CONFIG(clipboard)
CutAction = 100,
CopyAction,
PasteAction,
- DeleteAction,
+#endif
+ DeleteAction = 103,
SelectAllAction,
LowerAction = 200,
RaiseAction,
- UndoAction = 300,
+ UndoAction = 300,
RedoAction,
HorizontalLayoutAction = 400,
@@ -78,7 +80,7 @@ public:
DefaultPreviewAction = 500,
- FormWindowSettingsDialogAction = 600
+ FormWindowSettingsDialogAction = 600
};
enum ActionGroup
@@ -89,9 +91,11 @@ public:
virtual QAction *action(Action action) const = 0;
virtual QActionGroup *actionGroup(ActionGroup actionGroup) const = 0;
+#if QT_CONFIG(clipboard)
QAction *actionCut() const;
QAction *actionCopy() const;
QAction *actionPaste() const;
+#endif
QAction *actionDelete() const;
QAction *actionSelectAll() const;
QAction *actionLower() const;