本文整理汇总了C++中KToolBar::setStretchableWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KToolBar::setStretchableWidget方法的具体用法?C++ KToolBar::setStretchableWidget怎么用?C++ KToolBar::setStretchableWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KToolBar
的用法示例。
在下文中一共展示了KToolBar::setStretchableWidget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
KWDocStruct::KWDocStruct(QWidget* parent, KWDocument* doc, KWGUI* gui)
: QWidget(parent), m_doc(doc), m_gui(gui)
{
m_layout = new QVBoxLayout( this );
KToolBar* searchBar = new KToolBar( this );
searchBar->setFlat( true );
searchBar->setMovingEnabled( false );
KToolBarButton* eraseButton = new KToolBarButton( "locationbar_erase", 0, searchBar );
m_tree = new KWDocStructTree( this, doc, gui );
m_tree->setAlternateBackground( KGlobalSettings::alternateBackgroundColor() );
KListViewSearchLine* searchLine = new KListViewSearchLine( searchBar, m_tree );
searchBar->setStretchableWidget( searchLine );
connect( eraseButton, SIGNAL( clicked() ), searchLine, SLOT( clear() ) );
m_layout->addWidget(searchBar);
m_layout->addWidget(m_tree);
m_tree->setup();
dirtyTreeTypes = 0;
}
示例2: init
/**
* This function will intialize the playlist window.
*/
void PlaylistWindow::init()
{
DEBUG_BLOCK
//this function is necessary because amaroK::actionCollection() returns our actionCollection
//via the App::m_pPlaylistWindow pointer since App::m_pPlaylistWindow is not defined until
//the above ctor returns it causes a crash unless we do the initialisation in 2 stages.
m_browsers = new BrowserBar( this );
//<Dynamic Mode Status Bar />
DynamicBar *dynamicBar = new DynamicBar( m_browsers->container());
{ //<Search LineEdit>
KToolBar *bar = new KToolBar( m_browsers->container(), "NotMainToolBar" );
bar->setIconSize( 22, false ); //looks more sensible
bar->setFlat( true ); //removes the ugly frame
bar->setMovingEnabled( false ); //removes the ugly frame
QWidget *button = new KToolBarButton( "locationbar_erase", 1, bar );
QLabel *filter_label = new QLabel( i18n("S&earch:") + " ", bar );
m_lineEdit = new ClickLineEdit( i18n( "Enter search terms here" ), bar );
filter_label->setBuddy( m_lineEdit );
bar->setStretchableWidget( m_lineEdit );
m_lineEdit->setFrame( QFrame::Sunken );
m_lineEdit->installEventFilter( this ); //we intercept keyEvents
connect( button, SIGNAL(clicked()), m_lineEdit, SLOT(clear()) );
QToolTip::add( button, i18n( "Clear filter" ) );
QString filtertip = i18n( "Enter space-separated terms to filter the playlist.\n\n"
"Advanced, Google-esque syntax is also available;\n"
"see the handbook (The Playlist section of chapter 4) for details." );
QToolTip::add( filter_label, filtertip );
QToolTip::add( m_lineEdit, filtertip );
} //</Search LineEdit>
QFrame *playlist = new Playlist( m_browsers->container() );
dynamicBar->init();
m_toolbar = new amaroK::ToolBar( m_browsers->container(), "mainToolBar" );
m_toolbar->setShown( AmarokConfig::showToolbar() );
QWidget *statusbar = new amaroK::StatusBar( this );
KAction* repeatAction = amaroK::actionCollection()->action( "repeat" );
connect( repeatAction, SIGNAL( activated( int ) ), playlist, SLOT( slotRepeatTrackToggled( int ) ) );
connect( m_lineEdit, SIGNAL(textChanged( const QString& )), playlist, SLOT(setFilterSlot( const QString& )) );
m_menubar = new KMenuBar( this );
m_menubar->setShown( AmarokConfig::showMenuBar() );
//BEGIN Actions menu
KPopupMenu *actionsMenu = new KPopupMenu( m_menubar );
actionCollection()->action("playlist_playmedia")->plug( actionsMenu );
actionCollection()->action("play_audiocd")->plug( actionsMenu );
actionsMenu->insertSeparator();
actionCollection()->action("prev")->plug( actionsMenu );
actionCollection()->action("play_pause")->plug( actionsMenu );
actionCollection()->action("stop")->plug( actionsMenu );
actionCollection()->action("next")->plug( actionsMenu );
actionsMenu->insertSeparator();
actionCollection()->action(KStdAction::name(KStdAction::Quit))->plug( actionsMenu );
connect( actionsMenu, SIGNAL( aboutToShow() ), SLOT( actionsMenuAboutToShow() ) );
//END Actions menu
//BEGIN Playlist menu
KPopupMenu *playlistMenu = new KPopupMenu( m_menubar );
actionCollection()->action("playlist_add")->plug( playlistMenu );
actionCollection()->action("playlist_save")->plug( playlistMenu );
playlistMenu->insertSeparator();
actionCollection()->action("playlist_undo")->plug( playlistMenu );
actionCollection()->action("playlist_redo")->plug( playlistMenu );
playlistMenu->insertSeparator();
actionCollection()->action("playlist_clear")->plug( playlistMenu );
actionCollection()->action("playlist_shuffle")->plug( playlistMenu );
actionCollection()->action("playlist_show")->plug( playlistMenu );
//this one has no real context with regard to the menu
//actionCollection()->action("playlist_copy")->plug( playlistMenu );
playlistMenu->insertSeparator();
actionCollection()->action("queue_selected")->plug( playlistMenu );
actionCollection()->action("playlist_remove_duplicates")->plug( playlistMenu );
actionCollection()->action("playlist_select_all")->plug( playlistMenu );
//END Playlist menu
//BEGIN Mode menu
KPopupMenu *modeMenu = new KPopupMenu( m_menubar );
actionCollection()->action("repeat")->plug( modeMenu );
KSelectAction *random = static_cast<KSelectAction*>( actionCollection()->action("random_mode") );
random->plug( modeMenu );
random->popupMenu()->insertSeparator();
actionCollection()->action("favor_tracks")->plug( random->popupMenu() );
//.........这里部分代码省略.........
示例3: KMainWindow
KEBApp::KEBApp(const QString &bookmarksFile, bool readonly, const QString &address, bool browser, const QString &caption)
: KMainWindow(), m_dcopIface(0), m_bookmarksFilename(bookmarksFile), m_caption(caption), m_readOnly(readonly), m_browser(browser)
{
m_cmdHistory = new CmdHistory(actionCollection());
s_topLevel = this;
int h = 20;
QSplitter *vsplitter = new QSplitter(this);
KToolBar *quicksearch = new KToolBar(vsplitter, "search toolbar");
KAction *resetQuickSearch = new KAction(i18n("Reset Quick Search"), QApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0,
actionCollection(), "reset_quicksearch");
resetQuickSearch->setWhatsThis(
i18n("<b>Reset Quick Search</b><br>"
"Resets the quick search so that all bookmarks are shown again."));
resetQuickSearch->plug(quicksearch);
QLabel *lbl = new QLabel(i18n("Se&arch:"), quicksearch, "kde toolbar widget");
KListViewSearchLine *searchLineEdit = new KEBSearchLine(quicksearch, 0, "KListViewSearchLine");
quicksearch->setStretchableWidget(searchLineEdit);
lbl->setBuddy(searchLineEdit);
connect(resetQuickSearch, SIGNAL(activated()), searchLineEdit, SLOT(clear()));
connect(searchLineEdit, SIGNAL(searchUpdated()), SLOT(updateActions()));
ListView::createListViews(vsplitter);
ListView::self()->initListViews();
searchLineEdit->setListView(static_cast< KListView * >(ListView::self()->widget()));
ListView::self()->setSearchLine(searchLineEdit);
m_bkinfo = new BookmarkInfoWidget(vsplitter);
vsplitter->setOrientation(QSplitter::Vertical);
vsplitter->setSizes(QValueList< int >() << h << 380 << m_bkinfo->sizeHint().height());
setCentralWidget(vsplitter);
resize(ListView::self()->widget()->sizeHint().width(), vsplitter->sizeHint().height());
createActions();
if(m_browser)
createGUI();
else
createGUI("keditbookmarks-genui.rc");
m_dcopIface = new KBookmarkEditorIface();
connect(kapp->clipboard(), SIGNAL(dataChanged()), SLOT(slotClipboardDataChanged()));
ListView::self()->connectSignals();
KGlobal::locale()->insertCatalogue("libkonq");
m_canPaste = false;
construct();
ListView::self()->setCurrent(ListView::self()->getItemAtAddress(address), true);
setCancelFavIconUpdatesEnabled(false);
setCancelTestsEnabled(false);
updateActions();
}
示例4: if
CoverManager::CoverManager()
: QSplitter( 0, "TheCoverManager" )
, m_timer( new QTimer( this ) ) //search filter timer
, m_fetchCounter( 0 )
, m_fetchingCovers( 0 )
, m_coversFetched( 0 )
, m_coverErrors( 0 )
{
DEBUG_BLOCK
s_instance = this;
// Sets caption and icon correctly (needed e.g. for GNOME)
kapp->setTopWidget( this );
setCaption( kapp->makeStdCaption( i18n("Cover Manager") ) );
setWFlags( WDestructiveClose );
setMargin( 4 );
//artist listview
m_artistView = new KListView( this );
m_artistView->addColumn(i18n( "Albums By" ));
m_artistView->setFullWidth( true );
m_artistView->setSorting( -1 ); //no sort
m_artistView->setMinimumWidth( 180 );
KListViewItem *item = new KListViewItem( m_artistView, i18n( "All Albums" ) );
item->setPixmap( 0, SmallIcon("cdrom_unmount") );
//load artists from the collection db
const QStringList artists = CollectionDB::instance()->artistList( false, false );
foreach( artists ) {
item = new KListViewItem( m_artistView, item, *it );
item->setPixmap( 0, SmallIcon("personal") );
}
QueryBuilder qb;
qb.addReturnValue( QueryBuilder::tabAlbum, QueryBuilder::valName );
qb.setOptions( QueryBuilder::optOnlyCompilations | QueryBuilder::optRemoveDuplicates );
qb.setLimit( 0, 1 );
if ( qb.run().count() ) {
item = new KListViewItem( m_artistView, item, i18n( "Various Artists" ) );
item->setPixmap( 0, SmallIcon("personal") );
}
QVBox *vbox = new QVBox( this );
QHBox *hbox = new QHBox( vbox );
vbox->setSpacing( 4 );
hbox->setSpacing( 4 );
{ //<Search LineEdit>
QHBox *searchBox = new QHBox( hbox );
KToolBar* searchToolBar = new Browser::ToolBar( searchBox );
KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar );
m_searchEdit = new ClickLineEdit( i18n( "Filter here..." ), searchToolBar );
m_searchEdit->setFrame( QFrame::Sunken );
searchToolBar->setStretchableWidget( m_searchEdit );
connect( button, SIGNAL(clicked()), m_searchEdit, SLOT(clear()) );
QToolTip::add( button, i18n( "Clear filter" ) );
QToolTip::add( m_searchEdit, i18n( "Enter space-separated terms to filter albums" ) );
hbox->setStretchFactor( searchBox, 1 );
} //</Search LineEdit>
// view menu
m_viewMenu = new KPopupMenu( this );
m_viewMenu->insertItem( i18n("All Albums"), AllAlbums );
m_viewMenu->insertItem( i18n("Albums With Cover"), AlbumsWithCover );
m_viewMenu->insertItem( i18n("Albums Without Cover"), AlbumsWithoutCover );
m_viewMenu->setItemChecked( AllAlbums, true );
connect( m_viewMenu, SIGNAL( activated(int) ), SLOT( changeView(int) ) );
#ifdef AMAZON_SUPPORT
// amazon locale menu
m_amazonLocaleMenu = new KPopupMenu( this );
m_amazonLocaleMenu->insertItem( i18n("International"), International );
m_amazonLocaleMenu->insertItem( i18n("Canada"), Canada );
m_amazonLocaleMenu->insertItem( i18n("France"), France );
m_amazonLocaleMenu->insertItem( i18n("Germany"), Germany );
m_amazonLocaleMenu->insertItem( i18n("Japan"), Japan);
m_amazonLocaleMenu->insertItem( i18n("United Kingdom"), UK );
connect( m_amazonLocaleMenu, SIGNAL( activated(int) ), SLOT( changeLocale(int) ) );
#endif
KToolBar* toolBar = new KToolBar( hbox );
toolBar->setIconText( KToolBar::IconTextRight );
toolBar->setFrameShape( QFrame::NoFrame );
toolBar->insertButton( "view_choose", 1, m_viewMenu, true, i18n( "View" ) );
#ifdef AMAZON_SUPPORT
const QString babelfish = locate( "data", QString( "amarok/images/babelfish.png" ) );
toolBar->insertButton( babelfish, 2, m_amazonLocaleMenu, true, i18n( "Amazon Locale" ) );
QString locale = AmarokConfig::amazonLocale();
if( locale == "fr" ) m_currentLocale = France;
else if( locale == "de" ) m_currentLocale = Germany;
else if( locale == "jp" ) m_currentLocale = Japan;
else if( locale == "uk" ) m_currentLocale = UK;
else if( locale == "ca" ) m_currentLocale = Canada;
else {
//.........这里部分代码省略.........
示例5: 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();
//.........这里部分代码省略.........