15#ifndef QLAYOUT_WIDGET_H
16#define QLAYOUT_WIDGET_H
20#include <QtDesigner/layoutdecoration.h>
22#include <QtCore/qpointer.h>
23#include <QtCore/qvariant.h>
24#include <QtWidgets/qwidget.h>
25#include <QtWidgets/qlayout.h>
29class QDesignerFormWindowInterface;
30class QDesignerFormEditorInterface;
57 static int visibleProperties(
const QLayout *layout);
60 int fromPropertySheet(
const QDesignerFormEditorInterface *core, QLayout *l,
int mask =
AllProperties);
61 int toPropertySheet(
const QDesignerFormEditorInterface *core, QLayout *l,
int mask =
AllProperties,
bool applyChanged =
true)
const;
115 static int indexOf(
const QLayout *lt,
const QWidget *widget);
118 QRect itemInfo(QLayout *lt,
const QWidget *widget)
const;
120 virtual QRect itemInfo(QLayout *lt,
int index)
const = 0;
121 virtual void insertWidget(QLayout *lt,
const QRect &info,
QWidget *w) = 0;
122 virtual void removeWidget(QLayout *lt,
QWidget *widget) = 0;
128 virtual bool canSimplify(
const QDesignerFormEditorInterface *core,
const QWidget *widgetWithManagedLayout,
const QRect &restrictionArea)
const = 0;
129 virtual void simplify(
const QDesignerFormEditorInterface *core,
QWidget *widgetWithManagedLayout,
const QRect &restrictionArea) = 0;
134 virtual void pushState(
const QDesignerFormEditorInterface *core,
const QWidget *widgetWithManagedLayout) = 0;
135 virtual void popState(
const QDesignerFormEditorInterface *core,
QWidget *widgetWithManagedLayout) = 0;
142 Q_INTERFACES(QDesignerLayoutDecorationExtension)
145 QLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent =
nullptr);
148 ~QLayoutSupport() override;
150 inline QDesignerFormWindowInterface *formWindow()
const {
return m_formWindow; }
153 LayoutHelper* helper()
const {
return m_helper; }
156 int currentIndex()
const override {
return m_currentIndex; }
158 InsertMode currentInsertMode()
const override {
return m_currentInsertMode; }
160 std::pair<
int,
int> currentCell()
const override {
return m_currentCell; }
162 int findItemAt(
const QPoint &pos)
const override;
163 int indexOf(QWidget *widget)
const override;
164 int indexOf(QLayoutItem *item)
const override;
166 void adjustIndicator(
const QPoint &pos,
int index) override;
168 QWidgetList widgets(QLayout *layout)
const override;
171 static void createEmptyCells(QGridLayout *gridLayout);
173 static bool removeEmptyCells(QGridLayout *gridLayout,
const QRect &area);
174 static void createEmptyCells(QFormLayout *formLayout);
175 static bool removeEmptyCells(QFormLayout *formLayout,
const QRect &area);
178 static int findItemAt(QGridLayout *,
int row,
int column);
179 using QDesignerLayoutDecorationExtension::findItemAt;
181 static bool canSimplifyQuickCheck(
const QGridLayout *);
182 static bool canSimplifyQuickCheck(
const QFormLayout *fl);
184 static QLayoutSupport *createLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent =
nullptr);
188 virtual void setCurrentCellFromIndicatorOnEmptyCell(
int index) = 0;
190 virtual void setCurrentCellFromIndicator(Qt::Orientation indicatorOrientation,
int index,
int increment) = 0;
194 virtual QRect extendedGeometry(
int index)
const = 0;
195 virtual bool supportsIndicatorOrientation(Qt::Orientation indicatorOrientation)
const = 0;
197 QRect itemInfo(
int index)
const override;
198 QLayout *layout()
const;
199 QGridLayout *gridLayout()
const;
200 QWidget *widget()
const {
return m_widget; }
202 void setInsertMode(InsertMode im);
203 void setCurrentCell(
const std::pair<
int,
int> &cell);
206 enum Indicator { LeftIndicator, TopIndicator, RightIndicator, BottomIndicator, NumIndicators };
208 void hideIndicator(Indicator i);
209 void showIndicator(Indicator i,
const QRect &geometry,
const QPalette &);
211 QDesignerFormWindowInterface *m_formWindow;
212 LayoutHelper* m_helper;
214 QPointer<QWidget> m_widget;
215 QPointer<QWidget> m_indicators[NumIndicators];
217 InsertMode m_currentInsertMode;
218 std::pair<
int,
int> m_currentCell;
227 explicit QLayoutWidget(QDesignerFormWindowInterface *formWindow, QWidget *parent =
nullptr);
229 int layoutLeftMargin()
const;
230 void setLayoutLeftMargin(
int layoutMargin);
232 int layoutTopMargin()
const;
233 void setLayoutTopMargin(
int layoutMargin);
235 int layoutRightMargin()
const;
236 void setLayoutRightMargin(
int layoutMargin);
238 int layoutBottomMargin()
const;
239 void setLayoutBottomMargin(
int layoutMargin);
241 inline QDesignerFormWindowInterface *formWindow()
const {
return m_formWindow; }
244 bool event(QEvent *e) override;
245 void paintEvent(QPaintEvent *e) override;
248 QDesignerFormWindowInterface *m_formWindow;
static bool canBeBuddy(QWidget *w, QDesignerFormWindowInterface *form)
static QString buddy(QLabel *label, QDesignerFormEditorInterface *core)
static constexpr auto buddyPropertyC
#define QT_BUDDYEDITOR_EXPORT
void init(QWidget *parentWidget, QAction *action, QAction *beforeAction=nullptr, bool update=true)
ActionInsertionCommand(const QString &text, QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
AddMenuActionCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
AddStackedWidgetPageCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void init(QStackedWidget *stackedWidget)
void init(QStackedWidget *stackedWidget, InsertionMode mode)
~AddStackedWidgetPageCommand() override
void redo() override
Applies a change to the document.
void undo() override
Reverts a change to the document.
~AddTabPageCommand() override
void init(QTabWidget *tabWidget, InsertionMode mode)
void init(QTabWidget *tabWidget)
AddTabPageCommand(QDesignerFormWindowInterface *formWindow)
AddToolBoxPageCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
void init(QToolBox *toolBox, InsertionMode mode)
~AddToolBoxPageCommand() override
void init(QToolBox *toolBox)
void undo() override
Reverts a change to the document.
void setBackground(QWidget *background) override
QDesignerFormWindowInterface * formWindow() const
void endConnection(QWidget *target, const QPoint &pos) override
void widgetRemoved(QWidget *w) override
QWidget * widgetAt(const QPoint &pos) const override
Connection * createConnection(QWidget *source, QWidget *destination) override
void createContextMenu(QMenu &menu) override
void deleteSelected() override
CreateMenuBarCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
void init(QMainWindow *mainWindow)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
void undo() override
Reverts a change to the document.
void init(QMainWindow *mainWindow)
CreateStatusBarCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void init(QDesignerMenu *menu, QAction *action, QObject *m_objectToSelect=nullptr)
CreateSubmenuCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
void restore(QDesignerFormWindowInterface *formWindow) const
void save(const QDesignerFormWindowInterface *formWindow)
void init(QMenuBar *menuBar)
void redo() override
Applies a change to the document.
void undo() override
Reverts a change to the document.
DeleteMenuBarCommand(QDesignerFormWindowInterface *formWindow)
DeleteStackedWidgetPageCommand(QDesignerFormWindowInterface *formWindow)
void init(QStackedWidget *stackedWidget)
void redo() override
Applies a change to the document.
~DeleteStackedWidgetPageCommand() override
void undo() override
Reverts a change to the document.
void init(QTabWidget *tabWidget)
void redo() override
Applies a change to the document.
~DeleteTabPageCommand() override
void undo() override
Reverts a change to the document.
DeleteTabPageCommand(QDesignerFormWindowInterface *formWindow)
void init(QToolBox *toolBox)
DeleteToolBoxPageCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
void undo() override
Reverts a change to the document.
~DeleteToolBoxPageCommand() override
void undo() override
Reverts a change to the document.
InsertActionIntoCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
static LayoutHelper * createLayoutHelper(int type)
void init(QAction *action, QAction *actionBefore, QWidget *associatedWidget, QWidget *objectToSelect)
MenuActionCommand(const QString &text, QDesignerFormWindowInterface *formWindow)
~MoveTabPageCommand() override
void undo() override
Reverts a change to the document.
MoveTabPageCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
void init(QTabWidget *tabWidget, QWidget *page, const QIcon &icon, const QString &label, int index, int newIndex)
MoveToolBoxPageCommand(QDesignerFormWindowInterface *formWindow)
void redo() override
Applies a change to the document.
void init(QToolBox *toolBox, QWidget *page, int newIndex)
void undo() override
Reverts a change to the document.
~MoveToolBoxPageCommand() override
QDesignerIntegration * integration(QDesignerFormWindowInterface *fw) const
PropertyHelper(QObject *object, SpecialProperty specialProperty, QDesignerPropertySheetExtension *sheet, int index)
static void triggerActionChanged(QAction *a)
SpecialProperty specialProperty() const
void setOldValue(const QVariant &oldValue)
unsigned updateMask() const
QVariant oldValue() const
Value restoreDefaultValue(QDesignerFormWindowInterface *fw)
Value restoreOldValue(QDesignerFormWindowInterface *fw)
bool canMerge(const PropertyHelper &other) const
virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, quint64 subPropertyMask)
RemoveActionFromCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
RemoveMenuActionCommand(QDesignerFormWindowInterface *formWindow)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
Combined button and popup list for selecting options.
int valueOf(const QVariant &value, bool *ok=nullptr)
bool isObjectAncestorOf(QObject *ancestor, QObject *child)
bool isCentralWidget(QDesignerFormWindowInterface *fw, QWidget *widget)
Auxiliary methods to store/retrieve settings.
QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr=nullptr, int *rowspanPtr=nullptr, int *colspanPtr=nullptr)
QDESIGNER_SHARED_EXPORT QDebug operator<<(QDebug, const PropertySheetIconValue &)
static QUndoCommand * createBuddyCommand(QDesignerFormWindowInterface *fw, QLabel *label, QWidget *buddy)
QDESIGNER_SHARED_EXPORT void formLayoutAddWidget(QFormLayout *formLayout, QWidget *w, const QRect &r, bool insert)
QDESIGNER_SHARED_EXPORT void designerWarning(const QString &message)
QDESIGNER_SHARED_EXPORT void reloadIconResources(DesignerIconCache *iconCache, QObject *object)
QDESIGNER_SHARED_EXPORT bool runUIC(const QString &fileName, UicLanguage language, QByteArray &ba, QString &errorMessage)
#define QDESIGNER_SHARED_EXPORT
QVariant m_gridRowStretch
int m_margins[MarginCount]
bool m_formAlignmentChanged
QVariant m_sizeConstraint
bool m_gridRowMinimumHeightChanged
QVariant m_labelAlignment
QVariant m_gridRowMinimumHeight
bool m_marginsChanged[MarginCount]
@ GridRowMinimumHeightProperty
@ GridColumnStretchProperty
@ FieldGrowthPolicyProperty
@ GridColumnMinimumWidthProperty
bool m_fieldGrowthPolicyChanged
bool m_spacingsChanged[SpacingsCount]
bool m_labelAlignmentChanged
bool m_gridColumnStretchChanged
QVariant m_gridColumnMinimumWidth
QVariant m_fieldGrowthPolicy
QVariant m_gridColumnStretch
bool m_sizeConstraintChanged
bool m_rowWrapPolicyChanged
bool m_gridColumnMinimumWidthChanged
bool m_gridRowStretchChanged
int m_spacings[SpacingsCount]