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//
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#ifndef QTTOOLBARDIALOG_H
16#define QTTOOLBARDIALOG_H
17
18#include <QtWidgets/QDialog>
19
20QT_BEGIN_NAMESPACE
21
22class QMainWindow;
23class QAction;
24class QToolBar;
25
26class QtToolBarManagerPrivate;
27
28class QtToolBarManager : public QObject
29{
30 Q_OBJECT
31public:
32
33 explicit QtToolBarManager(QObject *parent = 0);
34 ~QtToolBarManager();
35
36 void setMainWindow(QMainWindow *mainWindow);
37 QMainWindow *mainWindow() const;
38
39 void addAction(QAction *action, const QString &category);
40 void removeAction(QAction *action);
41
42 void addToolBar(QToolBar *toolBar, const QString &category);
43 void removeToolBar(QToolBar *toolBar);
44
45 QList<QToolBar *> toolBars() const;
46
47 QByteArray saveState(int version = 0) const;
48 bool restoreState(const QByteArray &state, int version = 0);
49
50private:
51
52 friend class QtToolBarDialog;
53 QScopedPointer<QtToolBarManagerPrivate> d_ptr;
54 Q_DECLARE_PRIVATE(QtToolBarManager)
55 Q_DISABLE_COPY_MOVE(QtToolBarManager)
56};
57
58class QtToolBarDialogPrivate;
59
60class QtToolBarDialog : public QDialog
61{
62 Q_OBJECT
63public:
64
65 explicit QtToolBarDialog(QWidget *parent = 0, Qt::WindowFlags flags = {});
66 ~QtToolBarDialog();
67
68 void setToolBarManager(QtToolBarManager *toolBarManager);
69
70protected:
71
72 void showEvent(QShowEvent *event) override;
73 void hideEvent(QHideEvent *event) override;
74
75private:
76
77 QScopedPointer<QtToolBarDialogPrivate> d_ptr;
78 Q_DECLARE_PRIVATE(QtToolBarDialog)
79 Q_DISABLE_COPY_MOVE(QtToolBarDialog)
80};
81
82QT_END_NAMESPACE
83
84#endif
85

source code of qttools/src/shared/qttoolbardialog/qttoolbardialog.h