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
4#ifndef FORMWINDOWMANAGER_H
5#define FORMWINDOWMANAGER_H
6
8
9#include <QtDesigner/private/qdesigner_formwindowmanager_p.h>
10
11#include <QtCore/qobject.h>
12#include <QtCore/qlist.h>
13#include <QtCore/qpointer.h>
14#include <QtCore/qmap.h>
15#include <QtCore/qset.h>
16
18
19class QAction;
20class QActionGroup;
21class QUndoGroup;
22class QDesignerFormEditorInterface;
23class QDesignerWidgetBoxInterface;
24
25namespace qdesigner_internal {
26
27class FormWindow;
28class PreviewManager;
30
33{
35public:
38
39 QDesignerFormEditorInterface *core() const override;
40
41 QAction *action(Action action) const override;
42 QActionGroup *actionGroup(ActionGroup actionGroup) const override;
43
44 QDesignerFormWindowInterface *activeFormWindow() const override;
45
46 int formWindowCount() const override;
47 QDesignerFormWindowInterface *formWindow(int index) const override;
48
49 QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = nullptr, Qt::WindowFlags flags = {}) override;
50
51 QPixmap createPreviewPixmap() const override;
52
53 bool eventFilter(QObject *o, QEvent *e) override;
54
55 void dragItems(const QList<QDesignerDnDItemInterface*> &item_list) override;
56
57 QUndoGroup *undoGroup() const;
58
59 PreviewManager *previewManager() const override { return m_previewManager; }
60
61public slots:
63 void removeFormWindow(QDesignerFormWindowInterface *formWindow) override;
64 void setActiveFormWindow(QDesignerFormWindowInterface *formWindow) override;
67
68private slots:
69#if QT_CONFIG(clipboard)
73#endif
75 void slotActionSelectAllActivated();
76 void slotActionLowerActivated();
77 void slotActionRaiseActivated();
78 void createLayout();
79 void slotActionBreakLayoutActivated();
80 void slotActionAdjustSizeActivated();
81 void slotActionSimplifyLayoutActivated();
82 void showPreview() override;
83 void slotActionGroupPreviewInStyle(const QString &style, int deviceProfileIndex);
84 void slotActionShowFormWindowSettingsDialog();
85
86 void slotUpdateActions();
87
88private:
89 void setupActions();
90 FormWindow *findFormWindow(QWidget *w);
91 QWidget *findManagedWidget(FormWindow *fw, QWidget *w);
92
93 void setCurrentUndoStack(QUndoStack *stack);
94
95private:
96 enum CreateLayoutContext { LayoutContainer, LayoutSelection, MorphLayout };
97
98 QDesignerFormEditorInterface *m_core;
99 FormWindow *m_activeFormWindow;
100 QList<FormWindow*> m_formWindows;
101
102 PreviewManager *m_previewManager;
103
104 /* Context of the layout actions and base for morphing layouts. Determined
105 * in slotUpdateActions() and used later on in the action slots. */
106 CreateLayoutContext m_createLayoutContext;
107 QWidget *m_morphLayoutContainer;
108
109 // edit actions
110#if QT_CONFIG(clipboard)
111 QAction *m_actionCut = nullptr;
112 QAction *m_actionCopy = nullptr;
113 QAction *m_actionPaste = nullptr;
114#endif
115 QAction *m_actionSelectAll = nullptr;
116 QAction *m_actionDelete = nullptr;
117 QAction *m_actionLower = nullptr;
118 QAction *m_actionRaise = nullptr;
119 // layout actions
120 QAction *m_actionHorizontalLayout = nullptr;
121 QAction *m_actionVerticalLayout = nullptr;
122 QAction *m_actionFormLayout = nullptr;
123 QAction *m_actionSplitHorizontal = nullptr;
124 QAction *m_actionSplitVertical = nullptr;
125 QAction *m_actionGridLayout = nullptr;
126 QAction *m_actionBreakLayout = nullptr;
127 QAction *m_actionSimplifyLayout = nullptr;
128 QAction *m_actionAdjustSize = nullptr;
129 // preview actions
130 QAction *m_actionDefaultPreview = nullptr;
131 mutable PreviewActionGroup *m_actionGroupPreviewInStyle = nullptr;
132 QAction *m_actionShowFormWindowSettingsDialog = nullptr;
133
134 QAction *m_actionUndo = nullptr;
135 QAction *m_actionRedo = nullptr;
136
137 QSet<QWidget *> getUnsortedLayoutsToBeBroken(bool firstOnly) const;
138 bool hasLayoutsToBeBroken() const;
139 QWidgetList layoutsToBeBroken(QWidget *w) const;
140 QWidgetList layoutsToBeBroken() const;
141
142 QUndoGroup *m_undoGroup = nullptr;
143
144};
145
146} // namespace qdesigner_internal
147
148QT_END_NAMESPACE
149
150#endif // FORMWINDOWMANAGER_H
friend class QWidget
Definition qpainter.h:421
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)
#define QDESIGNER_SHARED_EXPORT