本文整理汇总了C++中KActionMenu::popupMenu方法的典型用法代码示例。如果您正苦于以下问题:C++ KActionMenu::popupMenu方法的具体用法?C++ KActionMenu::popupMenu怎么用?C++ KActionMenu::popupMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KActionMenu
的用法示例。
在下文中一共展示了KActionMenu::popupMenu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initGUI
// TODO convert to use xmlui file
void KuickShow::initGUI( const KURL& startDir )
{
KURL startURL( startDir );
if ( !KProtocolInfo::supportsListing( startURL ) )
startURL = KURL();
fileWidget = new FileWidget( startURL, this, "MainWidget" );
setFocusProxy( fileWidget );
KActionCollection *coll = fileWidget->actionCollection();
redirectDeleteAndTrashActions(coll);
connect( fileWidget, SIGNAL( fileSelected( const KFileItem * ) ),
this, SLOT( slotSelected( const KFileItem * ) ));
connect( fileWidget, SIGNAL( fileHighlighted( const KFileItem * )),
this, SLOT( slotHighlighted( const KFileItem * ) ));
connect( fileWidget, SIGNAL( urlEntered( const KURL& )),
this, SLOT( dirSelected( const KURL& )) );
fileWidget->setAcceptDrops(true);
connect( fileWidget, SIGNAL( dropped( const KFileItem *, QDropEvent *, const KURL::List & )),
this, SLOT( slotDropped( const KFileItem *, QDropEvent *, const KURL::List &)) );
// setup actions
KAction *open = KStdAction::open( this, SLOT( slotOpenURL() ),
coll, "openURL" );
KAction *print = KStdAction::print( this, SLOT( slotPrint() ),
coll, "kuick_print" );
print->setText( i18n("Print Image...") );
KAction *configure = new KAction( i18n("Configure %1...").arg( KGlobal::instance()->aboutData()->programName() ), "configure",
KShortcut(),
this, SLOT( configuration() ),
coll, "kuick_configure" );
KAction *slide = new KAction( i18n("Start Slideshow" ), "ksslide",
KShortcut( Key_F2 ),
this, SLOT( startSlideShow() ),
coll, "kuick_slideshow" );
KAction *about = new KAction( i18n( "About KuickShow" ), "about",
KShortcut(),
this, SLOT( about() ), coll, "about" );
oneWindowAction = new KToggleAction( i18n("Open Only One Image Window"),
"window_new",
KShortcut( CTRL+Key_N ), coll,
"kuick_one window" );
m_toggleBrowserAction = new KToggleAction( i18n("Show File Browser"), KShortcut( Key_Space ), coll, "toggleBrowser" );
m_toggleBrowserAction->setCheckedState(i18n("Hide File Browser"));
connect( m_toggleBrowserAction, SIGNAL( toggled( bool ) ),
SLOT( toggleBrowser() ));
KAction *showInOther = new KAction( i18n("Show Image"), KShortcut(),
this, SLOT( slotShowInOtherWindow() ),
coll, "kuick_showInOtherWindow" );
KAction *showInSame = new KAction( i18n("Show Image in Active Window"),
KShortcut(),
this, SLOT( slotShowInSameWindow() ),
coll, "kuick_showInSameWindow" );
KAction *showFullscreen = new KAction( i18n("Show Image in Fullscreen Mode"),
KShortcut(), this, SLOT( slotShowFullscreen() ),
coll, "kuick_showFullscreen" );
KAction *quit = KStdAction::quit( this, SLOT(slotQuit()), coll, "quit");
// remove QString::null parameter -- ellis
coll->readShortcutSettings( QString::null );
m_accel = coll->accel();
// menubar
KMenuBar *mBar = menuBar();
QPopupMenu *fileMenu = new QPopupMenu( mBar, "file" );
open->plug( fileMenu );
showInOther->plug( fileMenu );
showInSame->plug( fileMenu );
showFullscreen->plug( fileMenu );
fileMenu->insertSeparator();
slide->plug( fileMenu );
print->plug( fileMenu );
fileMenu->insertSeparator();
quit->plug( fileMenu );
QPopupMenu *editMenu = new QPopupMenu( mBar, "edit" );
coll->action("mkdir")->plug( editMenu );
coll->action("delete")->plug( editMenu );
editMenu->insertSeparator();
coll->action("properties")->plug( editMenu );
// remove the Sorting submenu (and the separator below)
// from the main contextmenu
KActionMenu *sortingMenu = static_cast<KActionMenu*>( coll->action("sorting menu"));
KActionMenu *mainActionMenu = static_cast<KActionMenu*>( coll->action("popupMenu"));
QPopupMenu *mainPopup = mainActionMenu->popupMenu();
//.........这里部分代码省略.........
示例2: KBookmarkHandler
FileBrowser::FileBrowser( const char * name, Medium * medium )
: QVBox( 0, name )
{
KActionCollection *actionCollection;
SearchPane *searchPane;
KURL *location;
// Try to keep filebrowser working even if not in a medium context
// so if a medium object not passed in, keep earlier behavior
if (!medium) {
m_medium = 0;
location = new KURL( Pana::config( "Filebrowser" )->readPathEntry( "Location", QDir::homeDirPath() ) );
KFileItem *currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location );
//KIO sucks, NetAccess::exists puts up a dialog and has annoying error message boxes
//if there is a problem so there is no point in using it anyways.
//so... setting the diroperator to ~ is the least sucky option
if ( !location->isLocalFile() || !currentFolder->isReadable() ) {
delete location;
location = new KURL( QDir::homeDirPath() ) ;
}
}
else{
m_medium = medium;
location = new KURL( m_medium->mountPoint() );
}
KActionCollection* ac = new KActionCollection( this );
KStdAction::selectAll( this, SLOT( selectAll() ), ac, "filebrowser_select_all" );
KToolBar *toolbar = new Browser::ToolBar( this );
{ //Filter LineEdit
KToolBar* searchToolBar = new Browser::ToolBar( this );
KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar );
m_filter = new ClickLineEdit( i18n( "Enter search terms here" ), searchToolBar );
searchToolBar->setStretchableWidget( m_filter );
connect( button, SIGNAL(clicked()), m_filter, SLOT(clear()) );
QToolTip::add( button, i18n( "Clear search field" ) );
QToolTip::add( m_filter, i18n( "Enter space-separated terms to search in the directory-listing" ) );
}
{ //Directory Listing
QVBox *container; QHBox *box;
container = new QVBox( this );
container->setFrameStyle( m_filter->frameStyle() );
container->setMargin( 3 );
container->setSpacing( 2 );
container->setBackgroundMode( Qt::PaletteBase );
box = new QHBox( container );
box->setMargin( 3 );
box->setBackgroundMode( Qt::PaletteBase );
//folder selection combo box
m_combo = new KURLComboBox( KURLComboBox::Directories, true, box, "path combo" );
if (!m_medium){
m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) );
m_combo->setAutoDeleteCompletionObject( true );
}
m_combo->setMaxItems( 9 );
m_combo->setURLs( Pana::config( "Filebrowser" )->readPathListEntry( "Dir History" ) );
if (!m_medium)
m_combo->lineEdit()->setText( location->path() );
else
m_combo->lineEdit()->setText( "/" );
//The main widget with file listings and that
m_dir = new MyDirOperator( *location, container, m_medium );
m_dir->setEnableDirHighlighting( true );
m_dir->setMode( KFile::Mode((int)KFile::Files | (int)KFile::Directory) ); //allow selection of multiple files + dirs
m_dir->setOnlyDoubleClickSelectsFiles( true ); //Pana type settings
m_dir->readConfig( Pana::config( "Filebrowser" ) );
m_dir->setView( KFile::Default ); //will set userconfigured view, will load URL
m_dir->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
m_dir->setAcceptDrops( true );
//Automatically open folder after hovering above it...probably a good thing
//but easily disabled by commenting this line out
//Disabled for now because can't show . and .. folders.
//TODO: Find out a way to fix this?
//m_dir->setDropOptions( KFileView::AutoOpenDirs );
static_cast<QFrame*>(m_dir->viewWidget())->setFrameStyle( QFrame::NoFrame );
static_cast<QIconView*>(m_dir->viewWidget())->setSpacing( 1 );
actionCollection = m_dir->actionCollection();
searchPane = new SearchPane( this );
setStretchFactor( container, 2 );
}
{
QPopupMenu* const menu = static_cast<KActionMenu*>(actionCollection->action("popupMenu"))->popupMenu();
//.........这里部分代码省略.........