KXmlGui

ktoolbar.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2000 Reginald Stadlbauer <[email protected]>
4  SPDX-FileCopyrightText: 1997, 1998 Stephan Kulow <[email protected]>
5  SPDX-FileCopyrightText: 1997, 1998 Sven Radej <[email protected]>
6  SPDX-FileCopyrightText: 1997, 1998 Mark Donohoe <[email protected]>
7  SPDX-FileCopyrightText: 1997, 1998 Matthias Ettrich <[email protected]>
8  SPDX-FileCopyrightText: 1999, 2000 Kurt Granroth <[email protected]>
9  SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <[email protected]>
10 
11  SPDX-License-Identifier: LGPL-2.0-only
12 */
13 
14 #ifndef KTOOLBAR_H
15 #define KTOOLBAR_H
16 
17 #include <kxmlgui_export.h>
18 
19 #include <QToolBar>
20 
21 class QDomElement;
22 
23 class KConfigGroup;
24 class KConfig;
25 class KMainWindow;
26 class KXMLGUIClient;
27 
59 class KXMLGUI_EXPORT KToolBar : public QToolBar
60 {
61  Q_OBJECT
62 
63 public:
78  explicit KToolBar(QWidget *parent, bool isMainToolBar = false, bool readConfig = true);
79  // KDE5: remove. The one below is preferred so that all debug output from init() shows the right objectName already,
80  // and so that isMainToolBar() and iconSizeDefault() return correct values during loading too.
81 
97  explicit KToolBar(const QString &objectName, QWidget *parent, bool readConfig = true);
98 
111  KToolBar(const QString &objectName, QMainWindow *parentWindow, Qt::ToolBarArea area, bool newLine = false,
112  bool isMainToolBar = false, bool readConfig = true); // KDE5: remove, I don't think anyone is using this.
113 
117  virtual ~KToolBar();
118 
122  KMainWindow *mainWindow() const;
123 
127  void setIconDimensions(int size);
128 
134  int iconSizeDefault() const; // KDE5: hide from public API. Doesn't make sense to export this, and it isn't used.
135 
136 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
137 
143  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy)")
144  void setContextMenuEnabled(bool enable = true);
145 #endif
146 
147 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
148 
153  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use QWidget::contextMenuPolicy()")
154  bool contextMenuEnabled() const;
155 #endif
156 
160  void saveSettings(KConfigGroup &cg);
161 
166  void applySettings(const KConfigGroup &cg);
167 
168 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
169 
173  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KToolBar::addXMLGUIClient(KXMLGUIClient *)")
174  void setXMLGUIClient(KXMLGUIClient *client);
175 #endif
176 
181  void addXMLGUIClient(KXMLGUIClient *client);
182 
187  void removeXMLGUIClient(KXMLGUIClient *client);
188 
192  void loadState(const QDomElement &element);
193 
197  void saveState(QDomElement &element) const;
198 
202  bool eventFilter(QObject *watched, QEvent *event) override;
203 
207  static bool toolBarsEditable();
208 
214  static void setToolBarsEditable(bool editable);
215 
219  static bool toolBarsLocked();
220 
224  static void setToolBarsLocked(bool locked);
225 
231  static void emitToolbarStyleChanged();
232 
233 protected Q_SLOTS:
234  virtual void slotMovableChanged(bool movable);
235 
236 protected:
237  void contextMenuEvent(QContextMenuEvent *) override;
238  void actionEvent(QActionEvent *) override;
239 
240  // Draggable toolbar configuration
241  void dragEnterEvent(QDragEnterEvent *) override;
242  void dragMoveEvent(QDragMoveEvent *) override;
243  void dragLeaveEvent(QDragLeaveEvent *) override;
244  void dropEvent(QDropEvent *) override;
245  void mousePressEvent(QMouseEvent *) override;
246  void mouseMoveEvent(QMouseEvent *) override;
247  void mouseReleaseEvent(QMouseEvent *) override;
248 
249 private:
250  class Private;
251  Private *const d;
252 
253  Q_PRIVATE_SLOT(d, void slotAppearanceChanged())
254  Q_PRIVATE_SLOT(d, void slotContextAboutToShow())
255  Q_PRIVATE_SLOT(d, void slotContextAboutToHide())
256  Q_PRIVATE_SLOT(d, void slotContextLeft())
257  Q_PRIVATE_SLOT(d, void slotContextRight())
258  Q_PRIVATE_SLOT(d, void slotContextShowText())
259  Q_PRIVATE_SLOT(d, void slotContextTop())
260  Q_PRIVATE_SLOT(d, void slotContextBottom())
261  Q_PRIVATE_SLOT(d, void slotContextIcons())
262  Q_PRIVATE_SLOT(d, void slotContextText())
263  Q_PRIVATE_SLOT(d, void slotContextTextRight())
264  Q_PRIVATE_SLOT(d, void slotContextTextUnder())
265  Q_PRIVATE_SLOT(d, void slotContextIconSize())
266  Q_PRIVATE_SLOT(d, void slotLockToolBars(bool))
267 };
268 
269 #endif
virtual void dropEvent(QDropEvent *event)
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:38
virtual void dragLeaveEvent(QDragLeaveEvent *event)
virtual void dragEnterEvent(QDragEnterEvent *event)
virtual void dragMoveEvent(QDragMoveEvent *event)
virtual void mouseReleaseEvent(QMouseEvent *event)
ToolBarArea
virtual void contextMenuEvent(QContextMenuEvent *event)
virtual void mousePressEvent(QMouseEvent *event)
Top level main window.
Definition: kmainwindow.h:96
virtual void mouseMoveEvent(QMouseEvent *event)
virtual bool eventFilter(QObject *watched, QEvent *event)
Floatable toolbar with auto resize.
Definition: ktoolbar.h:59
virtual void actionEvent(QActionEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 22:50:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.