本文整理汇总了C++中KPushButton::setMenu方法的典型用法代码示例。如果您正苦于以下问题:C++ KPushButton::setMenu方法的具体用法?C++ KPushButton::setMenu怎么用?C++ KPushButton::setMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPushButton
的用法示例。
在下文中一共展示了KPushButton::setMenu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initUi
void TwitterPostWidget::initUi()
{
TwitterApiPostWidget::initUi();
KPushButton *btn = buttons().value("btnResend");
if(btn){
QMenu *menu = new QMenu(btn);
QAction *resend = new QAction(i18n("Manual ReSend"), menu);
connect( resend, SIGNAL(triggered(bool)), SLOT(slotResendPost()) );
QAction *repeat = new QAction(i18n("Retweet"), menu);
repeat->setToolTip(i18n("Retweet post using API"));
connect( repeat, SIGNAL(triggered(bool)), SLOT(repeatPost()) );
// If person protects their acc, we will use simple adding RT before message
if (!currentPost().author.isProtected)
menu->addAction(repeat);
menu->addAction(resend);
btn->setMenu(menu);
}
}
示例2: firstRunQuery
CoverFoundDialog::CoverFoundDialog( const CoverFetchUnit::Ptr unit,
const CoverFetch::Metadata &data,
QWidget *parent )
: KDialog( parent )
, m_album( unit->album() )
, m_isSorted( false )
, m_sortEnabled( false )
, m_unit( unit )
, m_queryPage( 0 )
{
DEBUG_BLOCK
setButtons( KDialog::Ok | KDialog::Cancel |
KDialog::User1 ); // User1: clear icon view
setButtonGuiItem( KDialog::User1, KStandardGuiItem::clear() );
connect( button( KDialog::User1 ), SIGNAL(clicked()), SLOT(clearView()) );
m_save = button( KDialog::Ok );
QSplitter *splitter = new QSplitter( this );
m_sideBar = new CoverFoundSideBar( m_album, splitter );
KVBox *vbox = new KVBox( splitter );
vbox->setSpacing( 4 );
KHBox *breadcrumbBox = new KHBox( vbox );
QLabel *breadcrumbLabel = new QLabel( i18n( "Finding cover for" ), breadcrumbBox );
AlbumBreadcrumbWidget *breadcrumb = new AlbumBreadcrumbWidget( m_album, breadcrumbBox );
QFont breadcrumbLabelFont;
breadcrumbLabelFont.setBold( true );
breadcrumbLabel->setFont( breadcrumbLabelFont );
breadcrumbLabel->setIndent( 4 );
connect( breadcrumb, SIGNAL(artistClicked(const QString&)), SLOT(addToCustomSearch(const QString&)) );
connect( breadcrumb, SIGNAL(albumClicked(const QString&)), SLOT(addToCustomSearch(const QString&)) );
KHBox *searchBox = new KHBox( vbox );
vbox->setSpacing( 4 );
QStringList completionNames;
QString firstRunQuery( m_album->name() );
completionNames << firstRunQuery;
if( m_album->hasAlbumArtist() )
{
const QString &name = m_album->albumArtist()->name();
completionNames << name;
firstRunQuery += ' ' + name;
}
m_query = firstRunQuery;
m_album->setSuppressImageAutoFetch( true );
m_search = new KComboBox( searchBox );
m_search->setEditable( true ); // creates a KLineEdit for the combobox
m_search->setTrapReturnKey( true );
m_search->setInsertPolicy( QComboBox::NoInsert ); // insertion is handled by us
m_search->setCompletionMode( KGlobalSettings::CompletionPopup );
m_search->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
qobject_cast<KLineEdit*>( m_search->lineEdit() )->setClickMessage( i18n( "Enter Custom Search" ) );
m_search->completionObject()->setOrder( KCompletion::Insertion );
m_search->completionObject()->setIgnoreCase( true );
m_search->completionObject()->setItems( completionNames );
m_search->insertItem( 0, KStandardGuiItem::find().icon(), QString() );
m_search->insertSeparator( 1 );
m_search->insertItem( 2, KIcon("filename-album-amarok"), m_album->name() );
if( m_album->hasAlbumArtist() )
m_search->insertItem( 3, KIcon("filename-artist-amarok"), m_album->albumArtist()->name() );
m_searchButton = new KPushButton( KStandardGuiItem::find(), searchBox );
KPushButton *sourceButton = new KPushButton( KStandardGuiItem::configure(), searchBox );
updateSearchButton( firstRunQuery );
QMenu *sourceMenu = new QMenu( sourceButton );
QAction *lastFmAct = new QAction( i18n( "Last.fm" ), sourceMenu );
QAction *googleAct = new QAction( i18n( "Google" ), sourceMenu );
QAction *yahooAct = new QAction( i18n( "Yahoo!" ), sourceMenu );
QAction *discogsAct = new QAction( i18n( "Discogs" ), sourceMenu );
lastFmAct->setCheckable( true );
googleAct->setCheckable( true );
yahooAct->setCheckable( true );
discogsAct->setCheckable( true );
connect( lastFmAct, SIGNAL(triggered()), this, SLOT(selectLastFm()) );
connect( googleAct, SIGNAL(triggered()), this, SLOT(selectGoogle()) );
connect( yahooAct, SIGNAL(triggered()), this, SLOT(selectYahoo()) );
connect( discogsAct, SIGNAL(triggered()), this, SLOT(selectDiscogs()) );
m_sortAction = new QAction( i18n( "Sort by size" ), sourceMenu );
m_sortAction->setCheckable( true );
connect( m_sortAction, SIGNAL(triggered(bool)), this, SLOT(sortingTriggered(bool)) );
QActionGroup *ag = new QActionGroup( sourceButton );
ag->addAction( lastFmAct );
ag->addAction( googleAct );
ag->addAction( yahooAct );
ag->addAction( discogsAct );
sourceMenu->addActions( ag->actions() );
sourceMenu->addSeparator();
sourceMenu->addAction( m_sortAction );
sourceButton->setMenu( sourceMenu );
//.........这里部分代码省略.........