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


C++ KToolBar::insertButton方法代码示例

本文整理汇总了C++中KToolBar::insertButton方法的典型用法代码示例。如果您正苦于以下问题:C++ KToolBar::insertButton方法的具体用法?C++ KToolBar::insertButton怎么用?C++ KToolBar::insertButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KToolBar的用法示例。


在下文中一共展示了KToolBar::insertButton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: KonqSidebarPlugin

UniversalPana::UniversalPana(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName, const char* name):
                   KonqSidebarPlugin(inst,parent,widgetParent,desktopName,name)
{
    KGlobal::iconLoader()->addAppDir( "pana" );
    widget = new panaWidget( widgetParent );
//    widgetParent->resize(580,300);
    KToolBar *topBar = new KToolBar( widget, "Topbar" );
    topBar->setIconSize(16);
    topBar->insertButton( "today",    0, SIGNAL( clicked() ), this, SLOT( currentTrack() ) );
    topBar->insertButton( "document", 0, SIGNAL( clicked() ), this, SLOT( lyrics() ) );
    topBar->insertButton( "personal", 0, SIGNAL( clicked() ), this, SLOT( wiki() ) );

    browser = new KHTMLPart(widget, "widget-browser");
//browser=new KHTMLPart(widget);
    kdDebug() << "parentPart() << " << browser->parentPart() << endl;
    browser->setDNDEnabled( true );
    browser->setEncoding( "utf8", true );
    updateBrowser( HTML_FILE );
    browser->view()->installEventFilter( widget );
    panaDCOP = new DCOPClient();
    panaDCOP->attach();

    playerStub   = new PanaPlayerInterface_stub( panaDCOP, "pana", "player");
    playlistStub = new PanaPlaylistInterface_stub( panaDCOP, "pana", "playlist");
    contextStub = new PanaContextBrowserInterface_stub (panaDCOP, "pana", "contextbrowser");

    KToolBar* toolBar=new KToolBar(widget, "PlayerControls");

    toolBar->setIconSize(16);
    toolBar->insertButton( "player_start",0, SIGNAL( clicked() ), this, SLOT( sendPrev() ) );
    toolBar->insertButton( "player_play", 0, SIGNAL( clicked() ), this, SLOT( sendPlay() ) );
    toolBar->insertButton( "player_pause",0, SIGNAL( clicked() ), this, SLOT( sendPause() ) );
    toolBar->insertButton( "player_stop", 0, SIGNAL( clicked() ), this, SLOT( sendStop() ) );
    toolBar->insertButton( "player_end",  0, SIGNAL( clicked() ), this, SLOT( sendNext() ) );

    toolBar->insertSeparator();
    toolBar->insertButton( "arts",        0, SIGNAL( clicked() ), this, SLOT( sendMute() ) );

    vol_slider = new QSlider(0,100,1,0,Qt::Horizontal, toolBar,"volume");
    vol_slider->setLineStep(2);

    connect(vol_slider, SIGNAL( valueChanged(int) ), this, SLOT(volChanged(int ) ) );
    toolBar->insertWidget(1,2, vol_slider);

    fileInfo  = new QFileInfo(HTML_FILE);
    QTimer *t = new QTimer( this );

    connect( t, SIGNAL(timeout()), SLOT(updateStatus() ) );
    t->start( 2000, false );
    kdDebug() << "Connecting widget signal" << endl;

    connect( widget,                      SIGNAL( emitURL( const KURL &)),
             this,                        SLOT( openURLRequest( const KURL &) ) );
    connect( browser->browserExtension(), SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ),
             this,                        SLOT( openURLRequest( const KURL & ) ) );
    widget->show();
}
开发者ID:delight,项目名称:Pana,代码行数:57,代码来源:universalpana.cpp

示例2: createToolbar

