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


C++ QToolBar::addWidget方法代码示例

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


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

示例1: createFormatToolBar

QToolBar* MainWindow::createFormatToolBar()
{
    QToolBar *pFormatBar = new QToolBar();
    pFormatBar->setWindowTitle( "Format Bar" );

    m_pCmbFont = new QFontComboBox;
    m_pCmbFont->setEditable( false );
    m_pCmbFont->setFocusPolicy( Qt::NoFocus );
    m_pCmbFontPointSize = new QComboBox;
    updateFontPointSize( m_pCmbFont->currentText() );
    m_pCmbFontPointSize->setFocusPolicy( Qt::NoFocus );
    QToolButton *pBtnMoreOptions = new QToolButton;
    pBtnMoreOptions->setText( "More..." );
    pBtnMoreOptions->setStyleSheet( "border: 1px solid #000000" );
    pBtnMoreOptions->setFixedHeight( 20 );
    pBtnMoreOptions->setFocusPolicy( Qt::NoFocus );

    pFormatBar->addWidget( m_pCmbFont );
    pFormatBar->addWidget( m_pCmbFontPointSize );
    pFormatBar->addWidget( pBtnMoreOptions );

    connect( m_pCmbFont, SIGNAL(currentIndexChanged(int)), this, SLOT(onFontFamilyChanged()) );
    connect( m_pCmbFontPointSize, SIGNAL(currentIndexChanged(int)), this, SLOT(onFontPointSizeChanged()) );
    connect( pBtnMoreOptions, SIGNAL(clicked()), this, SLOT(onFormatMoreBtnClicked()) );

    return pFormatBar;
}
开发者ID:noQQ0312,项目名称:DDD,代码行数:27,代码来源:wnd_main.cpp

示例2: addToolBar

void
MainWindow::createToolBars()
{
    QToolBar *fileTool = addToolBar("File");
    QToolBar *editTool = addToolBar("Edit");
    
    QToolButton *fileNewBtn = new QToolButton;
    fileNewBtn->setIcon(QIcon(":/images/new.png"));
    QToolButton *fileOpenBtn = new QToolButton;
    fileOpenBtn->setIcon(QIcon(":/images/open.png"));
    QToolButton *fileSaveBtn = new QToolButton;
    fileSaveBtn->setIcon(QIcon(":/images/save.png"));
    
    fileTool->addWidget(fileNewBtn);
    fileTool->addWidget(fileOpenBtn);
    fileTool->addWidget(fileSaveBtn);
    
    QToolButton *copyBtn = new QToolButton;
    copyBtn->setIcon(QIcon(":/images/copy.png"));
    QToolButton *cutBtn = new QToolButton;
    cutBtn->setIcon(QIcon(":/images/cut.png"));
    QToolButton *pasteBtn = new QToolButton;
    pasteBtn->setIcon(QIcon(":/images/paste.png"));
    
    editTool->addWidget(copyBtn);
    editTool->addWidget(cutBtn);
    editTool->addWidget(pasteBtn);
}
开发者ID:cugxiangzhenwei,项目名称:MySrcCode,代码行数:28,代码来源:mainwindow.cpp

示例3: setupTextActions

void DevGUI::setupTextActions()
{
	QToolBar *tb = new QToolBar(this);
	tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
	tb->setWindowTitle(tr("Format Actions"));
	addToolBarBreak(Qt::TopToolBarArea);
	addToolBar(tb);
	
	Font = new QComboBox(tb);
	tb->addWidget(Font);
	Font->setEditable(true);
	QFontDatabase db;
	Font->addItems(db.families());
	connect(Font, SIGNAL(activated(const QString &)),
			this, SLOT(textFamily(const QString &)));
	Font->setCurrentIndex(Font->findText(DevApp::font().family()));
	
	Size = new QComboBox(tb);
	Size->setObjectName("Size");
	tb->addWidget(Size);
	Size->setEditable(true);

	foreach(int size, db.standardSizes())
		Size->addItem(QString::number(size));

	connect(Size, SIGNAL(activated(const QString &)),
			this, SLOT(textSize(const QString &)));
	Size->setCurrentIndex(Size->findText(QString::number(DevApp::font().pointSize())));
}
开发者ID:BackupTheBerlios,项目名称:devqt-svn,代码行数:29,代码来源:devgui.cpp

