本文整理汇总了C++中QSpinBox::sizeHint方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::sizeHint方法的具体用法?C++ QSpinBox::sizeHint怎么用?C++ QSpinBox::sizeHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::sizeHint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
VW::VW( QWidget * parent, const char * name )
: QWidget( parent, name )
{
QHBoxLayout * hb;
hb = new QHBoxLayout( this, 10 );
QGroupBox * box;
box = new QGroupBox( this, "input box" );
hb->addWidget( box, 0, AlignTop );
QVBoxLayout * b;
// set up the input box
b = new QVBoxLayout( box, 12 );
QLabel * l = new QLabel( "Enter Vehicle Details", box, "header" );
l->setMinimumSize( l->sizeHint() );
b->addWidget( l );
QFrame * f = new QFrame( box, "horizontal divider" );
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
f->setMinimumHeight( 12 );
b->addWidget( f );
QGridLayout *grid = new QGridLayout( 3, 2 );
b->addLayout( grid );
// here we start on the input grid, with labels and other widget
// neatly arranged. the variable names are reused all over the
// place.
QComboBox * model = new QComboBox( FALSE, box, "model selection" );
model->insertItem( "Type 1 Beetle" );
model->insertItem( "Camper" );
model->insertItem( "Van" );
model->insertItem( "Fastback" );
model->insertItem( "Squareback" );
model->insertItem( "Notchback" );
model->insertItem( "411" );
model->setCurrentItem( model->count() - 1 ); // I like the 411
currentModel = "411";
model->insertItem( "412" );
model->insertItem( "Karmann Ghia" );
model->insertItem( "Thing" );
model->insertItem( "Safari" );
model->insertItem( "Kubelwagen" );
model->insertItem( "Trekker" );
model->insertItem( "Baja" );
model->setMinimumSize( model->sizeHint() );
model->setMaximumHeight( model->minimumSize().height() );
grid->addWidget( model, 0, 1 );
l = new QLabel( model, "Model:", box, "model label" );
l->setMinimumSize( l->sizeHint() );
grid->addWidget( l, 0, 0 );
QSpinBox * motor = new QSpinBox( 1000, 1600, 100,
box, "motor size selection" );
motor->setValue( 1000 );
currentMotorSize = 1000;
motor->setMinimumSize( motor->sizeHint() );
motor->setMaximumHeight( motor->minimumSize().height() );
grid->addWidget( motor, 1, 1 );
l = new QLabel( motor, "Motor size (cc):", box, "motor size label" );
l->setMinimumSize( l->sizeHint() );
grid->addWidget( l, 1, 0 );
QSpinBox * year = new QSpinBox( box, "model year" );
year->setRange( 1949, 1981 );
year->setValue( 1949 );
currentYear = 1949;
year->setMinimumSize( year->sizeHint() );
year->setMaximumHeight( year->minimumSize().height() );
grid->addWidget( year, 2, 1 );
l = new QLabel( year, "Model:", box, "model year label" );
l->setMinimumSize( l->sizeHint() );
grid->addWidget( l, 2, 0 );
b->addStretch( 1 );
b->activate();
// output box
box = new QGroupBox( this, "output box" );
hb->addWidget( box, 0, AlignTop );
b = new QVBoxLayout( box, 12 );
l = new QLabel( "Resulting Limousine:", box, "header" );
l->setMinimumSize( l->sizeHint() );
b->addWidget( l );
f = new QFrame( box, "horizontal divider" );
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
f->setMinimumHeight( 12 );
b->addWidget( f );
//.........这里部分代码省略.........