本文整理汇总了C++中Q3HBoxLayout::addStrut方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3HBoxLayout::addStrut方法的具体用法?C++ Q3HBoxLayout::addStrut怎么用?C++ Q3HBoxLayout::addStrut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3HBoxLayout
的用法示例。
在下文中一共展示了Q3HBoxLayout::addStrut方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: labelFont
KAstTopLevel::KAstTopLevel( QWidget *parent, const char *name )
: Q3MainWindow( parent, name, 0 )
{
QWidget *border = new QWidget( this );
border->setBackgroundColor( Qt::black );
setCentralWidget( border );
Q3VBoxLayout *borderLayout = new Q3VBoxLayout( border );
borderLayout->addStretch( 1 );
QWidget *mainWin = new QWidget( border );
mainWin->setFixedSize(640, 480);
borderLayout->addWidget( mainWin, 0, Qt::AlignHCenter );
borderLayout->addStretch( 1 );
view = new KAsteroidsView( mainWin );
view->setFocusPolicy( Qt::StrongFocus );
connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );
Q3VBoxLayout *vb = new Q3VBoxLayout( mainWin );
Q3HBoxLayout *hb = new Q3HBoxLayout;
Q3HBoxLayout *hbd = new Q3HBoxLayout;
vb->addLayout( hb );
QFont labelFont( "helvetica", 24 );
QColorGroup grp( Qt::darkGreen, Qt::black, QColor( 128, 128, 128 ),
QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black );
QPalette pal( grp, grp, grp );
mainWin->setPalette( pal );
hb->addSpacing( 10 );
QLabel *label;
label = new QLabel( tr("Score"), mainWin );
label->setFont( labelFont );
label->setPalette( pal );
label->setFixedWidth( label->sizeHint().width() );
hb->addWidget( label );
scoreLCD = new QLCDNumber( 6, mainWin );
scoreLCD->setFrameStyle( Q3Frame::NoFrame );
scoreLCD->setSegmentStyle( QLCDNumber::Flat );
scoreLCD->setFixedWidth( 150 );
scoreLCD->setPalette( pal );
hb->addWidget( scoreLCD );
hb->addStretch( 10 );
label = new QLabel( tr("Level"), mainWin );
label->setFont( labelFont );
label->setPalette( pal );
label->setFixedWidth( label->sizeHint().width() );
hb->addWidget( label );
levelLCD = new QLCDNumber( 2, mainWin );
levelLCD->setFrameStyle( Q3Frame::NoFrame );
levelLCD->setSegmentStyle( QLCDNumber::Flat );
levelLCD->setFixedWidth( 70 );
levelLCD->setPalette( pal );
hb->addWidget( levelLCD );
hb->addStretch( 10 );
label = new QLabel( tr("Ships"), mainWin );
label->setFont( labelFont );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hb->addWidget( label );
shipsLCD = new QLCDNumber( 1, mainWin );
shipsLCD->setFrameStyle( Q3Frame::NoFrame );
shipsLCD->setSegmentStyle( QLCDNumber::Flat );
shipsLCD->setFixedWidth( 40 );
shipsLCD->setPalette( pal );
hb->addWidget( shipsLCD );
hb->addStrut( 30 );
vb->addWidget( view, 10 );
// -- bottom layout:
vb->addLayout( hbd );
QFont smallFont( "helvetica", 14 );
hbd->addSpacing( 10 );
QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/";
/*
label = new QLabel( tr( "T" ), mainWin );
label->setFont( smallFont );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hbd->addWidget( label );
teleportsLCD = new QLCDNumber( 1, mainWin );
teleportsLCD->setFrameStyle( QFrame::NoFrame );
teleportsLCD->setSegmentStyle( QLCDNumber::Flat );
//.........这里部分代码省略.........