示例4: QLabel

void BitcoinGUI::createToolBars2()
{
    QLabel *mylabel = new QLabel (this);
   mylabel->setPixmap(QPixmap(":images/head"));
   mylabel->show();

    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea,toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setMovable( false );
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    toolbar->setIconSize(QSize(50,25));
    toolbar->addWidget(mylabel);
    toolbar->addAction(overviewAction);
    toolbar->addAction(sendCoinsAction);
    toolbar->addAction(receiveCoinsAction);
    toolbar->addAction(historyAction);
    toolbar->addAction(addressBookAction);
    toolbar->addAction(blockAction);
    toolbar->addAction(statisticsAction);
    toolbar->addAction(optionsAction);

    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolbar->addWidget(spacer);
    spacer->setObjectName("spacer");
    toolbar->setStyleSheet(
    "#toolbar { font-weight:600;border:none;height:100%;padding-top:20px; background: rgb(37,40,46); text-align: left; color: white;min-width:180px;max-width:180px;}"
    "QToolBar QToolButton:hover {background:rgb(28,29,33);}"
    "QToolBar QToolButton:checked {background:rgba(28,29,33,100);}"
    "QToolBar QToolButton { font-weight:600;font-size:10px;font-family:'Century Gothic';padding-left:20px;padding-right:181px;padding-top:5px;padding-bottom:5px; width:100%; color: white; text-align: left; background:transparent;text-transform:uppercase; }");

    wId = new QWidget(this);
    wId3 = new QWidget(this);
    QToolBar *toolbars = addToolBar(tr("Settings2"));
    addToolBar(Qt::RightToolBarArea,toolbars);
    toolbars->setOrientation(Qt::Horizontal);
    toolbars->setMovable( false );
    toolbars->setStyleSheet("QToolBar QToolButton {border:0px;margin-right:3px} QToolBar{ border:0px; }");
    toolbars->setIconSize(QSize(102,25));
    QHBoxLayout *vbox5 = new QHBoxLayout();
    vbox5->addWidget(toolbars);
    vbox5->setContentsMargins(0,0,0,0);
    wId3->setFixedSize(250,30);
    wId3->move(260,10);
    wId3->setLayout(vbox5);
    wId3->setFocus();
    wId3->raise();
    QMenu *menu = new QMenu(tr("Mini"));
    menu->setStyleSheet("border:none;background:none;");
    menu->addAction(toggleHideAction);
    menu->menuAction()->setIcon(QIcon(":/icons/mini"));
    QHBoxLayout *vbox3 = new QHBoxLayout();
    vbox3->setContentsMargins(0,0,0,0);
    wId->setFixedSize(120,40);
    wId->move(915,1);
    wId->setLayout(vbox3);
    wId->setFocus();
}
开发者ID:roscoin1,项目名称:roscoin,代码行数:60,代码来源:bitcoingui.cpp

示例5: createToolBar

/*!
    Create and return the toolbar to use for digital signal generation.
*/
QToolBar* UiDigitalGenerator::createToolBar()
{
    // Deallocation:
    //   Re-parented when calling verticalLayout->addWidget in the constructor
    QToolBar* toolBar = new QToolBar("Digital generator settings");

    mAddAction = toolBar->addAction("Add");
    connect(mAddAction, SIGNAL(triggered()), this, SLOT(addSignal()));

    mRemoveAction = toolBar->addAction("Remove");
    connect(mRemoveAction, SIGNAL(triggered()),
            this, SLOT(removeSelectedSignals()));
    mRemoveAction->setEnabled(false);

    toolBar->addSeparator();
    mRate = createRateBox();
    // Deallocation: Toolbar takes ownership of label
    toolBar->addWidget(new QLabel(tr(" Rate ")));
    toolBar->addWidget(mRate);

    mStatesBox = createStatesBox();
    toolBar->addSeparator();
    // Deallocation: Toolbar takes ownership of label
    toolBar->addWidget(new QLabel(tr(" States ")));
    toolBar->addWidget(mStatesBox);


    return toolBar;
}
开发者ID:AlexandreN7,项目名称:Liqui_lense,代码行数:32,代码来源:uidigitalgenerator.cpp

