本文整理汇总了C++中QBoxLayout::addStretch方法的典型用法代码示例。如果您正苦于以下问题:C++ QBoxLayout::addStretch方法的具体用法?C++ QBoxLayout::addStretch怎么用?C++ QBoxLayout::addStretch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout::addStretch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
NewGameView::NewGameView( QWidget *parent )
: QWidget( parent )
{
QBoxLayout *topLayout = new QVBoxLayout( this );
topLayout->setSpacing( 8 );
topLayout->setMargin( 8 );
topLayout->addStretch( 1 );
m_timesTableCheck = new QCheckBox( i18n("Times Table"), this );
topLayout->addWidget( m_timesTableCheck );
m_timesTableCheck->setChecked( true );
topLayout->addLayout( createRowChecks( m_multiplicationRowChecks ) );
m_divisionCheck = new QCheckBox( i18n("Division"), this );
topLayout->addWidget( m_divisionCheck );
topLayout->addLayout( createRowChecks( m_divisionRowChecks ) );
m_squareNumbersCheck = new QCheckBox( i18n("Square Numbers"), this );
topLayout->addWidget( m_squareNumbersCheck );
m_cubicNumbersCheck = new QCheckBox( i18n("Cubic Numbers"), this );
topLayout->addWidget( m_cubicNumbersCheck );
topLayout->addStretch( 1 );
QPushButton *startButton = new QPushButton( i18n("Start"), this );
topLayout->addWidget( startButton );
connect( startButton, SIGNAL( clicked() ), SLOT( slotStartClicked() ) );
topLayout->addStretch( 1 );
}
示例2: LicqDialog
//TODO Add a drop down list of the avaialable protocols
// that a user may be added for
AddUserDlg::AddUserDlg(CICQDaemon *s, const char* szId, unsigned long PPID,
QWidget *parent)
: LicqDialog(parent, "AddUserDialog")
{
server = s;
QBoxLayout *lay = new QBoxLayout(this, QBoxLayout::Down, 8);
QFrame *frmProtocol = new QFrame(this);
QFrame *frmUin = new QFrame(this);
QFrame *frmBtn = new QFrame(this);
lay->addWidget(frmProtocol);
lay->addWidget(frmUin);
lay->addSpacing(5);
lay->addStretch();
lay->addWidget(frmBtn);
QBoxLayout *layProtocol = new QBoxLayout(frmProtocol, QBoxLayout::LeftToRight);
lblProtocol = new QLabel(tr("Protocol:"), frmProtocol);
cmbProtocol = new QComboBox(frmProtocol);
layProtocol->addWidget(lblProtocol);
layProtocol->addWidget(cmbProtocol);
// Fill the combo list now
ProtoPluginsList pl;
ProtoPluginsListIter it;
server->ProtoPluginList(pl);
uint index = 0;
uint ppidIndex = 0;
for (it = pl.begin(); it != pl.end(); it++, ++index)
{
cmbProtocol->insertItem((*it)->Name());
if ((*it)->PPID() == PPID) ppidIndex = index;
}
cmbProtocol->setCurrentItem(ppidIndex);
QBoxLayout *layUin = new QBoxLayout(frmUin, QBoxLayout::LeftToRight);
lblUin = new QLabel(tr("New User ID:"), frmUin);
edtUin = new QLineEdit(frmUin);
layUin->addWidget(lblUin);
layUin->addWidget(edtUin);
if (szId != 0) edtUin->setText(szId);
QBoxLayout *layBtn = new QBoxLayout(frmBtn, QBoxLayout::LeftToRight);
btnOk = new QPushButton(tr("&Ok"), frmBtn);
btnCancel = new QPushButton(tr("&Cancel"), frmBtn);
layBtn->addStretch();
layBtn->addWidget(btnOk);
layBtn->addSpacing(20);
layBtn->addWidget(btnCancel);
setCaption(tr("Licq - Add User"));
connect (btnOk, SIGNAL(clicked()), SLOT(ok()) );
connect (edtUin, SIGNAL(returnPressed()), SLOT(ok()) );
connect (btnCancel, SIGNAL(clicked()), SLOT(reject()) );
// Set Tab Order
setTabOrder(edtUin, btnOk);
setTabOrder(btnOk, btnCancel);
}
示例3: QWidget
RecipientsEditorSideWidget::RecipientsEditorSideWidget(RecipientsEditor *view, QWidget *parent)
: QWidget(parent), mEditor(view), mRecipientPicker(Q_NULLPTR), mPickerPositioner(Q_NULLPTR)
{
QBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
topLayout->addStretch(1);
mTotalLabel = new QLabel(this);
mTotalLabel->setAlignment(Qt::AlignCenter);
topLayout->addWidget(mTotalLabel);
mTotalLabel->hide();
topLayout->addStretch(1);
mDistributionListButton = new QPushButton(
i18nc("@action:button", "Save List..."), this);
topLayout->addWidget(mDistributionListButton);
mDistributionListButton->hide();
connect(mDistributionListButton, &QAbstractButton::clicked,
this, &RecipientsEditorSideWidget::saveDistributionList);
mDistributionListButton->setToolTip(
i18nc("@info:tooltip", "Save recipients as distribution list"));
mSelectButton = new QPushButton(
i18nc("@action:button Open recipient selection dialog.", "Se&lect..."), this);
topLayout->addWidget(mSelectButton);
connect(mSelectButton, &QPushButton::clicked, this, &RecipientsEditorSideWidget::pickRecipient);
mSelectButton->setToolTip(i18nc("@info:tooltip", "Select recipients from address book"));
updateTotalToolTip();
}
示例4: QWidget
WaitingOverlay::WaitingOverlay(KJob *job, QWidget *baseWidget, QWidget *parent)
: QWidget(parent ? parent : baseWidget->window())
, mBaseWidget(baseWidget)
{
Q_ASSERT(baseWidget);
Q_ASSERT(parentWidget() != baseWidget);
connect(baseWidget, &QObject::destroyed, this, &QObject::deleteLater);
connect(job, &KJob::result, this, &QObject::deleteLater);
mPreviousState = mBaseWidget->isEnabled();
QBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->addStretch();
QLabel *description = new QLabel(this);
description->setText(i18n("<p style=\"color: white;\"><b>Waiting for operation</b><br/></p>"));
description->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
topLayout->addWidget(description);
topLayout->addStretch();
QPalette p = palette();
p.setColor(backgroundRole(), QColor(0, 0, 0, 128));
setPalette(p);
setAutoFillBackground(true);
mBaseWidget->installEventFilter(this);
reposition();
}
示例5: setupGeneral
void KOTodoEditor::setupGeneral()
{
mGeneral = new KOEditorGeneralTodo(this);
if(KOPrefs::instance()->mCompactDialogs)
{
QFrame *topFrame = addPage(i18n("General"));
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
topLayout->setMargin(marginHint());
topLayout->setSpacing(spacingHint());
mGeneral->initHeader(topFrame, topLayout);
mGeneral->initTime(topFrame, topLayout);
QHBoxLayout *priorityLayout = new QHBoxLayout(topLayout);
mGeneral->initPriority(topFrame, priorityLayout);
topLayout->addStretch(1);
QFrame *topFrame2 = addPage(i18n("Details"));
QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
topLayout2->setMargin(marginHint());
topLayout2->setSpacing(spacingHint());
QHBoxLayout *completionLayout = new QHBoxLayout(topLayout2);
mGeneral->initCompletion(topFrame2, completionLayout);
mGeneral->initAlarm(topFrame, topLayout);
mGeneral->initSecrecy(topFrame2, topLayout2);
mGeneral->initDescription(topFrame2, topLayout2);
}
else
{
QFrame *topFrame = addPage(i18n("&General"));
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
topLayout->setSpacing(spacingHint());
mGeneral->initHeader(topFrame, topLayout);
mGeneral->initTime(topFrame, topLayout);
mGeneral->initStatus(topFrame, topLayout);
QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
mGeneral->initAlarm(topFrame, alarmLineLayout);
alarmLineLayout->addStretch(1);
mGeneral->initDescription(topFrame, topLayout);
mGeneral->initAttachments(topFrame, topLayout);
connect(mGeneral, SIGNAL(openURL(const KURL &)),
this, SLOT(openURL(const KURL &)));
connect(this, SIGNAL(signalAddAttachments(const QStringList &, const QStringList &, bool)),
mGeneral, SLOT(addAttachments(const QStringList &, const QStringList &, bool)));
}
mGeneral->enableAlarm(true);
mGeneral->finishSetup();
}
示例6: QLabel
GTrans::GTrans() {
QLayout *mainLayout = new QVBoxLayout;
// The input section
QLayout *top = new QHBoxLayout;
QBoxLayout *tl = new QVBoxLayout;
QLabel *inLabel = new QLabel(tr("Input:"));
fromLang = new QComboBox;
tl->addWidget(inLabel);
tl->addSpacing(10);
tl->addWidget(fromLang);
tl->addStretch();
top->addItem(tl);
inputTxt = new QTextEdit;
top->addWidget(inputTxt);
// The output section
QLayout *bottom = new QHBoxLayout;
QBoxLayout *bl = new QVBoxLayout;
QLabel *outLabel = new QLabel(tr("Output:"));
toLang = new QComboBox;
bl->addWidget(outLabel);
bl->addSpacing(10);
bl->addWidget(toLang);
bl->addStretch();
bottom->addItem(bl);
outputTxt = new QTextEdit;
outputTxt->setReadOnly(true);
bottom->addWidget(outputTxt);
mainLayout->addItem(top);
mainLayout->addItem(bottom);
// Translate button
trans_b = new QPushButton(tr("Translate"));
mainLayout->addWidget(trans_b);
fillInLanguages();
setLayout(mainLayout);
setWindowTitle(tr("Translate"));
trans_b->setDefault(true);
connect(trans_b, SIGNAL(clicked()), this, SLOT(doTrans()));
// Setup foxus and tab order.
inputTxt->setTabChangesFocus(true);
inputTxt->setFocus(Qt::ActiveWindowFocusReason);
setTabOrder(inputTxt, toLang);
setTabOrder(toLang, trans_b);
setTabOrder(trans_b, fromLang);
setTabOrder(fromLang, inputTxt);
outputTxt->setFocusProxy(trans_b);
}
示例7: addToolBarToLayout
static void addToolBarToLayout( QMainWindowPrivate::ToolBarDock * dock,
QBoxLayout * tl,
QBoxLayout::Direction direction,
QBoxLayout::Direction dockDirection,
bool mayNeedDockLayout,
bool justify,
GUIStyle style )
{
if ( !dock || dock->isEmpty() )
return;
bool moreThanOneRow = FALSE;
bool anyToolBars = FALSE;
dock->first();
while ( dock->next() ) {
if ( dock->current()->nl ) {
moreThanOneRow = TRUE;
break;
}
}
QBoxLayout * dockLayout;
if ( mayNeedDockLayout && moreThanOneRow ) {
dockLayout = new QBoxLayout( dockDirection );
tl->addLayout( dockLayout );
} else {
dockLayout = tl;
}
QBoxLayout * toolBarRowLayout = 0;
QMainWindowPrivate::ToolBar * t = dock->first();
do {
if ( !toolBarRowLayout || t->nl ) {
if ( toolBarRowLayout ) {
if ( !justify )
toolBarRowLayout->addStretch( 1 );
}
toolBarRowLayout = new QBoxLayout( direction );
dockLayout->addLayout( toolBarRowLayout, 0 );
}
if ( t->t->isVisible() && !t->t->testWFlags( WState_DoHide ) ) {
toolBarRowLayout->addWidget( t->t, 0 );
anyToolBars = TRUE;
}
} while ( (t=dock->next()) != 0 );
if ( anyToolBars && style == MotifStyle )
dockLayout->addSpacing( 2 );
if ( toolBarRowLayout && (!justify || !anyToolBars) )
toolBarRowLayout->addStretch( 1 );
}
示例8: QWidget
GreetingPage::GreetingPage( QWidget* parent )
: QWidget()
{
QBoxLayout *mainLayout = new QHBoxLayout;
setLayout( mainLayout );
QLabel* text = new QLabel( tr( "<h1>Welcome to Calamares.</h1><br/>"
"This is some random welcome text. "
"It should change depending on the branding config." ), this );
text->setAlignment( Qt::AlignCenter );
mainLayout->addStretch();
mainLayout->addWidget( text );
mainLayout->addStretch();
}
示例9: tr
gtImporterDialog::gtImporterDialog(const QStringList& importers, int currentSelection)
{
setWindowTitle( tr("Choose the importer to use"));
setWindowIcon(IconManager::instance()->loadIcon("AppIcon.png"));
QBoxLayout* layout = new QVBoxLayout(this);
QBoxLayout* llayout = new QHBoxLayout;
llayout->setMargin(5);
llayout->setSpacing(5);
QLabel* label = new QLabel( tr("Choose the importer to use"), this);
llayout->addWidget(label);
layout->addLayout(llayout);
QBoxLayout* ilayout = new QHBoxLayout;
ilayout->setMargin(5);
ilayout->setSpacing(5);
importerCombo = new ScComboBox(this);
importerCombo->setMinimumSize(QSize(150, 0));
importerCombo->setToolTip( tr("Choose the importer to use"));
importerCombo->addItems(importers);
if (static_cast<int>(importers.count()) > currentSelection)
importerCombo->setCurrentIndex(currentSelection);
else
importerCombo->setCurrentIndex(0);
ilayout->addWidget(importerCombo);
layout->addLayout(ilayout);
QBoxLayout* dlayout = new QHBoxLayout;
dlayout->setMargin(5);
dlayout->setSpacing(5);
rememberCheck = new QCheckBox( tr("Remember association"), this);
rememberCheck->setChecked(false);
rememberCheck->setToolTip( "<qt>" + tr("Remember the file extension - importer association and do not ask again to select an importer for files of this type.") + "</qt>" );
dlayout->addStretch(10);
dlayout->addWidget(rememberCheck);
layout->addLayout(dlayout);
QBoxLayout* blayout = new QHBoxLayout;
blayout->setMargin(5);
blayout->setSpacing(5);
blayout->addStretch(10);
okButton = new QPushButton( CommonStrings::tr_OK, this);
blayout->addWidget(okButton);
layout->addLayout(blayout);
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
}
示例10: drv_boxlayout
int drv_boxlayout(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
handle_head* head = (handle_head*)a0;
QBoxLayout *self = (QBoxLayout*)head->native;
switch (drvid) {
case BOXLAYOUT_ADDLAYOUTWITH: {
self->addLayout((QLayout*)drvGetNative(a1),drvGetInt(a2));
break;
}
case BOXLAYOUT_ADDWIDGETWITH: {
self->addWidget((QWidget*)drvGetNative(a1),drvGetInt(a2),Qt::Alignment(drvGetInt(a3)));
break;
}
case BOXLAYOUT_ADDSPACING: {
self->addSpacing(drvGetInt(a1));
break;
}
case BOXLAYOUT_ADDSTRETCH: {
self->addStretch(drvGetInt(a1));
break;
}
default:
return 0;
}
return 1;
}
示例11: QWidget
SettingsWidget::SettingsWidget( MainModel *model, QWidget *parent)
: QWidget( parent ), m_model( model )
{
QBoxLayout *topLayout = new QVBoxLayout( this );
QBoxLayout *controlLayout = new QHBoxLayout;
topLayout->addLayout( controlLayout );
m_syncingCheck = new QCheckBox( i18n("Syncing enabled") );
controlLayout->addWidget( m_syncingCheck );
connect( m_syncingCheck, SIGNAL( stateChanged( int ) ),
SLOT( slotSyncingCheckChanged() ) );
QLabel *label = new QLabel;
controlLayout->addWidget( label );
connect( m_model, SIGNAL( syncingStatusChanged( const QString & ) ),
label, SLOT( setText( const QString & ) ) );
controlLayout->addStretch( 1 );
QPushButton *button = new QPushButton( i18n("Hide Settings") );
controlLayout->addWidget( button );
connect( button, SIGNAL( clicked() ), SLOT( hide() ) );
readConfig();
}
示例12: configLeftArea
void NameStatWidget::configLeftArea(const StatisticsExtractor& statsExtractor)
{
sitesCombo_->addItem("lenta.ru");
fillNamesCombo(statsExtractor);
QBoxLayout* leftLayout = new QBoxLayout(QBoxLayout::TopToBottom);
leftLayout->addWidget(sitesCombo_);
leftLayout->addWidget(namesCombo_);
QIntValidator* pagesValidator = new QIntValidator(MinPagesCount, MaxPagesCount, this);
pageCountEdit_->setValidator(pagesValidator); // Разрешим вводить в поле только цифры.
QLabel* pages = new QLabel(tr("Страниц (шт):"));
pages->setBuddy(pageCountEdit_);
leftLayout->addWidget(pages);
leftLayout->addWidget(pageCountEdit_);
QLabel* labelFrom = new QLabel(tr("&От:"));
labelFrom->setBuddy(beginPeriod_);
leftLayout->addWidget(labelFrom);
leftLayout->addWidget(beginPeriod_);
QLabel* labelTo = new QLabel(tr("&До:"));
labelTo->setBuddy(endPeriod_);
leftLayout->addWidget(labelTo);
leftLayout->addWidget(endPeriod_);
leftLayout->addWidget(okBt_, 2, Qt::AlignRight);
leftLayout->addStretch();
leftGroup_->setLayout(leftLayout);
connect(okBt_, &QPushButton::clicked, this, [&](){
showResults(statsExtractor);
});
}
示例13: QWidget
VidaliaExitWidget::VidaliaExitWidget(VidaliaConfigManager *vc, QWidget *parent)
: QWidget(parent), vidaliaConfig(vc)
{
QBoxLayout *layout = new QVBoxLayout(this);
QLabel *title = new QLabel(tr("To continue, you must exit Vidalia"));
title->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
title->setStyleSheet(QLatin1String("font-size:13pt"));
layout->addWidget(title);
layout->addSpacing(20);
QLabel *desc = new QLabel(tr("Look for the vidalia icon (<img src=':/graphics/vidalia-tray.png'>) in "
"the system tray and choose to exit.<br>Anything currently using Tor (such "
"as web downloads) will be interrupted."));
desc->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
layout->addWidget(desc);
layout->addSpacing(30);
QLabel *desc2 = new QLabel(tr("Configuration will continue automatically when Vidalia is closed."));
desc2->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
layout->addWidget(desc2);
layout->addStretch();
exitTimer = new QTimer(this);
connect(exitTimer, SIGNAL(timeout()), SLOT(checkVidalia()));
exitTimer->start(5000);
}
示例14: AboutInherited
//-----------------------------------------------------------------------------
About::About (QWidget * aParent, const char *aName, bool aInit)
: AboutInherited(aParent, aName)
{
QBoxLayout* box;
QLabel* lbl;
QFrame* frm;
QString str;
QFont fnt;
if (aInit) return;
box = new QVBoxLayout(this, 20, 6);
lblTheme = new QLabel(" ", this);
fnt = lblTheme->font();
fnt.setPointSize(fnt.pointSize() * 1.2);
lblTheme->setFont(fnt);
lblTheme->setMinimumSize(lblTheme->sizeHint());
lblTheme->setAutoResize(true);
box->addWidget(lblTheme);
lblVersion = new QLabel(" ", this);
lblVersion->setMinimumSize(lblVersion->sizeHint());
lblVersion->setAutoResize(true);
box->addWidget(lblVersion);
lblAuthor = new QLabel(" ", this);
lblAuthor->setMinimumSize(lblAuthor->sizeHint());
lblAuthor->setAutoResize(true);
box->addWidget(lblAuthor);
lblHomepage = new QLabel(" ", this);
lblHomepage->setMinimumSize(lblHomepage->sizeHint());
lblHomepage->setAutoResize(true);
box->addWidget(lblHomepage);
frm = new QFrame(this);
frm->setFrameStyle(QFrame::HLine|QFrame::Raised);
box->addSpacing(5);
box->addWidget(frm);
box->addSpacing(5);
lbl = new QLabel(i18n("KDE Theme Manager"), this);
lbl->setFont(fnt);
lbl->setMinimumSize(lbl->sizeHint());
box->addWidget(lbl);
str.sprintf(i18n("Version %s\n\n"
"Copyright (C) 1998 by\n%s\n\n"
"Gnu Public License (GPL)"),
KTHEME_VERSION,
"Stefan Taferner <[email protected]>\n"
"Waldo Bastian <[email protected]>");
lbl = new QLabel(str, this);
lbl->setMinimumSize(lbl->sizeHint());
box->addWidget(lbl);
box->addStretch(1000);
box->activate();
}
示例15: qDebug
InfoPanel::InfoPanel(QWidget *parent) :QWidget(parent)
{
#ifdef K_DEBUG
#ifdef Q_OS_WIN
qDebug() << "[InfoPanel()]";
#else
TINIT;
#endif
#endif
QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom);
QLabel *label = new QLabel(tr("Tips"));
label->setAlignment(Qt::AlignHCenter);
layout->addWidget(label);
mainLayout->addLayout(layout);
QTextEdit *textArea = new QTextEdit;
textArea->setFixedHeight(250);
textArea->setHtml("<p><b>" + tr("X Key or Right Mouse Button") + ":</b> " + tr("Close line") + "</p>");
mainLayout->addWidget(textArea);
mainLayout->addStretch(2);
}