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
spacer_widget_p.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//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of Qt Designer. This header
10// file may change from version to version without notice, or even be removed.
11//
12// We mean it.
13//
14
15
16#ifndef SPACER_WIDGET_H
17#define SPACER_WIDGET_H
18
20
21#include <QtWidgets/qwidget.h>
22#include <QtWidgets/qsizepolicy.h>
23
25
26class QDesignerFormWindowInterface;
27
28class QDESIGNER_SHARED_EXPORT Spacer: public QWidget
29{
30 Q_OBJECT
31
32 // Special hack: Make name appear as "spacer name"
33 Q_PROPERTY(QString spacerName READ objectName WRITE setObjectName)
34 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
35 Q_PROPERTY(QSizePolicy::Policy sizeType READ sizeType WRITE setSizeType)
36 Q_PROPERTY(QSize sizeHint READ sizeHintProperty WRITE setSizeHintProperty DESIGNABLE true STORED true)
37
38public:
39 Spacer(QWidget *parent = nullptr);
40
41 QSize sizeHint() const override;
42
43 QSize sizeHintProperty() const;
44 void setSizeHintProperty(const QSize &s);
45
46 QSizePolicy::Policy sizeType() const;
47 void setSizeType(QSizePolicy::Policy t);
48
49 Qt::Alignment alignment() const;
50 Qt::Orientation orientation() const;
51
52 void setOrientation(Qt::Orientation o);
53 void setInteractiveMode(bool b) { m_interactive = b; };
54
55 bool event(QEvent *e) override;
56
57protected:
58 void paintEvent(QPaintEvent *e) override;
59 void resizeEvent(QResizeEvent* e) override;
60 void updateMask();
61
62private:
63 bool isInLayout() const;
64 void updateToolTip();
65
66 const QSize m_SizeOffset = QSize(3, 3); // A small offset to ensure the spacer is still visible when reset to size 0,0
67 QDesignerFormWindowInterface *m_formWindow;
68 Qt::Orientation m_orientation = Qt::Vertical;
69 bool m_interactive = true;
70 // Cache information about 'being in layout' which is expensive to calculate.
71 enum LayoutState { InLayout, OutsideLayout, UnknownLayoutState };
72 mutable LayoutState m_layoutState = UnknownLayoutState;
73 QSize m_sizeHint = QSize(0, 0);
74};
75
76QT_END_NAMESPACE
77
78#endif // SPACER_WIDGET_H
virtual bool dynamicPropertiesAllowed() const =0
virtual bool isDynamicProperty(int index) const =0
virtual int addDynamicProperty(const QString &propertyName, const QVariant &value)=0
virtual bool canAddDynamicProperty(const QString &propertyName) const =0
virtual bool removeDynamicProperty(int index)=0
virtual ~QDesignerDynamicPropertySheetExtension()=default
QDesignerPropertySheetFactory(QExtensionManager *parent=nullptr)
static void registerExtension(QExtensionManager *mgr)
friend class QWidget
Definition qpainter.h:421
FormEditorOptionsPage(QDesignerFormEditorInterface *core)
QWidget * createPage(QWidget *parent) override
FormEditor(const QStringList &pluginPaths, QObject *parent=nullptr)
void setProperty(int index, const QVariant &value) override
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
void addWidget(QWidget *widget) override
static void positionNewMdiChild(const QWidget *area, QWidget *mdiChild)
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
void setProperty(int index, const QVariant &value) override
static bool checkProperty(const QString &propertyName)
QVariant property(int index) const override
void addWidget(QWidget *widget) override
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
bool isVisible(int index) const override
void setProperty(int index, const QVariant &value) override
QWidget * createPage(QWidget *parent) override
static QString chooseTemplatePath(QDesignerFormEditorInterface *core, QWidget *parent)
#define QT_FORMEDITOR_EXPORT
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
#define QDESIGNER_SHARED_EXPORT