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


C++ KToolBar类代码示例

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


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

示例1: addContainer

int
StopAction::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() ) );

        bar->insertButton( QString::null, id, SIGNAL( clicked() ), EngineController::instance(), SLOT( stop() ),
                           true, i18n( "Stop" ), index );

        KToolBarButton* button = bar->getButton( id );
        button->setDelayedPopup( Amarok::StopMenu::instance() );
        button->setName( "toolbutton_stop_menu" );
        button->setIcon( Amarok::icon( "stop" ) );
        button->setEnabled( EngineController::instance()->engine()->loaded() );  // Disable button at startup

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

示例2: QObject

SxEditor::SxEditor( const QString& file, const QString& name, QObject *parent /*= NULL*/ )
: QObject(parent)
, m_szFile(file)
, m_pTextEdit(NULL)
{
	m_pWindow = KXmlUI::windowFromFile("res:/Resources/layout/sxeditor.xml");
	KXmlUI::setPropertyEx(m_pWindow, "titlebar.title", name);

	KWidget *rootWidget = m_pWindow->rootWidget();
	KToolBar *toolbar = rootWidget->findChild<KToolBar*>("edittoolbar");
	QGraphicsLinearLayout *linear = dynamic_cast<QGraphicsLinearLayout*>(toolbar->layout());
	for(int i = 0; i < linear->count(); i++)
	{
		QGraphicsLayoutItem * item = linear->itemAt(i);
		KPushButton *button = dynamic_cast<KPushButton*>(item);
		if(button)
		{
			bool bok = QObject::connect(button, SIGNAL(clicked()), this, SLOT(on_common_command_clicked()));
		}
	}

	m_pTextEdit = rootWidget->findChild<SxRichEdit*>("richtexteditor");
	QObject::connect(m_pTextEdit, SIGNAL(contextMenu(QMenu*,bool*)), this, SLOT(on_editor_contextMenu(QMenu*,bool*)));

	QFont font("SimSun", 9);
	m_pTextEdit->setFont(font);

	QPoint pt = KUtility::nextCascadesWindowPosition();
	m_pWindow->move(pt);
	m_pWindow->show();

	QObject::connect(m_pWindow, SIGNAL(aboutToClose()), this, SLOT(on_aboutToClose_triggered()));
	
	QMetaObject::invokeMethod(this, "asynOpen", Qt::QueuedConnection);
}
开发者ID:kxtry,项目名称:sxnote,代码行数:35,代码来源:sxeditor.cpp

示例3: plug

