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


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

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


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

示例1: buildToolbars

//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildToolbars(QMainWindow& mainWindow)
{

      QToolBar* mainToolBar = new swftMainControlsToolbar(&mainWindow)
        << pqSetName("MainControlsToolbar");
      mainToolBar->layout()->setSpacing(0);
      mainWindow.addToolBar(Qt::TopToolBarArea, mainToolBar);

      QToolBar* colorToolbar = new pqColorToolbar(&mainWindow)
        << pqSetName("variableToolbar");
      colorToolbar->layout()->setSpacing(0);
      mainWindow.addToolBar(Qt::TopToolBarArea, colorToolbar);
      mainWindow.insertToolBarBreak(colorToolbar);

      QToolBar* reprToolbar = new pqRepresentationToolbar(&mainWindow)
        << pqSetName("representationToolbar");
      reprToolbar->layout()->setSpacing(0);
      mainWindow.addToolBar(Qt::TopToolBarArea, reprToolbar);

      QToolBar* vcrToolbar = new pqVCRToolbar(&mainWindow)
        << pqSetName("VCRToolbar");

      vcrToolbar->layout()->setSpacing(0);
      mainWindow.addToolBar(Qt::TopToolBarArea, vcrToolbar);

      QToolBar* timeToolbar = new pqAnimationTimeToolbar(&mainWindow)
        << pqSetName("currentTimeToolbar");
      timeToolbar->layout()->setSpacing(0);
      mainWindow.addToolBar(Qt::TopToolBarArea, timeToolbar);

}
开发者ID:ghost-kit,项目名称:archive,代码行数:32,代码来源:swftParaViewMenuBuilders.cpp

示例2: QWidget

EditWidget::EditWidget(IMessageWidgets *AMessageWidgets, IMessageWindow *AWindow, QWidget *AParent) : QWidget(AParent)
{
	ui.setupUi(this);
	ui.medEditor->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);

	FWindow = AWindow;
	FMessageWidgets = AMessageWidgets;
	
	FBufferPos = -1;
	FSendEnabled = true;
	FEditEnabled = true;
	setRichTextEnabled(false);

	QToolBar *toolBar = new QToolBar;
	toolBar->setMovable(false);
	toolBar->setFloatable(false);
	toolBar->setIconSize(QSize(16,16));
	toolBar->layout()->setMargin(0);
	toolBar->setStyleSheet("QToolBar { border: none; }");
	toolBar->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);

	FEditToolBar = new ToolBarChanger(toolBar);
	FEditToolBar->setMinimizeWidth(true);
	FEditToolBar->setSeparatorsVisible(false);
	connect(FEditToolBar,SIGNAL(itemRemoved(QAction *)),SLOT(onUpdateEditToolBarVisibility()));
	connect(FEditToolBar,SIGNAL(itemInserted(QAction *, QAction *, Action *, QWidget *, int)),SLOT(onUpdateEditToolBarVisibility()));

	ui.wdtSendToolBar->setLayout(new QHBoxLayout);
	ui.wdtSendToolBar->layout()->setMargin(0);
	ui.wdtSendToolBar->layout()->addWidget(toolBar);

	FSendAction = new Action(toolBar);
	FSendAction->setToolTip(tr("Send"));
	FSendAction->setIcon(RSR_STORAGE_MENUICONS,MNI_MESSAGEWIDGETS_SEND);
	connect(FSendAction,SIGNAL(triggered(bool)),SLOT(onSendActionTriggered(bool)));
	FEditToolBar->insertAction(FSendAction,TBG_MWEWTB_SENDMESSAGE);

	ui.medEditor->installEventFilter(this);
	ui.medEditor->setContextMenuPolicy(Qt::CustomContextMenu);
	Shortcuts::insertWidgetShortcut(SCT_MESSAGEWINDOWS_EDITNEXTMESSAGE,ui.medEditor);
	Shortcuts::insertWidgetShortcut(SCT_MESSAGEWINDOWS_EDITPREVMESSAGE,ui.medEditor);
	connect(ui.medEditor,SIGNAL(createDataRequest(QMimeData *)),SLOT(onEditorCreateDataRequest(QMimeData *)));
	connect(ui.medEditor,SIGNAL(canInsertDataRequest(const QMimeData *, bool &)),
		SLOT(onEditorCanInsertDataRequest(const QMimeData *, bool &)));
	connect(ui.medEditor,SIGNAL(insertDataRequest(const QMimeData *, QTextDocument *)),
		SLOT(onEditorInsertDataRequest(const QMimeData *, QTextDocument *)));
	connect(ui.medEditor->document(),SIGNAL(contentsChange(int,int,int)),SLOT(onEditorContentsChanged(int,int,int)));
	connect(ui.medEditor,SIGNAL(customContextMenuRequested(const QPoint &)),SLOT(onEditorCustomContextMenuRequested(const QPoint &)));

	onOptionsChanged(Options::node(OPV_MESSAGES_EDITORAUTORESIZE));
	onOptionsChanged(Options::node(OPV_MESSAGES_EDITORMINIMUMLINES));
	connect(Options::instance(),SIGNAL(optionsChanged(const OptionsNode &)),SLOT(onOptionsChanged(const OptionsNode &)));

	connect(Shortcuts::instance(),SIGNAL(shortcutUpdated(const QString &)),SLOT(onShortcutUpdated(const QString &)));
	connect(Shortcuts::instance(),SIGNAL(shortcutActivated(const QString &, QWidget *)),SLOT(onShortcutActivated(const QString &, QWidget *)));

	onUpdateEditToolBarVisibility();
}
开发者ID:Nikoli,项目名称:vacuum-im,代码行数:58,代码来源:editwidget.cpp

