KDELibs4Support

ktabwidget.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2003 Stephan Binner <[email protected]>
3  Copyright (C) 2003 Zack Rusin <[email protected]>
4  Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KTABWIDGET_H
23 #define KTABWIDGET_H
24 
25 #include <kdelibs4support_export.h>
26 
27 #include <QTabWidget>
28 
29 class QTab;
30 
44 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KTabWidget : public QTabWidget //krazy:exclude=qclasses
45 {
46  Q_OBJECT
47 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
48  Q_PROPERTY(bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled)
49  Q_PROPERTY(bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton)
50  Q_PROPERTY(bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed)
51  Q_PROPERTY(bool closeButtonEnabled READ isCloseButtonEnabled WRITE setCloseButtonEnabled)
52  Q_PROPERTY(bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious)
53 #endif
54  Q_PROPERTY(bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs)
55 
56 public:
57 
64  KDELIBS4SUPPORT_DEPRECATED explicit KTabWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {});
65 
69  virtual ~KTabWidget();
70 
75  void setTabTextColor(int index, const QColor &color);
76 
81  QColor tabTextColor(int index) const;
82 
89 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
90  KDELIBS4SUPPORT_DEPRECATED bool isTabReorderingEnabled() const;
91 #endif
92 
99 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
100  KDELIBS4SUPPORT_DEPRECATED bool hoverCloseButton() const;
101 #endif
102 
109 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
110  KDELIBS4SUPPORT_DEPRECATED bool hoverCloseButtonDelayed() const;
111 #endif
112 
120 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
121  KDELIBS4SUPPORT_DEPRECATED bool isCloseButtonEnabled() const;
122 #endif
123 
130 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
131  KDELIBS4SUPPORT_DEPRECATED bool tabCloseActivatePrevious() const;
132 #endif
133 
138  bool automaticResizeTabs() const;
139 
146 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
147  KDELIBS4SUPPORT_DEPRECATED void setTabBarHidden(bool hide);
148 #endif
149 
157 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
158  KDELIBS4SUPPORT_DEPRECATED bool isTabBarHidden() const;
159 #endif
160 
179  QString tabText(int) const; // but it's not virtual...
180 
181 #ifdef KDE3_SUPPORT
182 
185 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
186  inline KDELIBS4SUPPORT_DEPRECATED QString label(int index) const
187  {
188  return tabText(index);
189  }
190 #endif
191 
195 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
196  inline KDELIBS4SUPPORT_DEPRECATED QString tabLabel(QWidget *w) const
197  {
198  return tabText(indexOf(w));
199  }
200 #endif
201 
205 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
206  inline KDELIBS4SUPPORT_DEPRECATED void setTabLabel(QWidget *w, const QString &l)
207  {
208  setTabText(indexOf(w), l);
209  }
210 #endif
211 #endif
212 
216  void setTabText(int, const QString &);
217 
218  using QTabWidget::tabBar;
219 
220 public Q_SLOTS:
225  virtual void moveTab(int, int);
226 
232  virtual QT_MOC_COMPAT void removePage(QWidget *w);
233 
238  virtual void removeTab(int index); // but it's not virtual in QTabWidget...
239 
255 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
256  QT_MOC_COMPAT void setTabReorderingEnabled(bool enable);
257 #endif
258 
266 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
267  QT_MOC_COMPAT void setHoverCloseButton(bool enable);
268 #endif
269 
276 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
277  QT_MOC_COMPAT void setHoverCloseButtonDelayed(bool delayed);
278 #endif
279 
289 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
290  QT_MOC_COMPAT void setCloseButtonEnabled(bool);
291 #endif
292 
299 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
300  QT_MOC_COMPAT void setTabCloseActivatePrevious(bool previous);
301 #endif
302 
309  void setAutomaticResizeTabs(bool enable);
310 
311 Q_SIGNALS:
315  void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
316 
321  void receivedDropEvent(QDropEvent *);
322 
327  void receivedDropEvent(QWidget *, QDropEvent *);
328 
332  void initiateDrag(QWidget *);
333 
337  void contextMenu(const QPoint &);
338 
342  void contextMenu(QWidget *, const QPoint &);
343 
344 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
345 
349  void movedTab(int, int);
350 #endif
351 
356  void mouseDoubleClick();
357 
362  void mouseDoubleClick(QWidget *);
363 
368  void mouseMiddleClick();
369 
374  void mouseMiddleClick(QWidget *);
375 
380  void closeRequest(QWidget *);
381 
382 protected:
383  void mouseDoubleClickEvent(QMouseEvent *) override;
384  void mousePressEvent(QMouseEvent *) override;
385  void mouseReleaseEvent(QMouseEvent *) override;
386  void dragEnterEvent(QDragEnterEvent *) override;
387  void dragMoveEvent(QDragMoveEvent *) override;
388  void dropEvent(QDropEvent *) override;
389  int tabBarWidthForMaxChars(int);
390 #ifndef QT_NO_WHEELEVENT
391  void wheelEvent(QWheelEvent *) override;
392 #endif
393  void resizeEvent(QResizeEvent *) override;
394  void tabInserted(int) override;
395  void tabRemoved(int) override;
396 
400 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED
401  KDELIBS4SUPPORT_DEPRECATED void currentChanged(int);
402 #endif
403 
404 protected Q_SLOTS:
405  virtual void receivedDropEvent(int, QDropEvent *);
406  virtual void initiateDrag(int);
407  virtual void contextMenu(int, const QPoint &);
408  virtual void mouseDoubleClick(int);
409  virtual void mouseMiddleClick(int);
410  virtual void closeRequest(int);
411 #ifndef QT_NO_WHEELEVENT
412  virtual void wheelDelta(int);
413 #endif
414 
415 private:
416  class Private;
417  Private *const d;
418 
419  Q_PRIVATE_SLOT(d, void slotTabMoved(int, int))
420 };
421 
422 #endif
virtual void dropEvent(QDropEvent *event)
QString tabText(int index) const const
virtual void tabInserted(int index)
virtual void dragEnterEvent(QDragEnterEvent *event)
virtual void dragMoveEvent(QDragMoveEvent *event)
int indexOf(QWidget *w) const const
virtual void mouseReleaseEvent(QMouseEvent *event)
void setTabText(int index, const QString &label)
virtual void mousePressEvent(QMouseEvent *event)
void currentChanged(int index)
virtual void tabRemoved(int index)
Q_PROPERTY(...)
virtual void wheelEvent(QWheelEvent *event)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
virtual void resizeEvent(QResizeEvent *e) override
void removeTab(int index)
QTabBar * tabBar() const const
typedef WindowFlags
A widget containing multiple tabs.
Definition: ktabwidget.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Nov 27 2020 23:00:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.