本文整理汇总了C++中QBoxLayout::addStrut方法的典型用法代码示例。如果您正苦于以下问题:C++ QBoxLayout::addStrut方法的具体用法?C++ QBoxLayout::addStrut怎么用?C++ QBoxLayout::addStrut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout::addStrut方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QString filename("unknown");
if (argc == 2) {
filename = argv[1];
}
RWindow window;
QBoxLayout *layout = qobject_cast<QBoxLayout *>(window.layout());
QLabel heading("Could not open file.");
heading.setFont(QFont("Liberation Serif", 30));
layout->addWidget(&heading);
layout->addStrut(8);
QLabel detail(
QString("The file %1 is of an unrecognized type and cannot be opened.")
.arg(runcible::quote(filename)));
detail.setFont(QFont("Liberation Serif", 12));
detail.setWordWrap(true);
layout->addWidget(&detail);
layout->addStretch(1);
QObject::connect(&window, SIGNAL(back()), &app, SLOT(quit()));
window.showMessage("How unfortunate.");
window.showMaximized();
return app.exec();
}
示例2: reformat
/*!
Changes the status bar's appearance to account for item
changes. Special subclasses may need this, but normally
geometry management will take care of any necessary
rearrangements.
*/
void QStatusBar::reformat()
{
if ( d->box )
delete d->box;
QBoxLayout *vbox;
if ( isSizeGripEnabled() ) {
d->box = new QHBoxLayout( this );
vbox = new QVBoxLayout( d->box );
} else {
vbox = d->box = new QVBoxLayout( this );
}
vbox->addSpacing( 3 );
QBoxLayout* l = new QHBoxLayout( vbox );
l->addSpacing( 3 );
int maxH = fontMetrics().height();
QStatusBarPrivate::SBItem* item = d->items.first();
while ( item && !item->p ) {
l->addWidget( item->w, item->s );
l->addSpacing( 4 );
int itemH = item->w->sizeHint().height();
maxH = QMAX( maxH, itemH );
item = d->items.next();
}
l->addStretch( 0 );
while ( item ) {
l->addWidget( item->w, item->s );
l->addSpacing( 4 );
int itemH = item->w->sizeHint().height();
maxH = QMAX( maxH, itemH );
item = d->items.next();
}
#ifndef QT_NO_SIZEGRIP
if ( d->resizer ) {
maxH = QMAX( maxH, d->resizer->sizeHint().height() );
d->box->addSpacing( 2 );
d->box->addWidget( d->resizer, 0, AlignBottom );
}
#endif
l->addStrut( maxH );
vbox->addSpacing( 2 );
d->box->activate();
repaint();
}
示例3: addStrut
void QBoxLayoutProto::addStrut(int size)
{
QBoxLayout *item = qscriptvalue_cast<QBoxLayout*>(thisObject());
if (item)
item->addStrut(size);
}