示例3: QGroupBox

StringListEditor::StringListEditor(const QString& title, QWidget* parent) : QGroupBox(title, parent) {
	// create layout
	_hLayout = new QVBoxLayout( this );
	_hLayout->setMargin(5);
	_hLayout->setSpacing(3);
	
	// create toolbar
	QToolBar* tb = new QToolBar;
	tb->layout()->setMargin(0);
	tb->layout()->setSpacing(0);
	tb->setIconSize(QSize(16, 16));
	_hLayout->addWidget(tb);
	
	// create listwidget
	_list = new QListWidget;
	_list->setMinimumHeight(40);
	_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	_hLayout->addWidget(_list);
	
	// create actions
	QAction* addAction = new QAction( QIcon( ":/listeditor/add.png" ), tr("Add Item"), tb);
	QAction* removeAction = new QAction( QIcon( ":/listeditor/remove.png" ), tr("Remove Item"), tb);
	QAction* clearAction = new QAction( QIcon( ":/listeditor/clear.png" ), tr("Clear Items"), tb);
	QAction* upAction = new QAction( QIcon( ":/listeditor/up.png" ), tr("Move Item Up"), tb);
	QAction* downAction = new QAction( QIcon( ":/listeditor/down.png" ), tr("Move Item Down"), tb);
	QAction* editAction = new QAction( QIcon( ":/listeditor/edit.png" ), tr("Edit Item"), tb);
	
	// add actions to toolbar
	tb->addAction(addAction);
	tb->addAction(removeAction);
	tb->addAction(clearAction);
	tb->addAction(upAction);
	tb->addAction(downAction);
	tb->addAction(editAction);
	
	// connections
	connect(addAction, SIGNAL(triggered()), this, SLOT(onAddItem()));
	connect(removeAction, SIGNAL(triggered()), this, SLOT(onRemoveItem()));
	connect(clearAction, SIGNAL(triggered()), this, SLOT(onClearItem()));
	connect(upAction, SIGNAL(triggered()), this, SLOT(onMoveUpItem()));
	connect(downAction, SIGNAL(triggered()), this, SLOT(onMoveDownItem()));
	connect(editAction, SIGNAL(triggered()), this, SLOT(onEditItem()));
	connect(_list, SIGNAL(itemChanged(QListWidgetItem*)), this, SIGNAL(edited()));
	connect( this, SIGNAL(edited()), this, SLOT(onEdited()));
}
开发者ID:jzsun,项目名称:raptor,代码行数:45,代码来源:StringListEditor.cpp

示例4: createToolbar

//------------------------------------------------------------------------
// create all stuff for the toolbar
//------------------------------------------------------------------------
void ApplicationWindow::createToolbar()
{
    QPixmap openIcon(fileopen);
    QPixmap newIcon(filenew);
    QPixmap quitIcon(quit);

    QToolBar *fileTools = new QToolBar(tr("VRB Toolbar"), this);
    fileTools->layout()->setSpacing(2);
    fileTools->layout()->setMargin(0);
    addToolBar(fileTools);
    QAction *exitAction = fileTools->addAction(quitIcon, tr("Exit"), qApp, SLOT(closeAllWindows()));
    exitAction->setToolTip(tr("exit"));

    QAction *newAction = fileTools->addAction(newIcon, tr("New"), this, SLOT(newDoc()));
    newAction->setToolTip(tr("new"));

    QAction *openAction = fileTools->addAction(openIcon, tr("Open File"), this, SLOT(choose()));
    openAction->setToolTip(tr("open file"));
}
开发者ID:nixz,项目名称:covise,代码行数:22,代码来源:VRBapplication.cpp

示例5: QVERIFY

