Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qtoolbar.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 QDYNAMICTOOLBAR_H
0005 #define QDYNAMICTOOLBAR_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtGui/qaction.h>
0009 #include <QtWidgets/qwidget.h>
0010 
0011 QT_REQUIRE_CONFIG(toolbar);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QToolBarPrivate;
0016 
0017 class QAction;
0018 class QIcon;
0019 class QMainWindow;
0020 class QStyleOptionToolBar;
0021 
0022 class Q_WIDGETS_EXPORT QToolBar : public QWidget
0023 {
0024     Q_OBJECT
0025 
0026     Q_PROPERTY(bool movable READ isMovable WRITE setMovable NOTIFY movableChanged)
0027     Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas
0028                NOTIFY allowedAreasChanged)
0029     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation
0030                NOTIFY orientationChanged)
0031     Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
0032     Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle
0033                NOTIFY toolButtonStyleChanged)
0034     Q_PROPERTY(bool floating READ isFloating)
0035     Q_PROPERTY(bool floatable READ isFloatable WRITE setFloatable)
0036 
0037 public:
0038     explicit QToolBar(const QString &title, QWidget *parent = nullptr);
0039     explicit QToolBar(QWidget *parent = nullptr);
0040     ~QToolBar();
0041 
0042     void setMovable(bool movable);
0043     bool isMovable() const;
0044 
0045     void setAllowedAreas(Qt::ToolBarAreas areas);
0046     Qt::ToolBarAreas allowedAreas() const;
0047 
0048     inline bool isAreaAllowed(Qt::ToolBarArea area) const
0049     { return (allowedAreas() & area) == area; }
0050 
0051     void setOrientation(Qt::Orientation orientation);
0052     Qt::Orientation orientation() const;
0053 
0054     void clear();
0055 
0056     using QWidget::addAction;
0057 #if QT_WIDGETS_REMOVED_SINCE(6, 3)
0058     QAction *addAction(const QString &text);
0059     QAction *addAction(const QIcon &icon, const QString &text);
0060     QAction *addAction(const QString &text, const QObject *receiver, const char* member);
0061     QAction *addAction(const QIcon &icon, const QString &text,
0062                        const QObject *receiver, const char* member);
0063 #endif
0064 
0065     QAction *addSeparator();
0066     QAction *insertSeparator(QAction *before);
0067 
0068     QAction *addWidget(QWidget *widget);
0069     QAction *insertWidget(QAction *before, QWidget *widget);
0070 
0071     QRect actionGeometry(QAction *action) const;
0072     QAction *actionAt(const QPoint &p) const;
0073     inline QAction *actionAt(int x, int y) const;
0074 
0075     QAction *toggleViewAction() const;
0076 
0077     QSize iconSize() const;
0078     Qt::ToolButtonStyle toolButtonStyle() const;
0079 
0080     QWidget *widgetForAction(QAction *action) const;
0081 
0082     bool isFloatable() const;
0083     void setFloatable(bool floatable);
0084     bool isFloating() const;
0085 
0086 public Q_SLOTS:
0087     void setIconSize(const QSize &iconSize);
0088     void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle);
0089 
0090 Q_SIGNALS:
0091     void actionTriggered(QAction *action);
0092     void movableChanged(bool movable);
0093     void allowedAreasChanged(Qt::ToolBarAreas allowedAreas);
0094     void orientationChanged(Qt::Orientation orientation);
0095     void iconSizeChanged(const QSize &iconSize);
0096     void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle);
0097     void topLevelChanged(bool topLevel);
0098     void visibilityChanged(bool visible);
0099 
0100 protected:
0101     void actionEvent(QActionEvent *event) override;
0102     void changeEvent(QEvent *event) override;
0103     void paintEvent(QPaintEvent *event) override;
0104     bool event(QEvent *event) override;
0105     virtual void initStyleOption(QStyleOptionToolBar *option) const;
0106 
0107 
0108 private:
0109     Q_DECLARE_PRIVATE(QToolBar)
0110     Q_DISABLE_COPY(QToolBar)
0111     Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool))
0112     Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &))
0113     Q_PRIVATE_SLOT(d_func(), void _q_updateToolButtonStyle(Qt::ToolButtonStyle))
0114 
0115     friend class QMainWindow;
0116     friend class QMainWindowLayout;
0117     friend class QToolBarLayout;
0118     friend class QToolBarAreaLayout;
0119 };
0120 
0121 inline QAction *QToolBar::actionAt(int ax, int ay) const
0122 { return actionAt(QPoint(ax, ay)); }
0123 
0124 QT_END_NAMESPACE
0125 
0126 #endif // QDYNAMICTOOLBAR_H