示例6: QDockWidget

TextTools::TextTools(QWidget* parent)
   : QDockWidget(parent)
      {
      _textElement = 0;
      setObjectName("text-tools");
      setWindowTitle(tr("Text Tools"));
      setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea));

      QToolBar* tb = new QToolBar(tr("Text Edit"));
      tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight));

      showKeyboard = getAction("show-keys");
      showKeyboard->setCheckable(true);
      tb->addAction(showKeyboard);

      typefaceBold = tb->addAction(*icons[int(Icons::textBold_ICON)], "");
      typefaceBold->setToolTip(tr("Bold"));
      typefaceBold->setCheckable(true);

      typefaceItalic = tb->addAction(*icons[int(Icons::textItalic_ICON)], "");
      typefaceItalic->setToolTip(tr("Italic"));
      typefaceItalic->setCheckable(true);

      typefaceUnderline = tb->addAction(*icons[int(Icons::textUnderline_ICON)], "");
      typefaceUnderline->setToolTip(tr("Underline"));
      typefaceUnderline->setCheckable(true);

      tb->addSeparator();

      typefaceSubscript   = tb->addAction(*icons[int(Icons::textSub_ICON)], "");
      typefaceSubscript->setToolTip(tr("Subscript"));
      typefaceSubscript->setCheckable(true);

      typefaceSuperscript = tb->addAction(*icons[int(Icons::textSuper_ICON)], "");
      typefaceSuperscript->setToolTip(tr("Superscript"));
      typefaceSuperscript->setCheckable(true);

      tb->addSeparator();

      typefaceFamily = new QFontComboBox(this);
      tb->addWidget(typefaceFamily);

      typefaceSize = new QDoubleSpinBox(this);
      typefaceSize->setFocusPolicy(Qt::ClickFocus);
      tb->addWidget(typefaceSize);

      setWidget(tb);
      QWidget* w = new QWidget(this);
      setTitleBarWidget(w);
      titleBarWidget()->hide();

      connect(typefaceSize,        SIGNAL(valueChanged(double)), SLOT(sizeChanged(double)));
      connect(typefaceFamily,      SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&)));
      connect(typefaceBold,        SIGNAL(triggered(bool)), SLOT(boldClicked(bool)));
      connect(typefaceItalic,      SIGNAL(triggered(bool)), SLOT(italicClicked(bool)));
      connect(typefaceUnderline,   SIGNAL(triggered(bool)), SLOT(underlineClicked(bool)));
      connect(typefaceSubscript,   SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool)));
      connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool)));
      connect(showKeyboard,        SIGNAL(triggered(bool)), SLOT(showKeyboardClicked(bool)));
      }
开发者ID:HipHopScoreboard,项目名称:MuseScore,代码行数:60,代码来源:texttools.cpp

示例7: createToolBar

