QPixmap UIIconPoolGeneral::guestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize /* = 0 */) const { /* Prepare fallback pixmap: */ static QPixmap nullPixmap; /* If we do NOT have that 'guest OS type' icon cached already: */ if (!m_guestOSTypeIcons.contains(strOSTypeID)) { /* Compose proper icon if we have that 'guest OS type' known: */ if (m_guestOSTypeIconNames.contains(strOSTypeID)) m_guestOSTypeIcons[strOSTypeID] = iconSet(m_guestOSTypeIconNames[strOSTypeID]); /* Assign fallback icon if we do NOT have that 'guest OS type' known: */ else m_guestOSTypeIcons[strOSTypeID] = iconSet(nullPixmap); } /* Retrieve corresponding icon: */ const QIcon &icon = m_guestOSTypeIcons[strOSTypeID]; AssertMsgReturn(!icon.isNull(), ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()), nullPixmap); /* Retrieve available sizes for that icon: */ const QList<QSize> availableSizes = icon.availableSizes(); AssertMsgReturn(!availableSizes.isEmpty(), ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()), nullPixmap); /* Pass up logical size if necessary: */ if (pLogicalSize) *pLogicalSize = availableSizes.first(); /* Return pixmap of first available size: */ return icon.pixmap(availableSizes.first()); }
void TKAction::updateLayout(QWidget* base) { QLabel* textLabel = (QLabel*)base->child("text"); QLabel* pixLabel = (QLabel*)base->child("pixmap"); QWidget* w = (QWidget*)base->child("widget"); if (!textLabel || !pixLabel || !w) return; if (!text().isEmpty() && m_imode != TK::IconOnly ) { textLabel->setText(text()); textLabel->show(); } else textLabel->hide(); QPixmap pix; if (hasIcon()) pix = iconSet(KIcon::Small).pixmap(); if (!icon().isEmpty()) pix = BarIcon(icon()); if (!pix.isNull() && m_imode != TK::TextOnly) { pixLabel->setPixmap(pix); pixLabel->show(); } else pixLabel->hide(); base->setFixedWidth( w->sizeHint().width() + (textLabel->isVisible() ? textLabel->sizeHint().width():0) + (pixLabel->isVisible() ? pixLabel->sizeHint().width():0) ); }
void PanelBrowserMenu::mouseMoveEvent(QMouseEvent *e) { QMenu::mouseMoveEvent(e); if (!(e->buttons() & Qt::LeftButton)) return; if(_lastpress == QPoint(-1, -1)) return; // DND delay if((_lastpress - e->pos()).manhattanLength() < 12) return; // get id int id = static_cast<QMenuItem*>(actionAt(_lastpress))->id(); if(!_filemap.contains(id)) return; // reset _lastpress _lastpress = QPoint(-1, -1); // start drag KUrl url; url.setPath(path() + '/' + _filemap[id]); KUrl::List files(url); QDrag* drag = new QDrag(this); QMimeData* data = new QMimeData; files.populateMimeData(data); connect(drag, SIGNAL(destroyed(QObject*)), this, SLOT(dragObjectDestroyed(QObject*))); drag->setPixmap(iconSet(id).pixmap()); drag->start(); }
void PanelBrowserMenu::mouseMoveEvent(QMouseEvent *e) { QPopupMenu::mouseMoveEvent(e); if (!(e->state() & LeftButton)) return; if(_lastpress == QPoint(-1, -1)) return; // DND delay if((_lastpress - e->pos()).manhattanLength() < 12) return; // get id int id = idAt(_lastpress); if(!_filemap.contains(id)) return; // reset _lastpress _lastpress = QPoint(-1, -1); // start drag KURL url; url.setPath(path() + "/" + _filemap[id]); KURL::List files(url); KURLDrag *d = new KURLDrag(files, this); connect(d, SIGNAL(destroyed()), this, SLOT(slotDragObjectDestroyed())); d->setPixmap(iconSet(id)->pixmap()); d->drag(); }
int ProjectToolBox::addProject ( FermaNextProject& prj ) { ProjectToolBoxPage* page = new ProjectToolBoxPage( prj ); // Catch name changing connect( &prj, SIGNAL(onNameChange(const QString&)), SLOT(projectRename(const QString&)) ); QIcon iconSet( Global::imagesPath() + "/project_toolbox.png" ); int result = addItem( page, iconSet, prj.getName() ); setCurrentWidget(page); prj.activate(); // FIXME: kill this long chain of signal delegations connect( &page->getWindowListBox(), SIGNAL(onShowTrussResults(const TrussUnitWindow&)), SIGNAL(onShowTrussResults(const TrussUnitWindow&)) ); connect( this, SIGNAL(calculateTrussUnit(const TrussUnitWindow&)), &page->getWindowListBox(), SLOT(solveTrussUnit(const TrussUnitWindow&)) ); return result; }
/* static */ QPixmap UIIconPool::pixmap(const QString &strName) { /* Reuse iconSet API: */ QIcon icon = iconSet(strName); /* Return pixmap of first available size: */ return icon.pixmap(icon.availableSizes().first()); }
//! Return sizeHint QSize QwtPushButton::sizeHint() const { QSize hint = QPushButton::sizeHint(); if ( d_indent > 0 ) { if ( (d_alignment & Qt::AlignLeft) || (d_alignment & Qt::AlignRight) ) { hint.setWidth(hint.width() + d_indent); } if ( (d_alignment & Qt::AlignTop) || (d_alignment & Qt::AlignBottom) ) { hint.setHeight(hint.height() + d_indent); } } if ( pixmap() ) return hint; const Qt::TextFormat textFormat = usedTextFormat(); if ( textFormat == Qt::RichText ) { QwtRichText richText(text(), font(), d_alignment); const QSize sizeText = fontMetrics().size(Qt::ShowPrefix, text()); const QSize sizeRichText(richText.boundingRect().size()); int iconHeight = 0; if ( iconSet() && !iconSet()->isNull() ) { iconHeight = iconSet()->pixmap(QIconSet::Small, QIconSet::Normal).height(); } const int heightText = QMAX(iconHeight, sizeText.height()); const int heightRichText = QMAX(iconHeight, sizeRichText.height()); hint.setWidth(hint.width() - sizeText.width() + sizeRichText.width()); hint.setHeight(hint.height() - heightText + heightRichText); } return hint; }
/* static */ QPixmap UIIconPool::pixmap(const QString &strName) { /* Reuse iconSet API: */ QIcon icon = iconSet(strName); /* Return pixmap of first available size: */ const int iHint = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); return icon.pixmap(icon.availableSizes().value(0, QSize(iHint, iHint))); }
QSize KMultiTabBarButton::sizeHint() const { constPolish(); int w = 0, h = 0; // calculate contents size... #ifndef QT_NO_ICONSET if ( iconSet() && !iconSet()->isNull() ) { int iw = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 4; int ih = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); w += iw; h = QMAX( h, ih ); } #endif if ( isMenuButton() ) w += style().pixelMetric(QStyle::PM_MenuButtonIndicator, this); if ( pixmap() ) { QPixmap *pm = (QPixmap *)pixmap(); w += pm->width(); h += pm->height(); } else { QString s( text() ); bool empty = s.isEmpty(); if ( empty ) s = QString::fromLatin1("XXXX"); QFontMetrics fm = fontMetrics(); QSize sz = fm.size( ShowPrefix, s ); if(!empty || !w) w += sz.width(); if(!empty || !h) h = QMAX(h, sz.height()); } return (style().sizeFromContents(QStyle::CT_ToolButton, this, QSize(w, h)). expandedTo(QApplication::globalStrut())); }
bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e) { if (e->type() == QEvent::MouseMove) { const int section = sectionAt(static_cast<QMouseEvent*>(e)->x()); if (section != m_lastToolTipSection && section >= 0 && section < (int)m_toolTips.count()) { //QToolTip::remove(this, m_toolTipRect); #ifdef __GNUC__ #warning TODO KexiTableViewHeader::eventFilter #else #pragma WARNING( TODO KexiTableViewHeader::eventFilter ) #endif QString tip = m_toolTips[ section ]; if (tip.isEmpty()) { //try label QFontMetrics fm(font()); int minWidth = fm.width(label(section)) + style()->pixelMetric(QStyle::PM_HeaderMargin); QIcon *iset = iconSet(section); if (iset) minWidth += (2 + iset->pixmap(IconSize(KIconLoader::Small)).width()); //taken from QHeader::sectionSizeHint() if (minWidth > sectionSize(section)) tip = label(section); } if (tip.isEmpty()) { m_lastToolTipSection = -1; } else { #ifdef __GNUC__ #warning QToolTip::showText() OK? #else #pragma WARNING( QToolTip::showText() OK? ) #endif QToolTip::showText(static_cast<QMouseEvent*>(e)->globalPos(), tip, this, m_toolTipRect = sectionRect(section)); m_lastToolTipSection = section; } } } else if (e->type() == QEvent::ToolTip) { // QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e); #ifdef __GNUC__ #warning TODO #else #pragma WARNING( TODO ) #endif } // if (e->type()==QEvent::MouseButtonPress) { // todo // } return Q3Header::eventFilter(watched, e); }
void TrayButton::drawButton(QPainter *p) { QPixmap bg(size()); QPainter pbg; pbg.begin(&bg); if (parentWidget() && parentWidget()->backgroundPixmap()) pbg.drawTiledPixmap(0, 0, width(), height(), *(parentWidget()->backgroundPixmap()), x(), y()); else pbg.fillRect(rect(), colorGroup().brush(QColorGroup::Background)); if (isDown() || isOn()) { // Draw shapes to indicate the down state. style().drawPrimitive(QStyle::PE_Panel, &pbg, rect(), colorGroup(), QStyle::Style_Sunken); } pbg.end(); p->drawPixmap(0,0,bg); // draw the background QPixmap pixmap = iconSet()->pixmap( QIconSet::Automatic, isEnabled() ? QIconSet::Normal : QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off); // draw icon if(!pixmap.isNull()) { QRect br(1, 1, width()-2, height()-2); int dx = (br.width() - pixmap.width()) / 2; int dy = (br.height() - pixmap.height()) / 2; p->drawPixmap(br.x() + dx, br.y() + dy, pixmap); } }
void KMultiTabBarTab::drawButtonClassic(QPainter *paint) { QPixmap pixmap; if ( iconSet()) pixmap = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ); paint->fillRect(0, 0, 24, 24, colorGroup().background()); if (!isOn()) { if (m_position==KMultiTabBar::Right) { paint->fillRect(0,0,21,21,QBrush(colorGroup().background())); paint->setPen(colorGroup().background().dark(150)); paint->drawLine(0,22,23,22); paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap); paint->setPen(colorGroup().shadow()); paint->drawLine(0,0,0,23); paint->setPen(colorGroup().background().dark(120)); paint->drawLine(1,0,1,23); } else if ((m_position==KMultiTabBar::Bottom) || (m_position==KMultiTabBar::Top)) { paint->fillRect(0,1,23,22,QBrush(colorGroup().background())); paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap); paint->setPen(colorGroup().background().dark(120)); paint->drawLine(23,0,23,23); paint->setPen(colorGroup().light()); paint->drawLine(0,22,23,22); paint->drawLine(0,23,23,23); paint->setPen(colorGroup().shadow()); paint->drawLine(0,0,23,0); paint->setPen(colorGroup().background().dark(120)); paint->drawLine(0,1,23,1); } else { paint->setPen(colorGroup().background().dark(120)); paint->drawLine(0,23,23,23); paint->fillRect(0,0,23,21,QBrush(colorGroup().background())); paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap); paint->setPen(colorGroup().light()); paint->drawLine(23,0,23,23); paint->drawLine(22,0,22,23); paint->setPen(colorGroup().shadow()); paint->drawLine(0,0,0,23); } } else { if (m_position==KMultiTabBar::Right) { paint->setPen(colorGroup().shadow()); paint->drawLine(0,height()-1,23,height()-1); paint->drawLine(0,height()-2,23,height()-2); paint->drawLine(23,0,23,height()-1); paint->drawLine(22,0,22,height()-1); paint->fillRect(0,0,21,height()-3,QBrush(colorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { if (height()<25+4) return; QPixmap tpixmap(height()-25-3, width()-2); QPainter painter(&tpixmap); painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),QBrush(colorGroup().light())); painter.setPen(colorGroup().text()); painter.drawText(0,+width()/2+QFontMetrics(QFont()).height()/2,m_text); paint->rotate(90); kdDebug()<<"tpixmap.width:"<<tpixmap.width()<<endl; paint->drawPixmap(25,-tpixmap.height()+1,tpixmap); } } else if (m_position==KMultiTabBar::Top) { paint->fillRect(0,0,width()-1,23,QBrush(colorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { paint->setPen(colorGroup().text()); paint->drawText(25,height()/2+QFontMetrics(QFont()).height()/2,m_text); } } else if (m_position==KMultiTabBar::Bottom) { paint->setPen(colorGroup().shadow()); paint->drawLine(0,23,width()-1,23); paint->drawLine(0,22,width()-1,22); paint->fillRect(0,0,width()-1,21,QBrush(colorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { paint->setPen(colorGroup().text()); paint->drawText(25,height()/2+QFontMetrics(QFont()).height()/2,m_text); } } else { paint->setPen(colorGroup().shadow()); paint->drawLine(0,height()-1,23,height()-1); paint->drawLine(0,height()-2,23,height()-2); paint->fillRect(0,0,23,height()-3,QBrush(colorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { if (height()<25+4) return; QPixmap tpixmap(height()-25-3, width()-2); QPainter painter(&tpixmap); painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),QBrush(colorGroup().light())); painter.setPen(colorGroup().text()); painter.drawText(tpixmap.width()-QFontMetrics(QFont()).width(m_text),+width()/2+QFontMetrics(QFont()).height()/2,m_text); paint->rotate(-90); kdDebug()<<"tpixmap.width:"<<tpixmap.width()<<endl; paint->drawPixmap(-24-tpixmap.width(),2,tpixmap); } } } }
/* static */ QIcon UIIconPool::defaultIcon(UIDefaultIconType defaultIconType, const QWidget *pWidget /* = 0 */) { QIcon icon; QStyle *pStyle = pWidget ? pWidget->style() : QApplication::style(); switch (defaultIconType) { case UIDefaultIconType_MessageBoxInformation: { icon = pStyle->standardIcon(QStyle::SP_MessageBoxInformation, 0, pWidget); break; } case UIDefaultIconType_MessageBoxQuestion: { icon = pStyle->standardIcon(QStyle::SP_MessageBoxQuestion, 0, pWidget); break; } case UIDefaultIconType_MessageBoxWarning: { #ifdef Q_WS_MAC /* At least in Qt 4.3.4/4.4 RC1 SP_MessageBoxWarning is the application * icon. So change this to the critical icon. (Maybe this would be * fixed in a later Qt version) */ icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget); #else /* Q_WS_MAC */ icon = pStyle->standardIcon(QStyle::SP_MessageBoxWarning, 0, pWidget); #endif /* !Q_WS_MAC */ break; } case UIDefaultIconType_MessageBoxCritical: { icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget); break; } case UIDefaultIconType_DialogCancel: { icon = pStyle->standardIcon(QStyle::SP_DialogCancelButton, 0, pWidget); if (icon.isNull()) icon = iconSet(":/cancel_16px.png"); break; } case UIDefaultIconType_DialogHelp: { icon = pStyle->standardIcon(QStyle::SP_DialogHelpButton, 0, pWidget); if (icon.isNull()) icon = iconSet(":/help_16px.png"); break; } case UIDefaultIconType_ArrowBack: { icon = pStyle->standardIcon(QStyle::SP_ArrowBack, 0, pWidget); if (icon.isNull()) icon = iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png"); break; } case UIDefaultIconType_ArrowForward: { icon = pStyle->standardIcon(QStyle::SP_ArrowForward, 0, pWidget); if (icon.isNull()) icon = iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png"); break; } default: { AssertMsgFailed(("Unknown default icon type!")); break; } } return icon; }
void PrefInterface::getData(Preferences * pref) { requires_restart = false; language_changed = false; iconset_changed = false; gui_changed = false; style_changed = false; recents_changed = false; if (pref->language != language()) { pref->language = language(); language_changed = true; qDebug("PrefInterface::getData: chosen language: '%s'", pref->language.toUtf8().data()); } if (pref->iconset != iconSet()) { pref->iconset = iconSet(); iconset_changed = true; } if (pref->gui != GUI()) { pref->gui = GUI(); gui_changed = true; } pref->resize_method = resizeMethod(); pref->save_window_size_on_exit = saveSize(); #ifdef SINGLE_INSTANCE pref->use_single_instance = useSingleInstance(); #endif if (pref->history_recents->maxItems() != recentsMaxItems()) { pref->history_recents->setMaxItems( recentsMaxItems() ); recents_changed = true; } pref->seeking1 = seeking1(); pref->seeking2 = seeking2(); pref->seeking3 = seeking3(); pref->seeking4 = seeking4(); pref->update_while_seeking = updateWhileDragging(); pref->relative_seeking= relativeSeeking(); pref->precise_seeking = preciseSeeking(); pref->default_font = defaultFont(); pref->hide_video_window_on_audio_files = hideVideoOnAudioFiles(); #if STYLE_SWITCHING if ( pref->style != style() ) { pref->style = style(); style_changed = true; } #endif pref->floating_control_animated = floatingAnimated(); pref->floating_control_width = floatingWidth(); pref->floating_control_margin = floatingMargin(); pref->floating_display_in_compact_mode = displayFloatingInCompactMode(); #ifndef Q_OS_WIN pref->bypass_window_manager = floatingBypassWindowManager(); #endif }
int Q3Action::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: activated(); break; case 1: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: activate(); break; case 3: toggle(); break; case 4: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break; case 5: setEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 6: setDisabled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: setVisible((*reinterpret_cast< bool(*)>(_a[1]))); break; case 8: internalActivation(); break; case 9: toolButtonToggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 10: objectDestroyed(); break; case 11: menuStatusText((*reinterpret_cast< int(*)>(_a[1]))); break; case 12: showStatusText((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 13: clearStatusText(); break; } _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isToggleAction(); break; case 1: *reinterpret_cast< bool*>(_v) = isOn(); break; case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break; case 3: *reinterpret_cast< QIcon*>(_v) = iconSet(); break; case 4: *reinterpret_cast< QString*>(_v) = text(); break; case 5: *reinterpret_cast< QString*>(_v) = menuText(); break; case 6: *reinterpret_cast< QString*>(_v) = toolTip(); break; case 7: *reinterpret_cast< QString*>(_v) = statusTip(); break; case 8: *reinterpret_cast< QString*>(_v) = whatsThis(); break; case 9: *reinterpret_cast< QKeySequence*>(_v) = accel(); break; case 10: *reinterpret_cast< bool*>(_v) = isVisible(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setToggleAction(*reinterpret_cast< bool*>(_v)); break; case 1: setOn(*reinterpret_cast< bool*>(_v)); break; case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break; case 3: setIconSet(*reinterpret_cast< QIcon*>(_v)); break; case 4: setText(*reinterpret_cast< QString*>(_v)); break; case 5: setMenuText(*reinterpret_cast< QString*>(_v)); break; case 6: setToolTip(*reinterpret_cast< QString*>(_v)); break; case 7: setStatusTip(*reinterpret_cast< QString*>(_v)); break; case 8: setWhatsThis(*reinterpret_cast< QString*>(_v)); break; case 9: setAccel(*reinterpret_cast< QKeySequence*>(_v)); break; case 10: setVisible(*reinterpret_cast< bool*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
int KAction::plug( QWidget *w, int index ) { //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; if (!w ) { kdWarning(129) << "KAction::plug called with 0 argument\n"; return -1; } // Ellis: print warning if there is a shortcut, but no KAccel available (often due to no widget available in the actioncollection) // David: Well, it doesn't matter much, things still work (e.g. Undo in koffice) via QAccel. // We should probably re-enable the warning for things that only KAccel can do, though - e.g. WIN key (mapped to Meta). #if 0 //ndef NDEBUG KAccel* kaccel = kaccelCurrent(); if( !d->m_cut.isNull() && !kaccel ) { kdDebug(129) << "KAction::plug(): has no KAccel object; this = " << this << " name = " << name() << " parentCollection = " << m_parentCollection << endl; // ellis } #endif // Check if action is permitted if (kapp && !kapp->authorizeKAction(name())) return -1; plugShortcut(); if ( ::qt_cast<QPopupMenu *>( w ) ) { QPopupMenu* menu = static_cast<QPopupMenu*>( w ); int id; // Don't insert shortcut into menu if it's already in a KAccel object. int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt(); if ( d->hasIcon() ) { KInstance *instance; if ( m_parentCollection ) instance = m_parentCollection->instance(); else instance = KGlobal::instance(); id = menu->insertItem( d->iconSet( KIcon::Small, 0, instance ), d->text(), this,//dsweet SLOT( slotPopupActivated() ), keyQt, -1, index ); } else id = menu->insertItem( d->text(), this, SLOT( slotPopupActivated() ), keyQt, -1, index ); // If the shortcut is already in a KAccel object, then // we need to set the menu item's shortcut text. if ( d->m_kaccelList.count() || d->m_kaccel ) updateShortcut( menu, id ); // call setItemEnabled only if the item really should be disabled, // because that method is slow and the item is per default enabled if ( !d->isEnabled() ) menu->setItemEnabled( id, false ); if ( !d->whatsThis().isEmpty() ) menu->setWhatsThis( id, whatsThisWithIcon() ); addContainer( menu, id ); connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); if ( m_parentCollection ) m_parentCollection->connectHighlight( menu, this ); return d->m_containers.count() - 1; } else if ( ::qt_cast<KToolBar *>( w ) ) { KToolBar *bar = static_cast<KToolBar *>( w ); int id_ = getToolButtonID(); KInstance *instance; if ( m_parentCollection ) instance = m_parentCollection->instance(); else instance = KGlobal::instance(); if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly { bar->insertButton( iconSet().pixmap(), id_, SIGNAL( buttonClicked(int, Qt::ButtonState) ), this, SLOT( slotButtonClicked(int, Qt::ButtonState) ), d->isEnabled(), d->plainText(), index ); } else {