本文整理汇总了C++中KPopupMenu::setCheckable方法的典型用法代码示例。如果您正苦于以下问题:C++ KPopupMenu::setCheckable方法的具体用法?C++ KPopupMenu::setCheckable怎么用?C++ KPopupMenu::setCheckable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPopupMenu
的用法示例。
在下文中一共展示了KPopupMenu::setCheckable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventFilter
//Credit to amaroK for this
//Seems like it can become the next plugin to do since amarok is really cool (just missing plugin arch)
bool SongList::eventFilter(QObject *o, QEvent *e ) {
if(o == header() && e->type() == QEvent::MouseButtonPress && static_cast<QMouseEvent*>(e)->button() == Qt::RightButton ) {
KPopupMenu popup;
//popup.setFont(this->font());
popup.setCheckable(true);
popup.insertTitle(i18n("Available Columns"));
int colcount=columns();
for( int i = 0; i < colcount; ++i ) //columns() references a property
{
popup.insertItem(columnText(i),i,i+1 );
popup.setItemChecked(i,columnWidth(i)!=0);
}
int col = popup.exec( static_cast<QMouseEvent *>(e)->globalPos() );
if( col != -1 ) {
//TODO can result in massively wide column appearing!
if( columnWidth( col ) == 0 ) {
adjustColumn( col );
header()->setResizeEnabled( true, col );
} else hideColumn( col );
}
//determine first visible column again, since it has changed
//eat event
return TRUE;
}
return KListView::eventFilter(o,e);
}
示例2: ItemView
ICNView::ICNView(ICNDocument *icnDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name)
: ItemView(icnDocument, viewContainer, viewAreaId, name) {
bool manualRouting = (icnDocument->m_cmManager->cmState() & CMManager::cms_manual_route);
KActionCollection * ac = actionCollection();
//BEGIN Routing Actions
// These actions get inserted into the main menu
m_pAutoRoutingAction = new KRadioAction(i18n("Automatic"), "", 0, this, SLOT(slotSetRoutingAuto()), ac, "routing_mode_auto");
m_pAutoRoutingAction->setExclusiveGroup("routing_mode");
if (!manualRouting)
m_pAutoRoutingAction->setChecked(true);
m_pManualRoutingAction = new KRadioAction(i18n("Manual"), "", 0, this, SLOT(slotSetRoutingManual()), ac, "routing_mode_manual");
m_pManualRoutingAction->setExclusiveGroup("routing_mode");
if (manualRouting)
m_pManualRoutingAction->setChecked(true);
// This popup gets inserted into the toolbar
m_pRoutingModeToolbarPopup = new KToolBarPopupAction(i18n("Connection Routing Mode"), "pencil", 0, 0, 0, ac, "routing_mode");
m_pRoutingModeToolbarPopup->setDelayed(false);
KPopupMenu *m = m_pRoutingModeToolbarPopup->popupMenu();
m->insertTitle(i18n("Connection Routing Mode"));
m->insertItem(/*KGlobal::iconLoader()->loadIcon( "routing_mode_auto", KIcon::Small ), */i18n("Automatic"), 0);
m->insertItem(/*KGlobal::iconLoader()->loadIcon( "routing_mode_manual", KIcon::Small ),*/ i18n("Manual"), 1);
m->setCheckable(true);
m->setItemChecked(manualRouting ? 1 : 0, true);
connect(m, SIGNAL(activated(int)), this, SLOT(slotSetRoutingMode(int)));
//END Routing Actions
connect(icnDocument->m_cmManager, SIGNAL(manualRoutingChanged(bool)), this, SLOT(slotUpdateRoutingToggles(bool)));
}