void KHelpMain::createToolbar()
{
	QPixmap pixmap;
	QString pmpath;

	KToolBar *tb = new KToolBar( this );


	pixmap = kapp->getIconLoader()->loadIcon( "back.xpm" );
	tb->insertButton(pixmap, 0, SIGNAL( clicked() ),
		    helpwin, SLOT( slotBack() ),
		    FALSE, klocale->translate("Previous Document"));

	pixmap = kapp->getIconLoader()->loadIcon( "forward.xpm" );
	tb->insertButton(pixmap, 1, SIGNAL( clicked() ),
		    helpwin, SLOT( slotForward() ),
		    FALSE, klocale->translate("Next Document"));

	tb->insertSeparator();

	pixmap = kapp->getIconLoader()->loadIcon( "prev.xpm" );
	tb->insertButton(pixmap, 2, SIGNAL( clicked() ),
		    helpwin, SLOT( slotPrev() ),
		    FALSE, klocale->translate("Previous Node"));

	pixmap = kapp->getIconLoader()->loadIcon( "next.xpm" );
	tb->insertButton(pixmap, 3, SIGNAL( clicked() ),
		    helpwin, SLOT( slotNext() ),
		    FALSE, klocale->translate("Next Node"));

	pixmap = kapp->getIconLoader()->loadIcon( "up.xpm" );
	tb->insertButton(pixmap, 4, SIGNAL( clicked() ),
		    helpwin, SLOT( slotUp() ),
		    FALSE,klocale->translate( "Up one Node"));

	pixmap = kapp->getIconLoader()->loadIcon( "top.xpm" );
	tb->insertButton(pixmap, 5, SIGNAL( clicked() ),
		    helpwin, SLOT( slotTop() ),
		    FALSE, klocale->translate("Top Node"));

	tb->insertSeparator();

	pixmap = kapp->getIconLoader()->loadIcon( "contents.xpm" );
	tb->insertButton(pixmap, 6, SIGNAL( clicked() ),
		    helpwin, SLOT( slotDir() ),
		    FALSE, klocale->translate("Help Contents"));

	pixmap = kapp->getIconLoader()->loadIcon( "reload.xpm" );
	tb->insertButton(pixmap, 7, SIGNAL( clicked() ),
		helpwin, SLOT( slotReload() ),
		TRUE, klocale->translate( "Reload current document" ) );

	pixmap = kapp->getIconLoader()->loadIcon( "stop.xpm" );
	tb->insertButton(pixmap, 8, SIGNAL( clicked() ),
		    helpwin, SLOT( slotStopProcessing() ),
		    FALSE, klocale->translate("Stop"));

	tb->setBarPos( KToolBar::Top );
	toolbar = tb;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:60,代码来源:mainwidget.cpp

示例3: KMainWindow

MainWindow::MainWindow( QWidget* parent, const char *name, WFlags f )
    : KMainWindow( parent, name, f )
{
  KToolBar *toolBar = new KToolBar( this );
  toolBar->insertButton("fileopen", Add, true, i18n("Add") );
  toolBar->insertButton("no", Remove, true, i18n("Remove") );
  toolBar->insertButton("reload", Refresh, true, i18n("Refresh") );
  connect( toolBar, SIGNAL(clicked(int)), this, SLOT(toolButton(int)) );

  m_list = new KListBox( this );
  setCentralWidget(m_list);
  
  m_pluginManager = new PluginManager;
  m_list->insertStringList(m_pluginManager->items());
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:15,代码来源:mainwindow.cpp

示例4: containerCount

int
MenuAction::plug( QWidget *w, int index )
{
    KToolBar *bar = dynamic_cast<KToolBar*>(w);

    if( bar && kapp->authorizeKAction( name() ) )
    {
        const int id = KAction::getToolButtonID();

        addContainer( bar, id );
        connect( bar, SIGNAL( destroyed() ), SLOT( slotDestroyed() ) );

        //TODO create menu on demand
        //TODO create menu above and aligned within window
        //TODO make the arrow point upwards!
        bar->insertButton( QString::null, id, true, i18n( "Menu" ), index );
        bar->alignItemRight( id );

        KToolBarButton* button = bar->getButton( id );
        button->setPopup( Amarok::Menu::instance() );
        button->setName( "toolbutton_amarok_menu" );
        button->setIcon( "amarok" );

        return containerCount() - 1;
    }
    else return -1;
}
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:27,代码来源:actionclasses.cpp

示例5: 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 {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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