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// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header
11// file may change from version to version without notice, or even be removed.
12//
13// We mean it.
14//
15
16
17#ifndef SPACER_WIDGET_H
18#define SPACER_WIDGET_H
19
21
22#include <QtWidgets/qwidget.h>
23#include <QtWidgets/qsizepolicy.h>
24
26
27class QDesignerFormWindowInterface;
28
29class QDESIGNER_SHARED_EXPORT Spacer: public QWidget
30{
31 Q_OBJECT
32
33 // Special hack: Make name appear as "spacer name"
34 Q_PROPERTY(QString spacerName READ objectName WRITE setObjectName)
35 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
36 Q_PROPERTY(QSizePolicy::Policy sizeType READ sizeType WRITE setSizeType)
37 Q_PROPERTY(QSize sizeHint READ sizeHintProperty WRITE setSizeHintProperty DESIGNABLE true STORED true)
38
39public:
40 Spacer(QWidget *parent = nullptr);
41
42 QSize sizeHint() const override;
43
44 QSize sizeHintProperty() const;
45 void setSizeHintProperty(const QSize &s);
46
47 QSizePolicy::Policy sizeType() const;
48 void setSizeType(QSizePolicy::Policy t);
49
50 Qt::Alignment alignment() const;
51 Qt::Orientation orientation() const;
52
53 void setOrientation(Qt::Orientation o);
54 void setInteractiveMode(bool b) { m_interactive = b; };
55
56 bool event(QEvent *e) override;
57
58protected:
59 void paintEvent(QPaintEvent *e) override;
60 void resizeEvent(QResizeEvent* e) override;
61 void updateMask();
62
63private:
64 bool isInLayout() const;
65 void updateToolTip();
66
67 const QSize m_SizeOffset = QSize(3, 3); // A small offset to ensure the spacer is still visible when reset to size 0,0
68 QDesignerFormWindowInterface *m_formWindow;
69 Qt::Orientation m_orientation = Qt::Vertical;
70 bool m_interactive = true;
71 // Cache information about 'being in layout' which is expensive to calculate.
72 enum LayoutState { InLayout, OutsideLayout, UnknownLayoutState };
73 mutable LayoutState m_layoutState = UnknownLayoutState;
74 QSize m_sizeHint = QSize(0, 0);
75};
76
77QT_END_NAMESPACE
78
79#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:432
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.
QDesignerPropertySheetFactory< QWizardPage, QWizardPagePropertySheet > QWizardPagePropertySheetFactory
#define QDESIGNER_SHARED_EXPORT