void MainWindow::createToolBar(){
	QToolBar* toolBar = new QToolBar();
	toolBar->setMovable(false);

	newFileButton = new QPushButton();
	newFileButton->setIcon(QIcon(":new-file.png"));
	newFileButton->setIconSize(QSize(20,20));
	newFileButton->setToolTip(tr("Create a new file"));
	newFileButton->setMaximumWidth(28);
	newFileButton->setCursor(Qt::PointingHandCursor);
	connect(newFileButton,SIGNAL(released()),this,SLOT(createNewFile()));
	toolBar->addWidget(newFileButton);

	openFileButton = new QPushButton();
	openFileButton->setIcon(QIcon(":open-file.png"));
	openFileButton->setIconSize(QSize(20,20));
	openFileButton->setToolTip(tr("Open a file"));
	openFileButton->setMaximumWidth(28);
	openFileButton->setCursor(Qt::PointingHandCursor);
	connect(openFileButton,SIGNAL(released()),this,SLOT(openFile()));
	toolBar->addWidget(openFileButton);

	saveFileButton = new QPushButton();
	saveFileButton->setIcon(QIcon(":save-file.png"));
	saveFileButton->setIconSize(QSize(20,20));
	saveFileButton->setToolTip(tr("Save the current file"));
	saveFileButton->setMaximumWidth(28);
	saveFileButton->setCursor(Qt::PointingHandCursor);
	saveFileButton->setShortcut(QKeySequence("Ctrl+S"));
	connect(saveFileButton,SIGNAL(released()),this,SLOT(saveFile()));
	toolBar->addWidget(saveFileButton);

	addToolBar(toolBar);
}
开发者ID:serioja90,项目名称:Mojo,代码行数:34,代码来源:MainWindow.cpp

示例8: board

MainWidget::MainWidget(QWidget*) : board(NULL)
{
	layout = new QVBoxLayout(this);
	//cubeSettingsLayout = new QHBoxLayout;

	QPushButton* newgame = new QPushButton(tr("&New game"));
	QLabel* cubeLabel = new QLabel(tr("Board size: "));
	QComboBox* opponent = new QComboBox;
	status = new QLabel;
	cubeSize = new QSpinBox;
	cubeSize->setRange(6, 50);
	cubeSize->setValue(15);
	connect(newgame, SIGNAL(clicked()), this, SLOT(newGame()));

	QToolBar* toolbar = new QToolBar(tr("Settings"));
	toolbar->addWidget(cubeLabel);
	toolbar->addWidget(cubeSize);
	toolbar->addSeparator();
	toolbar->addWidget(opponent);
	//cubeSettingsLayout->addWidget(cubeLabel);
	//cubeSettingsLayout->addWidget(cubeSize);

	layout->addWidget(newgame, 1);
	layout->addWidget(toolbar);
	layout->addWidget(status);
	newGame();

	setLayout(layout);
	//setFixedSize(sizeHint());
}
开发者ID:dwatzke,项目名称:piskvorky,代码行数:30,代码来源:mainwidget.cpp

示例9: createToolBars

void BitcoinGUI::createToolBars()
{
    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea,toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setFixedWidth(205);
    toolbar->setMovable( false );
    toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly);

    QLabel* header = new QLabel();
    header->setMinimumSize(156,156);
    header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    header->setPixmap(QPixmap(":/images/header"));
    header->setMaximumSize(156,156);
    header->setContentsMargins(26,26,0,0);
    header->setScaledContents(true);
    toolbar->addWidget(header);

	QLabel *l = new QLabel(this);
    l->setPixmap(QPixmap(":/images/spacer"));
    toolbar->addWidget(l);
    toolbar->addAction(overviewAction);
    toolbar->addAction(sendCoinsAction);
    toolbar->addAction(receiveCoinsAction);
    toolbar->addAction(historyAction);
    toolbar->addAction(addressBookAction);
    toolbar->setStyleSheet("#toolbar {background: transparent; text-align: center; color: black;padding-right: 30px;} QToolBar QToolButton:hover {background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton {font-family:Steps; font-size:15px; font-weight: bold; min-width:125px;max-width:125px; min-height:25px;max-height:25px; color: white; text-align: left; }");

}
开发者ID:CandyCoinDev,项目名称:c1,代码行数:30,代码来源:bitcoingui.cpp

示例10: QMainWindow

