diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-09-14 18:34:28 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-09-15 10:41:05 +0200 |
commit | b5da5f522616f99b000ed1c64a5cc1de0c3f8937 (patch) | |
tree | 8003ce44649d58ebac64479c157355ab047c6cac | |
parent | db8e1b5d926cce2eba2d558eca9535e43ba32957 (diff) |
Designer: Fix a crash on startup when built without clipboard
Pick-to: 5.15
Change-Id: I4559c14316d63325554466c710ef0d8017e5876f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
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 769f219dc..b27b7e18e 100644 --- a/src/designer/src/components/formeditor/formwindow.cpp +++ b/src/designer/src/components/formeditor/formwindow.cpp @@ -1788,6 +1788,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) @@ -1820,7 +1821,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 @@ -2305,11 +2305,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 642fc5e46..4b98d6493 100644 --- a/src/designer/src/designer/qdesigner_actions.cpp +++ b/src/designer/src/designer/qdesigner_actions.cpp @@ -296,9 +296,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 eddba7387..2f93fbde8 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 }; Q_ENUM(Action) @@ -91,9 +93,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; |