本文整理汇总了C++中KToolBar::addSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ KToolBar::addSeparator方法的具体用法?C++ KToolBar::addSeparator怎么用?C++ KToolBar::addSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KToolBar
的用法示例。
在下文中一共展示了KToolBar::addSeparator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
DataOutputWidget::DataOutputWidget(QWidget *parent)
: QWidget(parent)
, m_model(new DataOutputModel(this))
, m_view(new DataOutputView(this))
, m_isEmpty(true)
{
m_view->setModel(m_model);
QHBoxLayout *layout = new QHBoxLayout(this);
m_dataLayout = new QVBoxLayout();
KToolBar *toolbar = new KToolBar(this);
toolbar->setOrientation(Qt::Vertical);
toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
toolbar->setIconSize(QSize(16, 16));
/// TODO: disable actions if no results are displayed or selected
KAction *action;
action = new KAction( KIcon("distribute-horizontal-x"), i18nc("@action:intoolbar", "Resize columns to contents"), this);
toolbar->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(resizeColumnsToContents()));
action = new KAction( KIcon("distribute-vertical-y"), i18nc("@action:intoolbar", "Resize rows to contents"), this);
toolbar->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(resizeRowsToContents()));
action = new KAction( KIcon("edit-copy"), i18nc("@action:intoolbar", "Copy"), this);
toolbar->addAction(action);
m_view->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(slotCopySelected()));
action = new KAction( KIcon("document-export-table"), i18nc("@action:intoolbar", "Export..."), this);
toolbar->addAction(action);
m_view->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(slotExport()));
action = new KAction( KIcon("edit-clear"), i18nc("@action:intoolbar", "Clear"), this);
toolbar->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(clearResults()));
toolbar->addSeparator();
KToggleAction *toggleAction = new KToggleAction( KIcon("applications-education-language"), i18nc("@action:intoolbar", "Use system locale"), this);
toolbar->addAction(toggleAction);
connect(toggleAction, SIGNAL(triggered()), this, SLOT(slotToggleLocale()));
m_dataLayout->addWidget(m_view);
layout->addWidget(toolbar);
layout->addLayout(m_dataLayout);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
}
示例2: KVBox
Playlist::Widget::Widget( QWidget* parent )
: KVBox( parent )
{
setContentsMargins( 1, 1, 1, 1 );
m_searchWidget = new ProgressiveSearchWidget( this );
//this is really only useful for debugging at the moment, so dont show it to users and testers
/*m_sortBox = new QComboBox( this );
m_sortBox->insertItem( 0, "Album", Album);
m_sortBox->insertItem( 1, "AlbumArtist", Album);
m_sortBox->insertItem( 2, "Artist", Artist );
m_sortBox->insertItem( 3, "Bitrate", Bitrate );
m_sortBox->insertItem( 4, "Bpm", Bpm );
m_sortBox->insertItem( 5, "Comment", Comment );
m_sortBox->insertItem( 6, "Composer", Composer );
m_sortBox->insertItem( 7, "Directory", Directory );
m_sortBox->insertItem( 8, "DiscNumber", DiscNumber );
m_sortBox->insertItem( 9, "Filename", Filename );
m_sortBox->insertItem( 10, "Filesize", Filesize );
m_sortBox->insertItem( 11, "Genre", Genre );
m_sortBox->insertItem( 12, "LastPlayed", LastPlayed );
m_sortBox->insertItem( 13, "Length", Length );
m_sortBox->insertItem( 14, "Mood", Mood );
m_sortBox->insertItem( 15, "PlayCount", PlayCount );
m_sortBox->insertItem( 16, "Rating", Rating );
m_sortBox->insertItem( 17, "SampleRate", SampleRate );
m_sortBox->insertItem( 18, "Score", Score );
m_sortBox->insertItem( 29, "Source", Source );
m_sortBox->insertItem( 30, "Title", Title );
m_sortBox->insertItem( 31, "TrackNumber", TrackNumber );
m_sortBox->insertItem( 32, "Type", Type );
m_sortBox->insertItem( 33, "Year", Year );
connect( m_sortBox, SIGNAL( activated( int ) ), this, SLOT( sort( int ) ) );*/
QWidget * layoutHolder = new QWidget( this );
QVBoxLayout* mainPlaylistlayout = new QVBoxLayout( layoutHolder );
mainPlaylistlayout->setContentsMargins( 0, 0, 0, 0 );
m_playlistView = new PrettyListView( this );
m_playlistView->show();
connect( m_searchWidget, SIGNAL( filterChanged( const QString &, int, bool ) ), m_playlistView, SLOT( find( const QString &, int, bool ) ) );
connect( m_searchWidget, SIGNAL( next( const QString &, int ) ), m_playlistView, SLOT( findNext( const QString &, int ) ) );
connect( m_searchWidget, SIGNAL( previous( const QString &, int ) ), m_playlistView, SLOT( findPrevious( const QString &, int ) ) );
connect( m_searchWidget, SIGNAL( filterCleared() ), m_playlistView, SLOT( clearSearchTerm() ) );
connect( m_searchWidget, SIGNAL( showOnlyMatches( bool ) ), m_playlistView, SLOT( showOnlyMatches( bool ) ) );
connect( m_searchWidget, SIGNAL( activateFilterResult() ), m_playlistView, SLOT( playFirstSelected() ) );
connect( m_searchWidget, SIGNAL( downPressed() ), m_playlistView, SLOT( setFocus() ) );
connect( m_playlistView, SIGNAL( found() ), m_searchWidget, SLOT( match() ) );
connect( m_playlistView, SIGNAL( notFound() ), m_searchWidget, SLOT( noMatch() ) );
connect( LayoutManager::instance(), SIGNAL( activeLayoutChanged() ), m_playlistView, SLOT( reset() ) );
mainPlaylistlayout->setSpacing( 0 );
mainPlaylistlayout->addWidget( m_playlistView );
KHBox *barBox = new KHBox( this );
barBox->setMargin( 0 );
KToolBar *plBar = new Amarok::ToolBar( barBox );
plBar->setObjectName( "PlaylistToolBar" );
Model::instance();
// the Controller ctor creates the undo/redo actions that we use below, so we want
// to make sure that it's been constructed and the the actions registered
Controller::instance();
{
//START Playlist toolbar
plBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
plBar->setIconDimensions( 22 );
plBar->setMovable( false );
plBar->addAction( new KToolBarSpacerAction( this ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_clear" ) );
//FIXME this action should go in ActionController, but we don't have any visibility to the view
KAction *action = new KAction( KIcon( "music-amarok" ), i18n("Show active track"), this );
connect( action, SIGNAL( triggered( bool ) ), m_playlistView, SLOT( scrollToActiveTrack() ) );
plBar->addAction( action );
plBar->addSeparator();
plBar->addAction( Amarok::actionCollection()->action( "playlist_undo" ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_redo" ) );
plBar->addSeparator();
plBar->addAction( Amarok::actionCollection()->action( "playlist_save" ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_export" ) );
plBar->addSeparator();
Playlist::LayoutConfigAction *layoutConfigAction = new Playlist::LayoutConfigAction( this );
plBar->addAction( layoutConfigAction );
QToolButton *tbutton = qobject_cast<QToolButton*>(plBar->widgetForAction( layoutConfigAction ) );
if( tbutton )
tbutton->setPopupMode( QToolButton::InstantPopup );
//.........这里部分代码省略.........