Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtoolbox.h
Go to the documentation of this file.
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#ifndef QTOOLBOX_H
5#define QTOOLBOX_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qframe.h>
9#include <QtGui/qicon.h>
10
12
14
15class QToolBoxPrivate;
16
17class Q_WIDGETS_EXPORT QToolBox : public QFrame
18{
20 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
22
23public:
24 explicit QToolBox(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
25 ~QToolBox();
26
27 int addItem(QWidget *widget, const QString &text);
28 int addItem(QWidget *widget, const QIcon &icon, const QString &text);
29 int insertItem(int index, QWidget *widget, const QString &text);
30 int insertItem(int index, QWidget *widget, const QIcon &icon, const QString &text);
31
32 void removeItem(int index);
33
34 void setItemEnabled(int index, bool enabled);
35 bool isItemEnabled(int index) const;
36
37 void setItemText(int index, const QString &text);
38 QString itemText(int index) const;
39
40 void setItemIcon(int index, const QIcon &icon);
41 QIcon itemIcon(int index) const;
42
43#if QT_CONFIG(tooltip)
44 void setItemToolTip(int index, const QString &toolTip);
45 QString itemToolTip(int index) const;
46#endif
47
48 int currentIndex() const;
49 QWidget *currentWidget() const;
50 QWidget *widget(int index) const;
51 int indexOf(const QWidget *widget) const;
52 int count() const;
53
54public Q_SLOTS:
55 void setCurrentIndex(int index);
56 void setCurrentWidget(QWidget *widget);
57
60
61protected:
62 bool event(QEvent *e) override;
63 virtual void itemInserted(int index);
64 virtual void itemRemoved(int index);
65 void showEvent(QShowEvent *e) override;
66 void changeEvent(QEvent *) override;
67
68
69private:
70 Q_DECLARE_PRIVATE(QToolBox)
71 Q_DISABLE_COPY(QToolBox)
72 Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked())
73 Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject*))
74};
75
76
77inline int QToolBox::addItem(QWidget *item, const QString &text)
78{ return insertItem(-1, item, QIcon(), text); }
79inline int QToolBox::addItem(QWidget *item, const QIcon &iconSet,
80 const QString &text)
81{ return insertItem(-1, item, iconSet, text); }
83{ return insertItem(index, item, QIcon(), text); }
84
86
87#endif // QTOOLBOX_H
\inmodule QtCore
Definition qcoreevent.h:45
The QFrame class is the base class of widgets that can have a frame.
Definition qframe.h:17
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
\inmodule QtCore
Definition qobject.h:103
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:578
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QToolBox class provides a column of tabbed widget items.
Definition qtoolbox.h:18
void currentChanged(int index)
This signal is emitted when the current item is changed.
int insertItem(int index, QWidget *widget, const QString &text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qtoolbox.h:82
int addItem(QWidget *widget, const QString &text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qtoolbox.h:77
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
QString text
Combined button and popup list for selecting options.
Definition qcompare.h:63
GLuint index
[2]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLfloat GLfloat f
struct _cl_event * event
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
#define explicit
list indexOf("B")
scene addItem(form)
QGraphicsItem * item