Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdockwidget.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDYNAMICDOCKWIDGET_H
5#define QDYNAMICDOCKWIDGET_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qwidget.h>
9
11
13
14class QDockAreaLayout;
16class QMainWindow;
18
19class Q_WIDGETS_EXPORT QDockWidget : public QWidget
20{
22
23 Q_PROPERTY(bool floating READ isFloating WRITE setFloating NOTIFY topLevelChanged)
24 Q_PROPERTY(DockWidgetFeatures features READ features WRITE setFeatures NOTIFY featuresChanged)
25 Q_PROPERTY(Qt::DockWidgetAreas allowedAreas READ allowedAreas
26 WRITE setAllowedAreas NOTIFY allowedAreasChanged)
27 Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true)
28
29public:
30 explicit QDockWidget(const QString &title, QWidget *parent = nullptr,
31 Qt::WindowFlags flags = Qt::WindowFlags());
32 explicit QDockWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
33 ~QDockWidget();
34
35 QWidget *widget() const;
37
39 DockWidgetClosable = 0x01,
40 DockWidgetMovable = 0x02,
41 DockWidgetFloatable = 0x04,
42 DockWidgetVerticalTitleBar = 0x08,
43
44 DockWidgetFeatureMask = 0x0f,
45 NoDockWidgetFeatures = 0x00,
46
47 Reserved = 0xff
48 };
49 Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
50 Q_FLAG(DockWidgetFeatures)
51
52 void setFeatures(DockWidgetFeatures features);
53 DockWidgetFeatures features() const;
54
55 void setFloating(bool floating);
56 inline bool isFloating() const { return isWindow(); }
57
58 void setAllowedAreas(Qt::DockWidgetAreas areas);
59 Qt::DockWidgetAreas allowedAreas() const;
60
61 void setTitleBarWidget(QWidget *widget);
62 QWidget *titleBarWidget() const;
63
65 { return (allowedAreas() & area) == area; }
66
67#ifndef QT_NO_DEBUG_STREAM
68 friend Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QDockWidget *dockWidget);
69#endif
70
71#ifndef QT_NO_ACTION
72 QAction *toggleViewAction() const;
73#endif
74
76 void featuresChanged(QDockWidget::DockWidgetFeatures features);
77 void topLevelChanged(bool topLevel);
78 void allowedAreasChanged(Qt::DockWidgetAreas allowedAreas);
79 void visibilityChanged(bool visible); // ### Qt7: Deprecate this. Better listen to hide/show events
81
82protected:
83 void changeEvent(QEvent *event) override;
84 void closeEvent(QCloseEvent *event) override;
85 void paintEvent(QPaintEvent *event) override;
86 bool event(QEvent *event) override;
87 virtual void initStyleOption(QStyleOptionDockWidget *option) const;
88
89private:
90 Q_DECLARE_PRIVATE(QDockWidget)
91 Q_DISABLE_COPY(QDockWidget)
92 friend class QDockAreaLayout;
93 friend class QDockWidgetItem;
94 friend class QMainWindowLayout;
95 friend class QDockWidgetLayout;
96 friend class QDockAreaLayoutInfo;
97};
98
100
102
103#endif // QDYNAMICDOCKWIDGET_H
The QAction class provides an abstraction for user commands that can be added to different user inter...
Definition qaction.h:30
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:562
\inmodule QtCore
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition qdockwidget.h:20
bool isAreaAllowed(Qt::DockWidgetArea area) const
Returns true if this dock widget can be placed in the given area; otherwise returns false.
Definition qdockwidget.h:64
void topLevelChanged(bool topLevel)
This signal is emitted when the \l floating property changes.
void featuresChanged(QDockWidget::DockWidgetFeatures features)
This signal is emitted when the \l features property changes.
DockWidgetFeature
\value DockWidgetClosable The dock widget can be closed.
Definition qdockwidget.h:38
void visibilityChanged(bool visible)
bool isFloating() const
Definition qdockwidget.h:56
void dockLocationChanged(Qt::DockWidgetArea area)
void allowedAreasChanged(Qt::DockWidgetAreas allowedAreas)
This signal is emitted when the \l allowedAreas property changes.
\inmodule QtCore
Definition qcoreevent.h:45
The QMainWindow class provides a main application window.
Definition qmainwindow.h:25
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\variable QStyleOptionComplex::subControls
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
Combined button and popup list for selecting options.
Definition qcompare.h:63
DockWidgetArea
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
static int area(const QSize &s)
Definition qicon.cpp:153
GLbitfield flags
struct _cl_event * event
GLuint GLenum option
static bool isWindow(QObject *object)
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_SIGNALS
static QString windowTitle(HWND hwnd)
#define explicit
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QString title
[35]
QDockWidget * dockWidget
[0]
scrollArea setWidget(imageLabel)