void tst_QToolBar::task191727_layout()
{
    QMainWindow mw;
    QToolBar *toolBar = mw.addToolBar("test");
    toolBar->addAction("one");
    QAction *action = toolBar->addAction("two");

    QLineEdit *lineedit = new QLineEdit;
    lineedit->setMaximumWidth(50);
    toolBar->addWidget(lineedit);

    mw.resize(400, 400);
    mw.show();

    QWidget *actionwidget = toolBar->widgetForAction(action);
    QVERIFY(qAbs(lineedit->pos().x() - (actionwidget->geometry().right() + 1 + toolBar->layout()->spacing())) < 2);
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:17,代码来源:tst_qtoolbar.cpp

示例6: createToolBars

void BitcoinGUI::createToolBars()
{
    QToolBar *homeToolBar = new QToolBar(this);
    QToolBar *menuToolBar = new QToolBar(this);
    
    homeToolBar->setObjectName("homeToolBar");
    menuToolBar->setObjectName("menuToolBar");
    
//    homeToolBar->setFixedWidth(300);
//    homeToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    menuToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    homeToolBar->setMovable(false);
    menuToolBar->setMovable(false);

    homeToolBar->setFloatable(false);
    menuToolBar->setFloatable(false);
    
    homeToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
    menuToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
        
    homeToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    menuToolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);

    homeToolBar->addAction(bitstarAction);
    homeToolBar->setIconSize(QSize(24, 24));
    
    menuToolBar->layout()->setSpacing(0);

    // Add a spacer, so all menuToolBar items are right aligned...
    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    menuToolBar->addWidget(spacer);

    QToolButton *overviewButton = new QToolButton;
    overviewButton->setDefaultAction(overviewAction);
    overviewButton->setObjectName("overviewMenu");
    menuToolBar->addWidget(overviewButton);

    QToolButton *sendCoinsButton = new QToolButton;
    sendCoinsButton->setDefaultAction(sendCoinsAction);
    sendCoinsButton->setObjectName("sendcoinsMenu");
    menuToolBar->addWidget(sendCoinsButton);

    QToolButton *receiveCoinsButton = new QToolButton;
    receiveCoinsButton->setDefaultAction(receiveCoinsAction);
    receiveCoinsButton->setObjectName("receivecoinsMenu");
    menuToolBar->addWidget(receiveCoinsButton);

    QToolButton *historyButton = new QToolButton;
    historyButton->setDefaultAction(historyAction);
    historyButton->setObjectName("historyMenu");
    menuToolBar->addWidget(historyButton);

    QToolButton *addressBookButton = new QToolButton;
    addressBookButton->setDefaultAction(addressBookAction);
    addressBookButton->setObjectName("addressBookMenu");
    menuToolBar->addWidget(addressBookButton);

    lockToggleButton = new QToolButton;
    lockToggleButton->setDefaultAction(lockWalletToggleAction);
    lockToggleButton->setObjectName("lockToggleMenu");
    lockToggleAction = menuToolBar->addWidget(lockToggleButton);

    addToolBar(homeToolBar);
    addToolBar(menuToolBar);
}
开发者ID:CryptoCoin,项目名称:bitstar,代码行数:67,代码来源:bitcoingui.cpp

示例7: QMainWindow


//.........这里部分代码省略.........
		{
			file->getInfoTable()->setTimeLineInterval(0);
		}
	});

	setTimeLineIntervalAction = new QAction("Set", this);
	setTimeLineIntervalAction->setActionGroup(timeLineIntervalActionGroup);
	connect(setTimeLineIntervalAction, &QAction::triggered, [this] ()
	{
		if (file != nullptr)
		{
			double value = file->getInfoTable()->getTimeLineInterval();
			if (value == 0)
			{
				value = 1;
			}

			bool ok;
			value = QInputDialog::getDouble(this, "Set the interval", "Please, enter the value for the time line interval here:", value, 0, 1000*1000*1000, 2, &ok);

			if (ok)
			{
				file->getInfoTable()->setTimeLineInterval(value);
			}
		}
	});

	// Tool bars.
	const int spacing = 3;

	// Construct File tool bar.
	QToolBar* fileToolBar = addToolBar("File Tool Bar");
	fileToolBar->setObjectName("File QToolBar");
	fileToolBar->layout()->setSpacing(spacing);

	fileToolBar->addAction(openFileAction);
	fileToolBar->addAction(closeFileAction);
	fileToolBar->addAction(saveFileAction);

	// Construct Filter tool bar.
	QToolBar* filterToolBar = addToolBar("Filter Tool Bar");
	filterToolBar->setObjectName("Filter QToolBar");
	filterToolBar->layout()->setSpacing(spacing);

	QLabel* label = new QLabel("LF:", this);
	label->setToolTip("Low-pass Filter frequency");
	filterToolBar->addWidget(label);
	lowpassComboBox = new QComboBox(this);
	lowpassComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
	lowpassComboBox->setMaximumWidth(150);
	lowpassComboBox->setEditable(true);
	filterToolBar->addWidget(lowpassComboBox);

	label = new QLabel("HF:", this);
	label->setToolTip("High-pass Filter frequency");
	filterToolBar->addWidget(label);
	highpassComboBox = new QComboBox(this);
	highpassComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
	highpassComboBox->setMaximumWidth(150);
	highpassComboBox->setEditable(true);
	filterToolBar->addWidget(highpassComboBox);

	notchCheckBox = new QCheckBox("Notch:", this);
	notchCheckBox->setToolTip("Notch Filter on/off");
	notchCheckBox->setLayoutDirection(Qt::RightToLeft);
	filterToolBar->addWidget(notchCheckBox);
开发者ID:hejtmy,项目名称:ZSBS,代码行数:67,代码来源:signalfilebrowserwindow.cpp


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