int PMSpinBoxAction::plug( QWidget* w, int index )
{
    if( !w->inherits( "KToolBar" ) )
        return -1;

    KToolBar* toolBar = ( KToolBar* ) w;

    int id = KAction::getToolButtonID( );

    QSpinBox* spinBox = new QSpinBox( -1000, 1000, 1, w );
    toolBar->insertWidget( id, 70, spinBox, index );

    connect( spinBox, SIGNAL( valueChanged( int ) ), m_receiver, m_member );

    addContainer( toolBar, id );

    connect( toolBar, SIGNAL( destroyed( ) ), this, SLOT( slotDestroyed( ) ) );
    //toolBar->setItemAutoSized( id, false );

    m_spinBox = spinBox;

    emit plugged( );

    QWhatsThis::add( spinBox, whatsThis( ) );

    return containerCount( ) - 1;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例4: parentCollection

int TKAction::plug(QWidget* widget, int index)
{
  if ( widget->inherits("KToolBar") ) {
    KToolBar* bar = static_cast<KToolBar*>(widget);
    int id_ = KAction::getToolButtonID();
    KInstance *instance;

    if ( parentCollection() )
      instance = parentCollection()->instance();
    else
      instance = KGlobal::instance();

    TKToolBarButton* b = new TKToolBarButton(icon(),plainText(),bar,name(),instance);
    // we don't need clicked() and buttonClicked(), do we?
    // connect(b,SIGNAL(clicked()),SLOT(slotActivated()));
    b->setIconMode(m_imode);
    initToolBarButton(b);

    bar->insertWidget( id_, 100, b, index );
    addContainer(bar,id_);
    connect( bar, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );

    return containerCount() - 1;
  }
  return KAction::plug(widget,index);
}
开发者ID:RainerBlessing,项目名称:KTagebuch,代码行数:26,代码来源:tkaction.cpp

示例5: QSplitter

QWidget* MainWindow::setupScriptPanel()
{
    m_hScriptSplitter = new QSplitter(this);
    m_hScriptSplitter->setOrientation(Qt::Horizontal);

    KToolBar *executeCommands = new KToolBar(this);
    executeCommands->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    executeCommands->setOrientation(Qt::Vertical);
    m_runScript = new QAction(QIcon::fromTheme("media-playback-start"), i18nc("@action:intoolbar Script Execution", "Run"), this);
    m_runScript->setToolTip(i18nc("@info:tooltip", "Execute currently active script on active graph document."));
    m_stopScript = new QAction(QIcon::fromTheme("process-stop"), i18nc("@action:intoolbar Script Execution", "Stop"), this);
    m_stopScript->setToolTip(i18nc("@info:tooltip", "Stop script execution."));
    m_stopScript->setEnabled(false);
    executeCommands->addAction(m_runScript);
    executeCommands->addAction(m_stopScript);
    // add actions to action collection to be able to set shortcuts on them in the ui
    actionCollection()->addAction("_runScript", m_runScript);
    actionCollection()->addAction("_stopScript", m_stopScript);

    connect(m_runScript, &QAction::triggered, this, &MainWindow::executeScript);
    connect(m_stopScript, &QAction::triggered, this, &MainWindow::stopScript);

    m_hScriptSplitter->addWidget(m_codeEditorWidget);
    m_hScriptSplitter->addWidget(m_outputWidget);

    QWidget *scriptInterface = new QWidget(this);
    scriptInterface->setLayout(new QHBoxLayout);
    scriptInterface->layout()->addWidget(m_hScriptSplitter);
    scriptInterface->layout()->addWidget(executeCommands);

    return scriptInterface;
}
开发者ID:KDE,项目名称:rocs,代码行数:32,代码来源:mainwindow.cpp

示例6: 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

示例7: KToolBar

KToolBar *ComposerWebEngineWidgetPrivate::createToolBar(const QList<ComposerWebEngine::ComposerWebEngineAction> &lstActions)
{
    KToolBar *toolbar = new KToolBar(q);
    toolbar->setIconSize(QSize(22, 22));
    toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    toolBarLayout->addWidget(toolbar);
    webEngine->createToolBar(lstActions, toolbar);
    listToolBar.append(toolbar);
    return toolbar;
}
开发者ID:KDE,项目名称:kdepim,代码行数:10,代码来源:composerwebenginewidget.cpp

示例8: KToolBar

void KHelpMain::createLocationbar()
{
  KToolBar *tb = new KToolBar(this);

  tb->insertLined("", QLINEDIT_ITEM, SIGNAL( returnPressed() ), this, SLOT( slotLocationEntered() ) );
  tb->setFullWidth(TRUE);
  tb->setItemAutoSized( QLINEDIT_ITEM, TRUE);
  tb->enable(KToolBar::Show);

  location = tb;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:11,代码来源:mainwidget.cpp

示例9: unplug

void PMSpinBoxAction::unplug( QWidget *w )
{
    if( !w->inherits( "KToolBar" ) )
        return;

    KToolBar *toolBar = (KToolBar *)w;

    int idx = findContainer( w );

    toolBar->removeItem( itemId( idx ) );

    removeContainer( idx );
    m_spinBox = 0L;
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例10: placesModel

FileBrowser::Private::Private( FileBrowser *parent )
    : placesModel( 0 )
    , showingPlaces( false )
    , q( parent )
{
    KHBox *topHBox = new KHBox( q );

    KToolBar *navigationToolbar = new KToolBar( topHBox );
    navigationToolbar->setToolButtonStyle( Qt::ToolButtonIconOnly );
    navigationToolbar->setIconDimensions( 16 );

    backAction = KStandardAction::back( q, SLOT(back()), topHBox );
    forwardAction = KStandardAction::forward( q, SLOT(forward()), topHBox );
    backAction->setEnabled( false );
    forwardAction->setEnabled( false );

    upAction = KStandardAction::up( q, SLOT(up()), topHBox );
    homeAction = KStandardAction::home( q, SLOT(home()), topHBox );
    placesAction = new KAction( KIcon( "folder-remote" ),
                               i18nc( "Show Dolphin Places the user configured", "Places" ),
                               topHBox );

    navigationToolbar->addAction( backAction );
    navigationToolbar->addAction( forwardAction );
    navigationToolbar->addAction( upAction );
    navigationToolbar->addAction( homeAction );
    navigationToolbar->addAction( placesAction );

    searchWidget = new SearchWidget( topHBox, false );
    searchWidget->setClickMessage( i18n( "Filter Files" ) );

    fileView = new FileView( q );
}
开发者ID:ErrAza,项目名称:amarok,代码行数:33,代码来源:FileBrowser.cpp

示例11: placesModel

FileBrowser::Private::Private( FileBrowser *parent )
    : placesModel( 0 )
    , q( parent )
{
    KHBox *topHBox = new KHBox( q );

    KToolBar *navigationToolbar = new KToolBar( topHBox );
    navigationToolbar->setToolButtonStyle( Qt::ToolButtonIconOnly );
    navigationToolbar->setIconDimensions( 16 );

    backAction = KStandardAction::back( q, SLOT(back()), topHBox );
    forwardAction = KStandardAction::forward( q, SLOT(forward()), topHBox );
    backAction->setEnabled( false );
    forwardAction->setEnabled( false );

    upAction = KStandardAction::up( q, SLOT(up()), topHBox );
    homeAction = KStandardAction::home( q, SLOT(home()), topHBox );
    refreshAction = new KAction( KIcon("view-refresh"), i18n( "Refresh" ), topHBox );
    QObject::connect( refreshAction, SIGNAL(triggered(bool)), q, SLOT(refresh()) );

    navigationToolbar->addAction( backAction );
    navigationToolbar->addAction( forwardAction );
    navigationToolbar->addAction( upAction );
    navigationToolbar->addAction( homeAction );
    navigationToolbar->addAction( refreshAction );

    searchWidget = new SearchWidget( topHBox, false );
    searchWidget->setClickMessage( i18n( "Filter Files" ) );

    fileView = new FileView( q );
}
开发者ID:netrunner-debian-kde-extras,项目名称:amarok,代码行数:31,代码来源:FileBrowser.cpp

示例12: kDebug

void MainWindow::setupToolbars()
{
    kDebug() << "setup toolbars...";

    KAction *a;

    // location bar
    a = new KAction(i18n("Location Bar"), this);
    a->setDefaultWidget(m_view->widgetBar());
    actionCollection()->addAction( QL1S("url_bar"), a);

    KToolBar *mainBar = toolBar("mainToolBar");

    mainBar->show();  // this just to fix reopening rekonq after fullscreen close
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:15,代码来源:mainwindow.cpp

示例13: 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

示例14: setupHistoryActions

void TabBar::emptyAreaContextMenu(const QPoint &pos)
{
    setupHistoryActions();

    KMenu menu;
    MainWindow *mainWindow = Application::instance()->mainWindow();

    menu.addAction(mainWindow->actionByName( QL1S("new_tab") ));
    menu.addAction(mainWindow->actionByName( QL1S("open_last_closed_tab") ));
    menu.addAction(mainWindow->actionByName( QL1S("closed_tab_menu") ));
    menu.addSeparator();
    menu.addAction(mainWindow->actionByName( QL1S("reload_all_tabs") ));

    KToolBar *mainBar = mainWindow->toolBar("mainToolBar");
    if(!mainBar->isVisible())
    {
        menu.addAction( mainBar->toggleViewAction() );
    }

    menu.exec(pos);
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:21,代码来源:tabbar.cpp

示例15: 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;
}
开发者ID:,项目名称:,代码行数:21,代码来源:


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