当前位置: 首页>>代码示例>>C++>>正文


C++ KPopupMenu::setCheckable方法代码示例

本文整理汇总了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);
}
开发者ID:BackupTheBerlios,项目名称:irate-svn,代码行数:31,代码来源:songlist.cpp

示例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)));
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:42,代码来源:icnview.cpp


注:本文中的KPopupMenu::setCheckable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。