1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the tools applications of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | // |
41 | // W A R N I N G |
42 | // ------------- |
43 | // |
44 | // This file is not part of the Qt API. It exists for the convenience |
45 | // of Qt Designer. This header |
46 | // file may change from version to version without notice, or even be removed. |
47 | // |
48 | // We mean it. |
49 | // |
50 | |
51 | #ifndef QTTOOLBARDIALOG_H |
52 | #define QTTOOLBARDIALOG_H |
53 | |
54 | #include <QtWidgets/QDialog> |
55 | |
56 | QT_BEGIN_NAMESPACE |
57 | |
58 | class QMainWindow; |
59 | class QAction; |
60 | class QToolBar; |
61 | |
62 | class QtToolBarManagerPrivate; |
63 | |
64 | class QtToolBarManager : public QObject |
65 | { |
66 | Q_OBJECT |
67 | public: |
68 | |
69 | explicit QtToolBarManager(QObject *parent = 0); |
70 | ~QtToolBarManager(); |
71 | |
72 | void setMainWindow(QMainWindow *mainWindow); |
73 | QMainWindow *mainWindow() const; |
74 | |
75 | void addAction(QAction *action, const QString &category); |
76 | void removeAction(QAction *action); |
77 | |
78 | void addToolBar(QToolBar *toolBar, const QString &category); |
79 | void removeToolBar(QToolBar *toolBar); |
80 | |
81 | QList<QToolBar *> toolBars() const; |
82 | |
83 | QByteArray saveState(int version = 0) const; |
84 | bool restoreState(const QByteArray &state, int version = 0); |
85 | |
86 | private: |
87 | |
88 | friend class QtToolBarDialog; |
89 | QScopedPointer<QtToolBarManagerPrivate> d_ptr; |
90 | Q_DECLARE_PRIVATE(QtToolBarManager) |
91 | Q_DISABLE_COPY_MOVE(QtToolBarManager) |
92 | }; |
93 | |
94 | class QtToolBarDialogPrivate; |
95 | |
96 | class QtToolBarDialog : public QDialog |
97 | { |
98 | Q_OBJECT |
99 | public: |
100 | |
101 | explicit QtToolBarDialog(QWidget *parent = 0, Qt::WindowFlags flags = {}); |
102 | ~QtToolBarDialog(); |
103 | |
104 | void setToolBarManager(QtToolBarManager *toolBarManager); |
105 | |
106 | protected: |
107 | |
108 | void showEvent(QShowEvent *event); |
109 | void hideEvent(QHideEvent *event); |
110 | |
111 | private: |
112 | |
113 | QScopedPointer<QtToolBarDialogPrivate> d_ptr; |
114 | Q_DECLARE_PRIVATE(QtToolBarDialog) |
115 | Q_DISABLE_COPY_MOVE(QtToolBarDialog) |
116 | |
117 | Q_PRIVATE_SLOT(d_func(), void newClicked()) |
118 | Q_PRIVATE_SLOT(d_func(), void removeClicked()) |
119 | Q_PRIVATE_SLOT(d_func(), void defaultClicked()) |
120 | Q_PRIVATE_SLOT(d_func(), void okClicked()) |
121 | Q_PRIVATE_SLOT(d_func(), void applyClicked()) |
122 | Q_PRIVATE_SLOT(d_func(), void cancelClicked()) |
123 | Q_PRIVATE_SLOT(d_func(), void upClicked()) |
124 | Q_PRIVATE_SLOT(d_func(), void downClicked()) |
125 | Q_PRIVATE_SLOT(d_func(), void leftClicked()) |
126 | Q_PRIVATE_SLOT(d_func(), void rightClicked()) |
127 | Q_PRIVATE_SLOT(d_func(), void renameClicked()) |
128 | Q_PRIVATE_SLOT(d_func(), void toolBarRenamed(QListWidgetItem *)) |
129 | Q_PRIVATE_SLOT(d_func(), void currentActionChanged(QTreeWidgetItem *)) |
130 | Q_PRIVATE_SLOT(d_func(), void currentToolBarChanged(QListWidgetItem *)) |
131 | Q_PRIVATE_SLOT(d_func(), void currentToolBarActionChanged(QListWidgetItem *)) |
132 | }; |
133 | |
134 | QT_END_NAMESPACE |
135 | |
136 | #endif |
137 | |