本文整理汇总了C++中QToolBar::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::setSizePolicy方法的具体用法?C++ QToolBar::setSizePolicy怎么用?C++ QToolBar::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::setSizePolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QToolBar
ToolBox::ToolBox(QWidget *parentWidget)
: Utils::StyledBar(parentWidget),
m_leftToolBar(new QToolBar(QLatin1String("LeftSidebar"), this)),
m_rightToolBar(new QToolBar(QLatin1String("RightSidebar"), this))
{
setMaximumHeight(22);
m_leftToolBar->setFloatable(true);
m_leftToolBar->setMovable(true);
m_leftToolBar->setOrientation(Qt::Horizontal);
m_leftToolBar->setIconSize(QSize(24, 24));
QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
horizontalLayout->setMargin(0);
horizontalLayout->setSpacing(0);
QToolBar *stretchToolbar = new QToolBar(this);
m_leftToolBar->setProperty("panelwidget", true);
m_leftToolBar->setProperty("panelwidget_singlerow", false);
m_rightToolBar->setProperty("panelwidget", true);
m_rightToolBar->setProperty("panelwidget_singlerow", false);
stretchToolbar->setProperty("panelwidget", true);
stretchToolbar->setProperty("panelwidget_singlerow", false);
stretchToolbar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_rightToolBar->setOrientation(Qt::Horizontal);
m_rightToolBar->setIconSize(QSize(24, 24));
horizontalLayout->addWidget(m_leftToolBar);
horizontalLayout->addWidget(stretchToolbar);
horizontalLayout->addWidget(m_rightToolBar);
}
示例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();
}
示例3: QToolBar
ToolBox::ToolBox(QWidget *parentWidget)
: Utils::StyledBar(parentWidget),
m_leftToolBar(new QToolBar("LeftSidebar", this)),
m_rightToolBar(new QToolBar("RightSidebar", this))
{
setMaximumHeight(44);
setSingleRow(false);
QFrame *frame = new QFrame(this);
m_crumblePath = new Utils::CrumblePath(frame);
frame->setStyleSheet("background-color: #4e4e4e;");
frame->setFrameShape(QFrame::NoFrame);
QHBoxLayout *layout = new QHBoxLayout(frame);
layout->setMargin(0);
layout->setSpacing(0);
frame->setLayout(layout);
layout->addWidget(m_crumblePath);
frame->setProperty("panelwidget", true);
frame->setProperty("panelwidget_singlerow", false);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->setMargin(0);
verticalLayout->setSpacing(0);
QHBoxLayout *horizontalLayout = new QHBoxLayout();
verticalLayout->addLayout(horizontalLayout);
verticalLayout->addWidget(frame);
horizontalLayout->setMargin(0);
horizontalLayout->setSpacing(0);
m_leftToolBar->setFloatable(true);
m_leftToolBar->setMovable(true);
m_leftToolBar->setOrientation(Qt::Horizontal);
m_leftToolBar->setIconSize(QSize(24, 24));
QToolBar *stretchToolbar = new QToolBar(this);
setSingleRow(false);
m_leftToolBar->setProperty("panelwidget", true);
m_leftToolBar->setProperty("panelwidget_singlerow", false);
m_rightToolBar->setProperty("panelwidget", true);
m_rightToolBar->setProperty("panelwidget_singlerow", false);
stretchToolbar->setProperty("panelwidget", true);
stretchToolbar->setProperty("panelwidget_singlerow", false);
stretchToolbar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_rightToolBar->setOrientation(Qt::Horizontal);
m_rightToolBar->setIconSize(QSize(24, 24));
horizontalLayout->addWidget(m_leftToolBar);
horizontalLayout->addWidget(stretchToolbar);
horizontalLayout->addWidget(m_rightToolBar);
}
示例4:
QToolBar * DesignNetFormManager::createEditorToolBar() const
{
QToolBar *editorToolBar = new QToolBar;
const QList<Core::Id>::const_iterator cend = d->m_toolActionIds.constEnd();
for (QList<Core::Id>::const_iterator it = d->m_toolActionIds.constBegin(); it != cend; ++it)
{
Core::Command *cmd = Core::ActionManager::instance()->command(*it);
QAction *action = cmd->action();
if (!action->icon().isNull())
editorToolBar->addAction(action);
}
const int size = editorToolBar->style()->pixelMetric(QStyle::PM_SmallIconSize);
editorToolBar->setIconSize(QSize(size, size));
editorToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
return editorToolBar;
}
示例5:
QToolBar *FormEditorW::createEditorToolBar() const
{
QToolBar *editorToolBar = new QToolBar;
const QList<Id>::const_iterator cend = m_toolActionIds.constEnd();
for (QList<Id>::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) {
Command *cmd = ActionManager::command(*it);
QTC_ASSERT(cmd, continue);
QAction *action = cmd->action();
if (!action->icon().isNull()) // Simplify grid has no action yet
editorToolBar->addAction(action);
}
const int size = editorToolBar->style()->pixelMetric(QStyle::PM_SmallIconSize);
editorToolBar->setIconSize(QSize(size, size));
editorToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
return editorToolBar;
}
示例6: QPushButton
Test4Window::Test4Window(const QString &sql)
: Ui::Test4Window()
{
Ui::Test4Window::setupUi(this);
QToolBar *toolBar = QMainWindow::addToolBar("TB");
toolBar->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
toolBar->setFocusPolicy(Qt::NoFocus);
pushButton = new QPushButton("Oracle", toolBar);
pushButton->setFlat(true);
toolBar->addWidget(pushButton);
connect(pushButton, SIGNAL(released()), this, SLOT(setLexer()));
QAction *oracle = new QAction("Oracle", this);
QAction *mysql = new QAction("MySQL", this);
oracle->setCheckable(true);
oracle->setChecked(true);
mysql->setCheckable(true);
mysql->setChecked(false);
QActionGroup* group = new QActionGroup(this);
oracle->setActionGroup(group);
mysql->setActionGroup(group);
menuGrammar->addAction(oracle);
menuGrammar->addAction(mysql);
editorLeft = new toSqlText(this);
leftVerticalLayout->addWidget(editorLeft);
editorLeft->setText(sql);
editorLeft->enableToolTips();
editorRight = new toSqlText(this);
editorRight->setHighlighter(toSqlText::Oracle);
rightVerticalLayout->addWidget(editorRight);
editorRight->setText(sql);
editorRight->setMarginType(2, QsciScintilla::TextMarginRightJustified);
editorRight->setMarginWidth(2, QString::fromLatin1("009"));
editorRight->enableToolTips();
connect(oracle, SIGNAL(triggered()), this, SLOT(setOracle()));
connect(mysql, SIGNAL(triggered()), this, SLOT(setMySQL()));
connect(actionLoad, SIGNAL(triggered()), this, SLOT(load()));
connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
QMainWindow::show();
}
示例7: QWidget
BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
: QWidget( parent ), m_document( document ), m_currentDocumentItem( 0 )
{
QVBoxLayout *mainlay = new QVBoxLayout( this );
mainlay->setMargin( 0 );
mainlay->setSpacing( 6 );
m_searchLine = new KTreeWidgetSearchLine( this );
mainlay->addWidget( m_searchLine );
m_tree = new QTreeWidget( this );
mainlay->addWidget( m_tree );
QStringList cols;
cols.append( "Bookmarks" );
m_tree->setContextMenuPolicy( Qt::CustomContextMenu );
m_tree->setHeaderLabels( cols );
m_tree->setSortingEnabled( false );
m_tree->setRootIsDecorated( true );
m_tree->setAlternatingRowColors( true );
m_tree->setItemDelegate( new PageItemDelegate( m_tree ) );
m_tree->header()->hide();
m_tree->setSelectionBehavior( QAbstractItemView::SelectRows );
m_tree->setEditTriggers( QAbstractItemView::EditKeyPressed );
connect( m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotExecuted(QTreeWidgetItem*)) );
connect( m_tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)) );
m_searchLine->addTreeWidget( m_tree );
QToolBar * bookmarkController = new QToolBar( this );
mainlay->addWidget( bookmarkController );
bookmarkController->setObjectName( QLatin1String( "BookmarkControlBar" ) );
// change toolbar appearance
bookmarkController->setIconSize( QSize( 16, 16 ) );
bookmarkController->setMovable( false );
QSizePolicy sp = bookmarkController->sizePolicy();
sp.setVerticalPolicy( QSizePolicy::Minimum );
bookmarkController->setSizePolicy( sp );
// insert a togglebutton [show only bookmarks in the current document]
m_showBoomarkOnlyAction = bookmarkController->addAction( KIcon( "bookmarks" ), i18n( "Current document only" ) );
m_showBoomarkOnlyAction->setCheckable( true );
connect( m_showBoomarkOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotFilterBookmarks(bool)) );
connect( m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)), this, SLOT(slotBookmarksChanged(KUrl)) );
rebuildTree( m_showBoomarkOnlyAction->isChecked() );
}
示例8: catch
QToolBar *toAllocBar(QWidget *parent, const QString &str)
{
QString db;
try
{
db = toConnection::currentConnection(parent).description(false);
}
catch (QString const& e)
{
TLOG(1, toDecorator, __HERE__) << " Ignored exception: " << e << std::endl;
}
catch (...)
{
TLOG(1, toDecorator, __HERE__) << " Ignored exception." << std::endl;
}
QString name = str;
if (!db.isEmpty() && toConfigurationNewSingle::Instance().option(ToConfiguration::Global::IncludeDbCaptionBool).toBool())
{
name += QString::fromLatin1(" ");
name += db;
}
QToolBar *tool;
QMainWindow *main = dynamic_cast<QMainWindow *>(parent);
if (main)
tool = toMainWindow::lookup()->addToolBar(name);
else
tool = new QToolBar(parent);
// Enforce smaller toolbars on mac
tool->setIconSize(QSize(16, 16));
tool->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Fixed));
tool->setFocusPolicy(Qt::NoFocus);
return tool;
}
示例9: createToolbar
void MainWindow::createToolbar()
{
//
// Main toolbar
//
QToolBar* toolbar = new QToolBar("File Toolbar");
toolbar->addAction(QIcon(":/icons/new.png"), "New", this, SLOT(newFile()));
toolbar->addAction(QIcon(":/icons/open.png"), "Open", this, SLOT(openFile()));
mActionsRequiringFiles.append(toolbar->addAction(QIcon(":/icons/save.png"), "Save", this, SLOT(saveFile())));
toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
addToolBar(toolbar);
registerContextMenuItem(toolbar);
toolbar->setObjectName("File Toolbar");
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
toolbar->addWidget(spacer);
toolbar->setStyleSheet("QToolBar { margin: 0px; padding: 0px; spacing: 3px; }");
toolbar->setStyleSheet("QToolButton { margin: 0px; padding: 0px; width:22px; height:22px }");
//
// View toolbar
//
toolbar = new QToolBar("View Toolbar");
mActionsRequiringFiles.append(toolbar->addAction(QIcon(":/icons/verticalsplit.png"), "Split View Vertically", gWindowManager, SLOT(splitVertically())));
mActionsRequiringFiles.append(toolbar->addAction(QIcon(":/icons/horizontalsplit.png"), "Split View Horizontally", gWindowManager, SLOT(splitHorizontally())));
mActionsRequiringSplitViews.append(toolbar->addAction(QIcon(":/icons/removesplit.png"), "Remove Split", gWindowManager, SLOT(removeSplit())));
addToolBar(toolbar);
registerContextMenuItem(toolbar);
toolbar->setObjectName("View Toolbar");
toolbar->setStyleSheet("QToolBar { margin: 0px; padding: 0px; spacing: 3px; }");
toolbar->setStyleSheet("QToolButton { margin: 0px; padding: 0px; width:22px; height:22px }");
}
示例10: extensionsInitialized
/**
* When all dependent plugins are initialized, start the second initialization:
* - setup ui
* - start update checker
* - read settings
*/
void MainWindow::extensionsInitialized()
{
// Creating MainWindow UI
ui = new Internal::Ui::MainWindow();
ui->setupUi(this);
if (layout())
layout()->setMargin(0);
QWidget *header = new QWidget(this);
_headerWidget = new Internal::Ui::HeaderWidget();
_headerWidget->setupUi(header);
_headerWidget->edrcVersion->setText(edrcCore().currentDatabaseVersion());
_headerWidget->patientName->setPlaceholderText(tkTr(Trans::Constants::PATIENT_NAME));
ui->crListViewer->addHeaderWidget(header);
// Creating ToolBar
QToolBar *bar = new QToolBar(this);
bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
bar->setIconSize(QSize(32, 32));
QStringList uids;
uids << Core::Constants::A_FILE_OPEN
<< Core::Constants::A_FILE_SAVE
<< Core::Constants::A_FILE_SAVEAS
<< "--"
<< Core::Constants::A_FILE_PRINT
<< "->"
<< eDRC::Constants::A_SHOW_DBINFO
<< eDRC::Constants::A_ABOUT_SFMG
;
foreach(const QString &uid, uids) {
if (uid=="--") {
bar->addSeparator();
continue;
} else if (uid=="->") {
QWidget *w = new QWidget(bar);
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
w->setLayout(new QHBoxLayout(w));
w->layout()->addItem(new QSpacerItem(10,10, QSizePolicy::Expanding, QSizePolicy::Expanding));
bar->addWidget(w);
continue;
} else {
Core::Command *cmd = actionManager()->command(Core::Id(uid));
if (cmd)
bar->addAction(cmd->action());
}
}
bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
setUnifiedTitleAndToolBarOnMac(true);
addToolBar(bar);
// Create models
_crTreeModel = new CrTreeModel(this);
ui->crListViewer->setConsultResultTreeModel(_crTreeModel);
// Disable some actions when starting as medintux plugin
// if (commandLine()->value(Core::Constants::CL_MedinTux).toBool()) {
// this->aNew->setEnabled(false);
// this->aSave->setEnabled(false);
// this->aMedinTux->setEnabled(false);
// }
// If needed read exchange out file
// const QString &exfile = commandLine()->value(Core::Constants::CL_ExchangeOutFile).toString();
// if (!exfile.isEmpty()) {
// messageSplash(tr("Reading exchange file..."));
// if (commandLine()->value(Core::Internal::CommandLine::CL_MedinTux).toBool()) {
// Utils::Log::addMessage(this, tr("Reading a MedinTux exchange file."));
// QString tmp = Utils::readTextFile(exfile, Utils::DontWarnUser);
// Utils::Log::addMessage(this, "Content of the exchange file : " + tmp);
// if (tmp.contains(DrugsDB::Constants::ENCODEDHTML_FREEDIAMSTAG)) {
// int begin = tmp.indexOf(DrugsDB::Constants::ENCODEDHTML_FREEDIAMSTAG) + QString(DrugsDB::Constants::ENCODEDHTML_FREEDIAMSTAG).length();
// int end = tmp.indexOf("\"", begin);
// QString encoded = tmp.mid( begin, end - begin );
// DrugsDB::DrugsIO::instance()->prescriptionFromXml(drugModel(), QByteArray::fromBase64(encoded.toAscii()));
// } else if (tmp.contains("DrugsInteractionsEncodedPrescription:")) {
// // TODO: Manage wrong file encoding */
// int begin = tmp.indexOf("DrugsInteractionsEncodedPrescription:") + QString("DrugsInteractionsEncodedPrescription:").length();
// int end = tmp.indexOf("\"", begin);
// QString encoded = tmp.mid( begin, end - begin );
// DrugsDB::DrugsIO::instance()->prescriptionFromXml(drugModel(), QByteArray::fromBase64(encoded.toAscii()));
// }
// } else {
// QString extras;
// DrugsDB::DrugsIO::loadPrescription(drugModel(), exfile, extras);
// patient()->fromXml(extras);
// }
// }
// Start the update checker
if (updateChecker()->needsUpdateChecking(settings()->getQSettings())) {
settings()->setPath(Core::ISettings::UpdateUrl, Utils::Constants::FREEDRC_UPDATE_URL);
if (checkUpdate())
settings()->setValue(Utils::Constants::S_LAST_CHECKUPDATE, QDate::currentDate());
}
//.........这里部分代码省略.........
示例11: 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);
}
示例12: setupUi
void Player::setupUi()
{
// QTextStream out(stderr,QIODevice::WriteOnly);
QToolBar *bar = new QToolBar;
bar->setStyleSheet("QToolBar { border: 0px }");
bar->addAction(previousAction);
bar->addAction(playAction);
bar->addAction(pauseAction);
bar->addAction(stopAction);
bar->addAction(nextAction);
bar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
m_seekSlider = new QSlider(this);
m_pictureLabel = new QLabel();
m_pictureLabel->setMaximumHeight(150);
m_pictureLabel->setMaximumWidth(150);
m_pictureLabel->setScaledContents(true);
QHBoxLayout* m_horizonLayout = new QHBoxLayout();
m_horizonLayout->addWidget(m_pictureLabel);
m_seekSlider->setOrientation(Qt::Horizontal);
connect(this,SIGNAL(positionTime(int)),m_seekSlider,SLOT(setValue(int)));
connect(m_mediaPlayer,SIGNAL(positionChanged(qint64)),this,SLOT(tick(qint64)));
connect(m_seekSlider,SIGNAL(sliderMoved(int)),this,SLOT(setTime(int)));
connect(m_mediaPlayer,SIGNAL(durationChanged(qint64)),this,SLOT(setDuration(qint64)));
QToolBar *bar2 = new QToolBar;
bar2->addWidget(randomly);
bar2->setStyleSheet("QToolBar { border: 0px }");
m_volumeSlider = new QSlider(this);
m_volumeSlider->setOrientation(Qt::Horizontal);
m_volumeSlider->setRange(0,100);
connect(m_volumeSlider,SIGNAL(valueChanged(int)),m_mediaPlayer,SLOT(setVolume(int)));
m_volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
QPalette palette;
palette.setBrush(QPalette::Light, Qt::darkGray);
m_timeLcd = new QLCDNumber;
m_timeLcd->setPalette(palette);
m_timeLcd->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
title = new QLineEdit;
title->setReadOnly(true);
#ifdef REPEAT
m_repeatCheck = new QCheckBox(tr("Repeat:"),this);
connect(m_repeatCheck,SIGNAL(clicked()),this,SLOT(setRepeat()));
m_repeatCheck->setChecked(m_repeatState);
#endif
QHBoxLayout *seekerLayout = new QHBoxLayout;
seekerLayout->setMargin(0);
//seekerLayout->setPadding(0);
seekerLayout->addWidget(m_seekSlider);
seekerLayout->addWidget(m_timeLcd);
QHBoxLayout *playbackLayout = new QHBoxLayout;
playbackLayout->setMargin(0);
// playbackLayout->setPadding(0);
playbackLayout->addWidget(bar);
playbackLayout->addWidget(title);
playbackLayout->addWidget(bar2);
#ifdef REPEAT
playbackLayout->addWidget(m_repeatCheck);
#endif
playbackLayout->addStretch();
playbackLayout->addWidget(m_volumeSlider);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setMargin(0);
// mainLayout->setPadding(0);
mainLayout->addLayout(seekerLayout);
mainLayout->addLayout(playbackLayout);
m_horizonLayout->addLayout(mainLayout);
setLayout(m_horizonLayout);
}
示例13: Tab
//.........这里部分代码省略.........
QVBoxLayout *rightFrame = new QVBoxLayout;
rightFrame->addLayout(grid);
rightFrame->addWidget(deckView, 10);
rightFrame->addLayout(deckToolbarLayout);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addLayout(leftFrame, 10);
mainLayout->addLayout(middleFrame);
mainLayout->addLayout(rightFrame);
setLayout(mainLayout);
aNewDeck = new QAction(QString(), this);
aNewDeck->setShortcuts(QKeySequence::New);
connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck()));
aLoadDeck = new QAction(QString(), this);
aLoadDeck->setShortcuts(QKeySequence::Open);
connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck()));
aSaveDeck = new QAction(QString(), this);
aSaveDeck->setShortcuts(QKeySequence::Save);
connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck()));
aSaveDeckAs = new QAction(QString(), this);
// aSaveDeckAs->setShortcuts(QKeySequence::SaveAs);
connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs()));
aLoadDeckFromClipboard = new QAction(QString(), this);
connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard()));
aLoadDeckFromClipboard->setShortcuts(QKeySequence::Paste);
aSaveDeckToClipboard = new QAction(QString(), this);
connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard()));
aSaveDeckToClipboard->setShortcuts(QKeySequence::Copy);
aPrintDeck = new QAction(QString(), this);
aPrintDeck->setShortcuts(QKeySequence::Print);
connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck()));
aAnalyzeDeck = new QAction(QString(), this);
connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck()));
aClose = new QAction(QString(), this);
connect(aClose, SIGNAL(triggered()), this, SLOT(closeRequest()));
aOpenCustomFolder = new QAction(QString(), this);
connect(aOpenCustomFolder, SIGNAL(triggered()), this, SLOT(actOpenCustomFolder()));
aEditSets = new QAction(QString(), this);
connect(aEditSets, SIGNAL(triggered()), this, SLOT(actEditSets()));
aEditTokens = new QAction(QString(), this);
connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens()));
deckMenu = new QMenu(this);
deckMenu->addAction(aNewDeck);
deckMenu->addAction(aLoadDeck);
deckMenu->addAction(aSaveDeck);
deckMenu->addAction(aSaveDeckAs);
deckMenu->addSeparator();
deckMenu->addAction(aLoadDeckFromClipboard);
deckMenu->addAction(aSaveDeckToClipboard);
deckMenu->addSeparator();
deckMenu->addAction(aPrintDeck);
deckMenu->addSeparator();
deckMenu->addAction(aAnalyzeDeck);
deckMenu->addSeparator();
deckMenu->addAction(aClose);
addTabMenu(deckMenu);
dbMenu = new QMenu(this);
dbMenu->addAction(aEditSets);
dbMenu->addAction(aEditTokens);
dbMenu->addSeparator();
dbMenu->addAction(aClearFilterAll);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
dbMenu->addSeparator();
dbMenu->addAction(aOpenCustomFolder);
#endif
addTabMenu(dbMenu);
aAddCard = new QAction(QString(), this);
aAddCard->setIcon(QIcon(":/resources/arrow_right_green.svg"));
connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard()));
aAddCardToSideboard = new QAction(QString(), this);
aAddCardToSideboard->setIcon(QIcon(":/resources/add_to_sideboard.svg"));
connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard()));
aRemoveCard = new QAction(QString(), this);
aRemoveCard->setIcon(QIcon(":/resources/remove_row.svg"));
connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard()));
aIncrement = new QAction(QString(), this);
aIncrement->setIcon(QIcon(":/resources/increment.svg"));
connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement()));
aDecrement = new QAction(QString(), this);
aDecrement->setIcon(QIcon(":/resources/decrement.svg"));
connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement()));
deckEditToolBar->addAction(aAddCard);
deckEditToolBar->addAction(aAddCardToSideboard);
deckEditToolBar->addAction(aRemoveCard);
deckEditToolBar->addAction(aDecrement);
deckEditToolBar->addAction(aIncrement);
deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
retranslateUi();
resize(950, 700);
QTimer::singleShot(0, this, SLOT(checkFirstRunDetected()));
}
示例14: QFrame
dtkPlotViewToolBar::dtkPlotViewToolBar(dtkPlotView *parent) : QFrame(parent->widget()), d(new dtkPlotViewToolBarPrivate())
{
QToolBar *bar = new QToolBar(this);
d->view = parent;
d->defaultViewAction = new QAction("Default", this);
d->defaultViewAction->setToolTip("Show default view");
d->defaultViewAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotAxis.png"));
d->gridAction = new QAction("Grid", this);
d->gridAction->setCheckable(true);
d->gridAction->setChecked(false);
d->gridAction->setToolTip("Draw grid coodinates");
d->gridAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotGrid.png"));
d->pickingAction = new QAction("Picking", this);
d->pickingAction->setCheckable(true);
d->pickingAction->setChecked(false);
d->pickingAction->setToolTip("Activate picking");
d->pickingAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotPicking.png"));
d->zoomAction = new QAction("Zoom", this);
d->zoomAction->setCheckable(true);
d->zoomAction->setChecked(false);
d->zoomAction->setToolTip("Activate zoom");
d->zoomAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotZoom.png"));
d->legendAction = new QAction("Legend", this);
d->legendAction->setCheckable(true);
d->legendAction->setChecked(false);
d->legendAction->setToolTip("Activate legend");
d->legendAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotLegend.png"));
d->exportAction = new QAction("Export", this);
d->exportAction->setToolTip("Export view");
d->exportAction->setIcon(QPixmap(":dtkPlot/pixmaps/dtkPlotSupportExport.png"));
bar->addAction(d->defaultViewAction);
bar->addAction(d->zoomAction);
bar->addAction(d->gridAction);
bar->addAction(d->pickingAction);
bar->addAction(d->legendAction);
bar->addWidget(new dtkSpacer);
bar->addAction(d->exportAction);
bar->setFloatable(false);
bar->setIconSize(QSize(18, 18));
bar->setMovable(false);
bar->setOrientation(Qt::Horizontal);
bar->setFixedHeight(25);
bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(bar);
connect(d->defaultViewAction, SIGNAL(triggered(bool)), this, SLOT(onDefaultView()));
connect(d->zoomAction, SIGNAL(triggered(bool)), this, SLOT(onZoomActivated(bool)));
connect(d->gridAction, SIGNAL(triggered(bool)), this, SLOT(onGridActivated(bool)));
connect(d->pickingAction, SIGNAL(triggered(bool)), this, SLOT(onPickingActivated(bool)));
connect(d->legendAction, SIGNAL(triggered(bool)), this, SLOT(onLegendActivated(bool)));
connect(d->exportAction, SIGNAL(triggered()), this, SLOT(onExport()));
}
示例15: createCentralFrame
void TabDeckEditor::createCentralFrame()
{
searchEdit = new SearchLineEdit;
searchEdit->setObjectName("searchEdit");
#if QT_VERSION >= 0x050300
searchEdit->addAction(QPixmap("theme:icons/search"), QLineEdit::LeadingPosition);
#endif
setFocusProxy(searchEdit);
setFocusPolicy(Qt::ClickFocus);
searchEdit->installEventFilter(&searchKeySignals);
searchKeySignals.setObjectName("searchKeySignals");
connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &)));
connect(&searchKeySignals, SIGNAL(onEnter()), this, SLOT(actAddCard()));
connect(&searchKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actAddCard()));
connect(&searchKeySignals, SIGNAL(onCtrlAltRBracket()), this, SLOT(actAddCardToSideboard()));
connect(&searchKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrementCard()));
connect(&searchKeySignals, SIGNAL(onCtrlAltLBracket()), this, SLOT(actDecrementCardFromSideboard()));
connect(&searchKeySignals, SIGNAL(onCtrlAltEnter()), this, SLOT(actAddCardToSideboard()));
connect(&searchKeySignals, SIGNAL(onCtrlEnter()), this, SLOT(actAddCardToSideboard()));
databaseModel = new CardDatabaseModel(db, this);
databaseModel->setObjectName("databaseModel");
databaseDisplayModel = new CardDatabaseDisplayModel(this);
databaseDisplayModel->setSourceModel(databaseModel);
databaseDisplayModel->setFilterKeyColumn(0);
databaseDisplayModel->sort(0, Qt::AscendingOrder);
databaseView = new QTreeView();
databaseView->setObjectName("databaseView");
databaseView->setFocusProxy(searchEdit);
databaseView->setModel(databaseDisplayModel);
databaseView->setUniformRowHeights(true);
databaseView->setRootIsDecorated(false);
databaseView->setAlternatingRowColors(true);
databaseView->setSortingEnabled(true);
databaseView->sortByColumn(0, Qt::AscendingOrder);
databaseView->resizeColumnToContents(0);
connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &)));
connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard()));
searchEdit->setTreeView(databaseView);
aAddCard = new QAction(QString(), this);
aAddCard->setIcon(QPixmap("theme:icons/arrow_right_green"));
connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard()));
aAddCardToSideboard = new QAction(QString(), this);
aAddCardToSideboard->setIcon(QPixmap("theme:icons/arrow_right_blue"));
connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard()));
aRemoveCard = new QAction(QString(), this);
aRemoveCard->setIcon(QPixmap("theme:icons/remove_row"));
connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard()));
aIncrement = new QAction(QString(), this);
aIncrement->setIcon(QPixmap("theme:icons/increment"));
connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement()));
aDecrement = new QAction(QString(), this);
aDecrement->setIcon(QPixmap("theme:icons/decrement"));
connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement()));
QToolBar *deckEditToolBar = new QToolBar;
deckEditToolBar->setObjectName("deckEditToolBar");
deckEditToolBar->setOrientation(Qt::Horizontal);
deckEditToolBar->setIconSize(QSize(24, 24));
deckEditToolBar->addAction(aAddCard);
deckEditToolBar->addAction(aAddCardToSideboard);
deckEditToolBar->addAction(aRemoveCard);
deckEditToolBar->addAction(aDecrement);
deckEditToolBar->addAction(aIncrement);
deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
searchLayout = new QHBoxLayout;
searchLayout->setObjectName("searchLayout");
searchLayout->addWidget(deckEditToolBar);
searchLayout->addWidget(searchEdit);
createShowHideDocksButtons();
centralFrame = new QVBoxLayout;
centralFrame->setObjectName("centralFrame");
centralFrame->addLayout(searchLayout);
centralFrame->addWidget(databaseView);
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName("centralWidget");
centralWidget->setLayout(centralFrame);
MainWindow->setCentralWidget(centralWidget);
MainWindow->setDockOptions(QMainWindow::AnimatedDocks|QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->setObjectName("mainLayout");
mainLayout->addWidget(MainWindow);
setLayout(mainLayout);
}