CurveletGUI::CurveletGUI(QWidget *parent)
: QMainWindow(parent)
{
	this->resize(800,600);
	this->FileListView = new QListWidget;
	this->FileListView->isSortingEnabled();
	this->setCentralWidget(this->FileListView);
	this->InputFileList.clear();
	QToolBar * mainToolBar = new QToolBar(this);

	this->exitAction = new QAction(tr("Exit"), this);
	connect(this->exitAction, SIGNAL(triggered()), this, SLOT(close()));
	this->exitAction->setShortcut(QKeySequence::Close);
	this->menuBar()->addAction(this->exitAction);

	this->loadImages = new QAction("Load Images", this);
	connect(this->loadImages, SIGNAL(triggered()), this, SLOT(BrowseFiles()));
	this->menuBar()->addAction(this->loadImages);

	this->ProcessImages = new QAction("Run Curvelets on Images", this);
	connect(this->ProcessImages, SIGNAL(triggered()), this, SLOT(ProcessFiles()));
	this->ProcessImages->setEnabled(false);
	this->menuBar()->addAction(this->ProcessImages);

	this->SigmaValue = new QDoubleSpinBox(this);
	this->SigmaValue->setRange(0,1);
	this->SigmaValue->setValue(.03);
	this->SigmaValue->setSingleStep(.01);
	mainToolBar->addWidget(new QLabel("Sigma Value: "));
	mainToolBar->addWidget(this->SigmaValue);
	this->addToolBar(mainToolBar);
}
开发者ID:JumperWang,项目名称:farsight-clone,代码行数:32,代码来源:CurveletGUI.cpp

示例11: QMainWindow

