KDEUI
Go to the documentation of this file.
22 #include <QtCore/QPointer>
23 #include <QtGui/QApplication>
24 #include <QtGui/QLabel>
26 class KToolBarLabelAction::Private
29 QPointer<QAction>
buddy;
30 QPointer<QLabel>
label;
58 QList<QLabel*> labels;
59 foreach (
QWidget* widget, associatedWidgets() )
60 if (
QToolBar* toolBar = qobject_cast<QToolBar*>( widget ) )
61 if (
QLabel*
label = qobject_cast<QLabel*>( toolBar->widgetForAction(
this ) ) )
62 labels.append(
label );
64 foreach (
QWidget* widget, buddy->associatedWidgets() )
65 if (
QToolBar* toolBar = qobject_cast<QToolBar*>( widget ) ) {
66 QWidget* newBuddy = toolBar->widgetForAction( buddy );
68 label->setBuddy( newBuddy );
80 if ( event->type() == QEvent::ActionChanged ) {
81 if ( d->label && text() != d->label->text() ) {
83 d->label->setText(text());
92 if ( d->label && d->buddy && event->type() == QEvent::PolishRequest && watched == d->label) {
93 foreach (
QWidget* widget, d->buddy->associatedWidgets() ) {
94 if (
QToolBar* toolBar = qobject_cast<QToolBar*>( widget ) ) {
95 QWidget* newBuddy = toolBar->widgetForAction( d->buddy );
96 d->label->setBuddy( newBuddy );
110 d->label =
new QLabel( parent );
116 d->label->setBackgroundRole( QPalette::Button );
117 d->label->setAlignment( (QApplication::isRightToLeft() ? Qt::AlignRight : Qt::AlignLeft) |
119 d->label->adjustSize();
120 d->label->setText(text());
121 d->label->installEventFilter(
this );
127 #include "ktoolbarlabelaction.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 16 2013 11:46:17 by
doxygen 1.8.1.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.