当前位置: 首页>>代码示例>>C++>>正文


C++ QSpinBox::setMaximumHeight方法代码示例

本文整理汇总了C++中QSpinBox::setMaximumHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setMaximumHeight方法的具体用法?C++ QSpinBox::setMaximumHeight怎么用?C++ QSpinBox::setMaximumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSpinBox的用法示例。


在下文中一共展示了QSpinBox::setMaximumHeight方法的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 );

//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:101,代码来源:vw.cpp


注:本文中的QSpinBox::setMaximumHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。