101 #ifndef QT_NO_TOOLTIP 110 return widget == other.
widget;
119 void _q_buttonClicked();
120 void _q_widgetDestroyed(
QObject*);
124 Page *page(
int index);
140 if ((*i).widget == widget)
141 return (
Page*) &(*i);
147 if (index >= 0 && index < pageList.size())
148 return &pageList[index];
154 if (index >= 0 && index < pageList.size())
155 return &pageList.at(index);
161 QToolBoxButton *lastButton = currentPage ? currentPage->button : 0;
164 for (index = 0; index < pageList.count(); ++
index) {
165 const Page &page = pageList.at(index);
180 after = tB == lastButton;
189 iconSize +=
QSize(icone + 2, icone);
202 return QSize(icone + 8, icone + 8);
219 int widgetCount = toolBox->
count();
221 if (widgetCount == 1) {
310 d->layout->setMargin(0);
323 d->layout->setMargin(0);
389 if (index < 0 || index >= (
int)
d->pageList.count()) {
390 index =
d->pageList.count();
391 d->pageList.append(c);
392 d->layout->addWidget(c.
button);
393 d->layout->addWidget(c.
sv);
397 d->pageList.insert(index, c);
399 if (
d->currentPage) {
400 QWidget *current =
d->currentPage->widget;
401 int oldindex =
indexOf(current);
402 if (index <= oldindex) {
422 if ((*i).button == tb) {
427 q->setCurrentIndex(q->indexOf(item));
443 return d->pageList.count();
450 if (!c ||
d->currentPage == c)
454 if (
d->currentPage) {
455 d->currentPage->sv->hide();
456 d->currentPage->button->setSelected(
false);
459 d->currentPage->sv->show();
491 bool removeCurrent = c == currentPage;
492 pageList.removeAll(*c);
494 if (!pageList.count()) {
496 emit q->currentChanged(-1);
497 }
else if (removeCurrent) {
499 q->setCurrentIndex(0);
515 d->_q_widgetDestroyed(w);
537 return d->currentPage ?
indexOf(
d->currentPage->widget) : -1;
549 return d->currentPage ?
d->currentPage->widget : 0;
563 qWarning(
"QToolBox::setCurrentWidget: widget not contained in tool box");
574 if (index < 0 || index >= (
int)
d->pageList.size())
576 return d->pageList.at(index).widget;
588 return c ?
d->pageList.indexOf(*c) : -1;
604 if (!enabled && c ==
d->currentPage) {
605 int curIndexUp =
index;
606 int curIndexDown = curIndexUp;
607 const int count =
d->pageList.count();
608 while (curIndexUp > 0 || curIndexDown < count-1) {
609 if (curIndexDown < count-1) {
610 if (
d->page(++curIndexDown)->button->isEnabled()) {
611 index = curIndexDown;
615 if (curIndexUp > 0) {
616 if (
d->page(--curIndexUp)->button->isEnabled()) {
659 #ifndef QT_NO_TOOLTIP 671 #endif // QT_NO_TOOLTIP 708 #ifndef QT_NO_TOOLTIP 720 #endif // QT_NO_TOOLTIP 849 #include "moc_qtoolbox.cpp" 850 #include "qtoolbox.moc" 852 #endif //QT_NO_TOOLBOX
The QPainter class performs low-level painting on widgets and other paint devices.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
QStyle::State state
the style flags that are used when drawing the control
static QSize globalStrut()
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
The QObject class is the base class of all Qt objects.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setObjectName(const QString &name)
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setIcon(const QIcon &is)
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of text.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void initFrom(const QWidget *w)
Q_CORE_EXPORT void qWarning(const char *,...)
The QShowEvent class provides an event that is sent when a widget is shown.
void setText(const QString &text)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
#define Q_DECLARE_PUBLIC(Class)
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
void setToolTip(const QString &tip)
QObject * parent() const
Returns a pointer to the parent object.
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
void setFrameStyle(int)
Sets the frame style to style.
bool event(QEvent *e)
Reimplemented Function
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
int height() const
Returns the height.
The QSize class defines the size of a two-dimensional object using integer point precision.
The QVBoxLayout class lines up widgets vertically.
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
The QFrame class is the base class of widgets that can have a frame.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
bool operator==(const Page &other) const
void deleteLater()
Schedules this object for deletion.
static bool isNull(const QVariant::Private *d)
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.