MainWindow::MainWindow( QWidget *parent ):
    QMainWindow( parent )
{
    d_plot = new Plot( this );
    setCentralWidget( d_plot );

    QToolBar *toolBar = new QToolBar( this );

    QComboBox *typeBox = new QComboBox( toolBar );
    typeBox->addItem( "Bars" );
    typeBox->addItem( "CandleSticks" );
    typeBox->setCurrentIndex( 1 );
    typeBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

    QToolButton *btnExport = new QToolButton( toolBar );
    btnExport->setText( "Export" );
    btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    connect( btnExport, SIGNAL( clicked() ), d_plot, SLOT( exportPlot() ) );

    toolBar->addWidget( typeBox );
    toolBar->addWidget( btnExport );
    addToolBar( toolBar );

    d_plot->setMode( typeBox->currentIndex() );
    connect( typeBox, SIGNAL( currentIndexChanged( int ) ),
        d_plot, SLOT( setMode( int ) ) );
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:27,代码来源:main.cpp

示例12: QWidget

SidebarWidget::SidebarWidget(QWidget *parent) : QWidget(parent),
	m_resizeTimer(0),
	m_ui(new Ui::SidebarWidget)
{
	m_ui->setupUi(this);

	QToolBar *toolbar = new QToolBar(this);
	toolbar->setIconSize(QSize(16, 16));
	toolbar->addWidget(new PanelChooserWidget(ActionsManager::ActionEntryDefinition(), this));
	toolbar->addAction(ActionsManager::getAction(ActionsManager::OpenPanelAction, this));

	QWidget *spacer = new QWidget(toolbar);
	spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

	toolbar->addWidget(spacer);
	toolbar->addAction(ActionsManager::getAction(ActionsManager::ClosePanelAction, this));

	m_ui->panelLayout->addWidget(toolbar);
	m_ui->panelsButton->setPopupMode(QToolButton::InstantPopup);
	m_ui->panelsButton->setIcon(ThemesManager::getIcon(QLatin1String("list-add")));

	optionChanged(QLatin1String("Sidebar/CurrentPanel"), SettingsManager::getValue(QLatin1String("Sidebar/CurrentPanel")));
	optionChanged(QLatin1String("Sidebar/Panels"), SettingsManager::getValue(QLatin1String("Sidebar/Panels")));
	optionChanged(QLatin1String("Sidebar/Reverse"), SettingsManager::getValue(QLatin1String("Sidebar/Reverse")));

	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
}
开发者ID:davidyang5405,项目名称:otter-browser,代码行数:27,代码来源:SidebarWidget.cpp

示例13: init

void SpreadSheet::init()
{
    inInit = true;

    project = new QSProject( this, "spreadsheet_project" );
    interpreter = project->interpreter();
#ifndef QSA_NO_GUI
	QSInputDialogFactory *fac = new QSInputDialogFactory;
    interpreter->addObjectFactory( fac );
#endif

    project->addObject( new SheetInterface( sheet1, this, "sheet1" ) );

    project->load( "spreadsheet.qsa" );
    connect( project, SIGNAL( projectEvaluated() ),
	     project, SLOT( save() ) );

    
    QMenuBar *menuBar = new QMenuBar(this);
    QMenu *fileMenu = menuBar->addMenu("&File");    
    QAction *fileExitAction = fileMenu->addAction("E&xit");
    connect(fileExitAction, SIGNAL(triggered(bool)), this, SLOT(fileExit()));

    scriptsMenu = menuBar->addMenu("&Scripts");
    QAction *scriptsNewAction = scriptsMenu->addAction(QIcon(":/images/hi22-action-run.png"), 
                                                       "&New...");
    connect(scriptsNewAction, SIGNAL(triggered(bool)), this, SLOT(addScript()));
    QAction *scriptsQSA = scriptsMenu->addAction(QIcon(":/images/hi22-action-project_open.png"), 
                                                 "QSA &Workbench");   
    connect(scriptsQSA, SIGNAL(triggered(bool)), this, SLOT(openIDE()));
    setMenuBar(menuBar);

    QToolBar *toolBar = new QToolBar("Calculation Toolbar", this);
    currentCell = new QLabel("A1", toolBar);
        toolBar->addWidget(currentCell);
    formulaEdit = new QLineEdit(toolBar);
        toolBar->addWidget(formulaEdit);
        connect(formulaEdit, SIGNAL(returnPressed()), this, SLOT(formulaEdited()));
    addToolBar(toolBar);

    scriptsToolbar = new QToolBar("Scripts Toolbar", this);
    scriptsToolbar->addAction(scriptsNewAction);
    scriptsToolbar->addAction(scriptsQSA);
    addToolBar(scriptsToolbar);        

    for (int i=0; i<sheet1->rowCount(); ++i) {
        sheet1->setVerticalHeaderItem(i, new QTableWidgetItem(QString::number(i + 1)));

        for (int j=0; j<sheet1->columnCount(); ++j) {
            sheet1->setItem(i, j, new QTableWidgetItem);
            if (i == 0) {
                sheet1->setHorizontalHeaderItem(j, new QTableWidgetItem);
            }
        }
    }

    setupSheet( sheet1 );
    inInit = false;
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:59,代码来源:spreadsheet.cpp

示例14: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setWindowTitle(QStringLiteral("Enginio TODO example"));

    QByteArray EnginioBackendId = backendId("todo");

    //![client]
    m_client = new EnginioClient(this);
    m_client->setBackendId(EnginioBackendId);
    //![client]

    QObject::connect(m_client, &EnginioClient::error, this, &MainWindow::error);

    //![model]
    m_model = new TodosModel(this);
    m_model->setClient(m_client);

    QJsonObject query;
    query["objectType"] = QString::fromUtf8("objects.todos");
    m_model->setQuery(query);
    //![model]

    QToolBar *toolBar = new QToolBar(this);
    m_addNewButton = new QPushButton(toolBar);
    m_addNewButton->setText("&Add");
    QObject::connect(m_addNewButton, &QPushButton::clicked, this, &MainWindow::appendItem);

    m_removeButton = new QPushButton(toolBar);
    m_removeButton->setText("&Remove");
    m_removeButton->setEnabled(false);
    QObject::connect(m_removeButton, &QPushButton::clicked, this, &MainWindow::removeItem);

    m_toggleButton = new QPushButton(toolBar);
    m_toggleButton->setText("&Toggle Completed");
    m_toggleButton->setEnabled(false);
    QObject::connect(m_toggleButton, &QPushButton::clicked, this, &MainWindow::toggleCompleted);

    toolBar->addWidget(m_addNewButton);
    toolBar->addWidget(m_removeButton);
    toolBar->addWidget(m_toggleButton);

    m_view = new QTreeView(this);
    m_view->setAlternatingRowColors(true);
    QFrame *frame = new QFrame(this);
    QVBoxLayout *windowLayout = new QVBoxLayout(frame);
    windowLayout->addWidget(m_view);
    windowLayout->addWidget(toolBar);
    setCentralWidget(frame);

    //![assignModel]
    m_view->setModel(m_model);
    //![assignModel]

    m_view->setSelectionModel(new QItemSelectionModel(m_model, m_model));
    QObject::connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MainWindow::selectionChanged);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:57,代码来源:mainwindow.cpp

示例15: createToolbars

void MainWindow::createToolbars()
{
  
  //////////////////
  QToolBar *fileToolBar;
  fileToolBar = addToolBar(tr("fileToolbar"));
  fileToolBar->addAction(newAction);
  fileToolBar->addAction(openFileAction);
  //  fileToolBar->addAction(saveAction);
  fileToolBar->addAction(saveProjectAction);
  
  //Button for contexts related
  contextItemsButtonGroup = new QButtonGroup(this);  
  QToolButton *selectItemToolButton = new QToolButton(this);  
  selectItemToolButton ->setCheckable(true);
  selectItemToolButton ->setChecked(true);
  selectItemToolButton ->setIcon(QIcon(":/images/pointer.png"));  
  
  QToolButton *insertLineToolButton = new QToolButton(this);
  insertLineToolButton->setCheckable(true);  
  insertLineToolButton->setIcon(QIcon(":/images/linepointer.png"));  
  
  QToolButton *insertPolygonToolButton = new QToolButton(this);
  insertPolygonToolButton->setCheckable(true);  
  insertPolygonToolButton->setIcon(QIcon(":/images/polygon.png"));  
  
  contextItemsButtonGroup->addButton(selectItemToolButton,int(RbeVisualizeWidget_GraphicsScene::ITEM_SELECTION_MODE));
  contextItemsButtonGroup->addButton(insertLineToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_LINE_MODE));  
  contextItemsButtonGroup->addButton(insertPolygonToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_POLYGON_MODE));
  
  QToolBar *contextItemsButtonGroupToolBar;    
  contextItemsButtonGroupToolBar = addToolBar(tr("contextItemsButtonGroup"));
  contextItemsButtonGroupToolBar->addWidget(selectItemToolButton);
  contextItemsButtonGroupToolBar->addWidget(insertLineToolButton);
  contextItemsButtonGroupToolBar->addWidget(insertPolygonToolButton);    
  
  connect(contextItemsButtonGroup, SIGNAL(buttonClicked(int)),
          this, SLOT(contextItemsButtonGroupClicked()));
  
  
  ////////////////////RULE TOOLBAR  
  QToolBar *ruleToolBar;
  ruleToolBar = addToolBar(tr("ruleToolbar"));
  ruleToolBar->addAction(newRuleAction);
  
  ////////////////////
  QToolBar *runToolBar;
  runToolBar = addToolBar(tr("runToolbar"));  
  //runToolBar->addAction(runAnimateAction);
  runToolBar->addAction(openVideoAction);
  runToolBar->addAction(runVirtualFencingAction);  
  //////////////////////
  QToolBar *exitToolBar;
  exitToolBar = addToolBar((tr("exitToolBar")));
  exitToolBar->addAction(exitAction);
  
}
开发者ID:heroddaji,项目名称:rulebasedengine,代码行数:57,代码来源:MainWindow.cpp


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