Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 09:09:32

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QDYNAMICDOCKWIDGET_H
0005 #define QDYNAMICDOCKWIDGET_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qwidget.h>
0009 
0010 QT_REQUIRE_CONFIG(dockwidget);
0011 
0012 QT_BEGIN_NAMESPACE
0013 
0014 class QDockAreaLayout;
0015 class QDockWidgetPrivate;
0016 class QMainWindow;
0017 class QStyleOptionDockWidget;
0018 
0019 class Q_WIDGETS_EXPORT QDockWidget : public QWidget
0020 {
0021     Q_OBJECT
0022 
0023     Q_PROPERTY(bool floating READ isFloating WRITE setFloating NOTIFY topLevelChanged)
0024     Q_PROPERTY(DockWidgetFeatures features READ features WRITE setFeatures NOTIFY featuresChanged)
0025     Q_PROPERTY(Qt::DockWidgetAreas allowedAreas READ allowedAreas
0026                WRITE setAllowedAreas NOTIFY allowedAreasChanged)
0027     Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true)
0028     Q_PROPERTY(Qt::DockWidgetArea dockLocation READ dockLocation WRITE setDockLocation
0029                NOTIFY dockLocationChanged)
0030 
0031 public:
0032     explicit QDockWidget(const QString &title, QWidget *parent = nullptr,
0033                          Qt::WindowFlags flags = Qt::WindowFlags());
0034     explicit QDockWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
0035     ~QDockWidget();
0036 
0037     QWidget *widget() const;
0038     void setWidget(QWidget *widget);
0039 
0040     enum DockWidgetFeature {
0041         DockWidgetClosable    = 0x01,
0042         DockWidgetMovable     = 0x02,
0043         DockWidgetFloatable   = 0x04,
0044         DockWidgetVerticalTitleBar = 0x08,
0045 
0046         DockWidgetFeatureMask = 0x0f,
0047         NoDockWidgetFeatures  = 0x00,
0048 
0049         Reserved              = 0xff
0050     };
0051     Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
0052     Q_FLAG(DockWidgetFeatures)
0053 
0054     void setFeatures(DockWidgetFeatures features);
0055     DockWidgetFeatures features() const;
0056 
0057     void setFloating(bool floating);
0058     inline bool isFloating() const { return isWindow(); }
0059 
0060     void setAllowedAreas(Qt::DockWidgetAreas areas);
0061     Qt::DockWidgetAreas allowedAreas() const;
0062 
0063     void setTitleBarWidget(QWidget *widget);
0064     QWidget *titleBarWidget() const;
0065 
0066     void setDockLocation(Qt::DockWidgetArea area);
0067     Qt::DockWidgetArea dockLocation() const;
0068 
0069     inline bool isAreaAllowed(Qt::DockWidgetArea area) const
0070     { return (allowedAreas() & area) == area; }
0071 
0072 #ifndef QT_NO_DEBUG_STREAM
0073     friend Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QDockWidget *dockWidget);
0074 #endif
0075 
0076 #ifndef QT_NO_ACTION
0077     QAction *toggleViewAction() const;
0078 #endif
0079 
0080 Q_SIGNALS:
0081     void featuresChanged(QDockWidget::DockWidgetFeatures features);
0082     void topLevelChanged(bool topLevel);
0083     void allowedAreasChanged(Qt::DockWidgetAreas allowedAreas);
0084     void visibilityChanged(bool visible); // ### Qt7: Deprecate this. Better listen to hide/show events
0085     void dockLocationChanged(Qt::DockWidgetArea area);
0086 
0087 protected:
0088     void changeEvent(QEvent *event) override;
0089     void closeEvent(QCloseEvent *event) override;
0090     void paintEvent(QPaintEvent *event) override;
0091     bool event(QEvent *event) override;
0092     virtual void initStyleOption(QStyleOptionDockWidget *option) const;
0093 
0094 private:
0095     Q_DECLARE_PRIVATE(QDockWidget)
0096     Q_DISABLE_COPY(QDockWidget)
0097     friend class QDockAreaLayout;
0098     friend class QDockWidgetItem;
0099     friend class QMainWindowLayout;
0100     friend class QDockWidgetLayout;
0101     friend class QDockAreaLayoutInfo;
0102 };
0103 
0104 Q_DECLARE_OPERATORS_FOR_FLAGS(QDockWidget::DockWidgetFeatures)
0105 
0106 QT_END_NAMESPACE
0107 
0108 #endif // QDYNAMICDOCKWIDGET_H