Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
formwindowmanager.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5#ifndef FORMWINDOWMANAGER_H
6#define FORMWINDOWMANAGER_H
7
9
10#include <QtDesigner/private/qdesigner_formwindowmanager_p.h>
11
12#include <QtCore/qobject.h>
13#include <QtCore/qlist.h>
14#include <QtCore/qpointer.h>
15#include <QtCore/qmap.h>
16#include <QtCore/qset.h>
17
19
20class QAction;
21class QActionGroup;
22class QUndoGroup;
23class QDesignerFormEditorInterface;
24class QDesignerWidgetBoxInterface;
25
26namespace qdesigner_internal {
27
28class FormWindow;
29class PreviewManager;
31
34{
36public:
39
40 QDesignerFormEditorInterface *core() const override;
41
42 QAction *action(Action action) const override;
43 QActionGroup *actionGroup(ActionGroup actionGroup) const override;
44
45 QDesignerFormWindowInterface *activeFormWindow() const override;
46
47 int formWindowCount() const override;
48 QDesignerFormWindowInterface *formWindow(int index) const override;
49
50 QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = nullptr, Qt::WindowFlags flags = {}) override;
51
52 QPixmap createPreviewPixmap() const override;
53
54 bool eventFilter(QObject *o, QEvent *e) override;
55
56 void dragItems(const QList<QDesignerDnDItemInterface*> &item_list) override;
57
58 QUndoGroup *undoGroup() const;
59
60 PreviewManager *previewManager() const override { return m_previewManager; }
61
62public slots:
64 void removeFormWindow(QDesignerFormWindowInterface *formWindow) override;
65 void setActiveFormWindow(QDesignerFormWindowInterface *formWindow) override;
68
69private slots:
70#if QT_CONFIG(clipboard)
74#endif
76 void slotActionSelectAllActivated();
77 void slotActionLowerActivated();
78 void slotActionRaiseActivated();
79 void createLayout();
80 void slotActionBreakLayoutActivated();
81 void slotActionAdjustSizeActivated();
82 void slotActionSimplifyLayoutActivated();
83 void showPreview() override;
84 void slotActionGroupPreviewInStyle(const QString &style, int deviceProfileIndex);
85 void slotActionShowFormWindowSettingsDialog();
86
87 void slotUpdateActions();
88
89private:
90 void setupActions();
91 FormWindow *findFormWindow(QWidget *w);
92 QWidget *findManagedWidget(FormWindow *fw, QWidget *w);
93
94 void setCurrentUndoStack(QUndoStack *stack);
95
96private:
97 enum CreateLayoutContext { LayoutContainer, LayoutSelection, MorphLayout };
98
99 QDesignerFormEditorInterface *m_core;
100 FormWindow *m_activeFormWindow;
101 QList<FormWindow*> m_formWindows;
102
103 PreviewManager *m_previewManager;
104
105 /* Context of the layout actions and base for morphing layouts. Determined
106 * in slotUpdateActions() and used later on in the action slots. */
107 CreateLayoutContext m_createLayoutContext;
108 QWidget *m_morphLayoutContainer;
109
110 // edit actions
111#if QT_CONFIG(clipboard)
112 QAction *m_actionCut = nullptr;
113 QAction *m_actionCopy = nullptr;
114 QAction *m_actionPaste = nullptr;
115#endif
116 QAction *m_actionSelectAll = nullptr;
117 QAction *m_actionDelete = nullptr;
118 QAction *m_actionLower = nullptr;
119 QAction *m_actionRaise = nullptr;
120 // layout actions
121 QAction *m_actionHorizontalLayout = nullptr;
122 QAction *m_actionVerticalLayout = nullptr;
123 QAction *m_actionFormLayout = nullptr;
124 QAction *m_actionSplitHorizontal = nullptr;
125 QAction *m_actionSplitVertical = nullptr;
126 QAction *m_actionGridLayout = nullptr;
127 QAction *m_actionBreakLayout = nullptr;
128 QAction *m_actionSimplifyLayout = nullptr;
129 QAction *m_actionAdjustSize = nullptr;
130 // preview actions
131 QAction *m_actionDefaultPreview = nullptr;
132 mutable PreviewActionGroup *m_actionGroupPreviewInStyle = nullptr;
133 QAction *m_actionShowFormWindowSettingsDialog = nullptr;
134
135 QAction *m_actionUndo = nullptr;
136 QAction *m_actionRedo = nullptr;
137
138 QSet<QWidget *> getUnsortedLayoutsToBeBroken(bool firstOnly) const;
139 bool hasLayoutsToBeBroken() const;
140 QWidgetList layoutsToBeBroken(QWidget *w) const;
141 QWidgetList layoutsToBeBroken() const;
142
143 QUndoGroup *m_undoGroup = nullptr;
144
145};
146
147} // namespace qdesigner_internal
148
149QT_END_NAMESPACE
150
151#endif // FORMWINDOWMANAGER_H
friend class QWidget
Definition qpainter.h:432
QWidget * createPage(QWidget *parent) override
PreviewManager * previewManager() const override
Accesses the previewmanager implementation.
void removeFormWindow(QDesignerFormWindowInterface *formWindow) override
int formWindowCount() const override
Returns the number of form windows maintained by \QD's form window manager.
QPixmap createPreviewPixmap() const override
Creates a pixmap representing the preview of the currently active form.
QActionGroup * actionGroup(ActionGroup actionGroup) const override
Returns the action group specified by the enumeration value actionGroup.
bool eventFilter(QObject *o, QEvent *e) override
Filters events if this object has been installed as an event filter for the watched object.
QDesignerFormWindowInterface * formWindow(int index) const override
Returns the form window at the given index.
QDesignerFormWindowInterface * activeFormWindow() const override
Returns the currently active form window in \QD's workspace.
QDesignerFormWindowInterface * createFormWindow(QWidget *parentWidget=nullptr, Qt::WindowFlags flags={}) override
Creates a form window with the given parent and the given window flags.
void dragItems(const QList< QDesignerDnDItemInterface * > &item_list) override
void setActiveFormWindow(QDesignerFormWindowInterface *formWindow) override
QDesignerFormEditorInterface * core() const override
Returns a pointer to \QD's current QDesignerFormEditorInterface object.
QAction * action(Action action) const override
Returns the action specified by the enumeration value action.
#define QT_FORMEDITOR_EXPORT
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
bool deviceProfileLessThan(const DeviceProfile &d1, const DeviceProfile &d2)
static bool ask(QWidget *parent, QDesignerDialogGuiInterface *dlgui, const QString &title, const QString &what)
static QString description(const DeviceProfile &p)
#define QDESIGNER_SHARED_EXPORT