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


C++ Q3HBoxLayout::addStretch方法代码示例

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


在下文中一共展示了Q3HBoxLayout::addStretch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setupDstType

//===========================================================
//
void ImportWizard::setupDstType()
{
    m_dstTypePage = new QWidget(this);

    KexiDB::DriverManager manager;
    KexiDB::Driver::InfoHash drvs = manager.driversInfo();

    Q3VBoxLayout *vbox = new Q3VBoxLayout(m_dstTypePage, KDialog::marginHint());

    Q3HBoxLayout *hbox = new Q3HBoxLayout(vbox);
    QLabel *lbl = new QLabel(i18n("Destination database type:") + " ", m_dstTypePage);
    lbl->setAlignment(Qt::AlignAuto | Qt::AlignTop);
    hbox->addWidget(lbl);

    m_dstPrjTypeSelector = new KexiPrjTypeSelector(m_dstTypePage);
    hbox->addWidget(m_dstPrjTypeSelector);
    m_dstPrjTypeSelector->option_file->setText(i18n("Database project stored in a file"));
    m_dstPrjTypeSelector->option_server->setText(i18n("Database project stored on a server"));

    QVBoxLayout *frame_server_vbox = new QVBoxLayout(
        m_dstPrjTypeSelector->frame_server, KDialog::spacingHint());
    m_dstServerTypeCombo = new KexiDBDriverComboBox(m_dstPrjTypeSelector->frame_server, drvs,
            KexiDBDriverComboBox::ShowServerDrivers);
    frame_server_vbox->addWidget(m_dstServerTypeCombo);
    hbox->addStretch(1);
    vbox->addStretch(1);
    lbl->setBuddy(m_dstServerTypeCombo);

//! @todo hardcoded: find a way to preselect default engine item
    //m_dstTypeCombo->setCurrentText("SQLite3");
    addPage(m_dstTypePage, i18n("Select Destination Database Type"));
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:34,代码来源:importwizard.cpp

示例2: QWidget

KexiSimplePrintPreviewWindow::KexiSimplePrintPreviewWindow(
    KexiSimplePrintingEngine &engine, const QString& previewName,
    QWidget *parent, Qt::WFlags f)
        : QWidget(parent, "KexiSimplePrintPreviewWindow", f)
        , m_engine(engine)
        , m_settings(*m_engine.settings())
        , m_pageNumber(-1)
        , m_pagesCount(-1)
{
    setWindowTitle(i18n("%1 - Print Preview - %2", previewName, KEXI_APP_NAME));
    setIcon(DesktopIcon("document-print-preview"));
    Q3VBoxLayout *lyr = new Q3VBoxLayout(this, 6);

    int id;
    m_toolbar = new KToolBar(0, this);
    m_toolbar->setLineWidth(0);
    m_toolbar->setFrameStyle(Q3Frame::NoFrame);
    m_toolbar->setIconText(KToolBar::IconTextRight);
    lyr->addWidget(m_toolbar);

    id = m_toolbar->insertWidget(-1, 0, new KPushButton(KStandardGuiItem::print(), m_toolbar));
    m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotPrintClicked()));
    static_cast<KPushButton*>(m_toolbar->getWidget(id))->setAccel(Qt::CTRL | Qt::Key_P);
    m_toolbar->insertSeparator();

    id = m_toolbar->insertWidget(-1, 0, new KPushButton(i18n("Page Set&up..."), m_toolbar));
    m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotPageSetup()));
    m_toolbar->insertSeparator();


#ifndef KEXI_NO_UNFINISHED
//! @todo unfinished
    id = m_toolbar->insertWidget(-1, 0, new KPushButton(KIcon("zoom-in"), i18n("Zoom In"), m_toolbar));
    m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotZoomInClicked()));
    m_toolbar->insertSeparator();

    id = m_toolbar->insertWidget(-1, 0, new KPushButton(KIcon("zoom-out"), i18n("Zoom Out"), m_toolbar));
    m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotZoomOutClicked()));
    m_toolbar->insertSeparator();
#endif

    id = m_toolbar->insertWidget(-1, 0, new KPushButton(KStandardGuiItem::close(), m_toolbar));
    m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(close()));
    m_toolbar->alignItemRight(id);

    m_scrollView = new KexiSimplePrintPreviewScrollView(this);
    m_scrollView->setUpdatesEnabled(false);
    m_view = m_scrollView->widget;
    m_scrollView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    lyr->addWidget(m_scrollView);

    QWidget* navToolbarWidget = new QWidget(this); //widget used to center the navigator toolbar
    navToolbarWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    Q3HBoxLayout *navToolbarLyr = new Q3HBoxLayout(navToolbarWidget);
    lyr->addWidget(navToolbarWidget);

    m_navToolbar = new KToolBar(0, navToolbarWidget);
    navToolbarLyr->addStretch(1);
    navToolbarLyr->addWidget(m_navToolbar);
    navToolbarLyr->addStretch(1);
// m_navToolbar->setFullWidth(true);
    m_navToolbar->setLineWidth(0);
    m_navToolbar->setFrameStyle(Q3Frame::NoFrame);
    m_navToolbar->setIconText(KToolBar::IconTextRight);

    m_idFirst = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-first"), i18n("First Page"), m_navToolbar));
    m_navToolbar->addConnection(m_idFirst, SIGNAL(clicked()), this, SLOT(slotFirstClicked()));
    m_navToolbar->insertSeparator();

    m_idPrevious = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-previous"), i18n("Previous Page"), m_navToolbar));
    m_navToolbar->addConnection(m_idPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousClicked()));
    m_navToolbar->insertSeparator();

    m_idPageNumberLabel = m_navToolbar->insertWidget(-1, 0, new QLabel(m_navToolbar));
    m_navToolbar->insertSeparator();

    m_idNext = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-next"), i18n("Next Page"), m_navToolbar));
    m_navToolbar->addConnection(m_idNext, SIGNAL(clicked()), this, SLOT(slotNextClicked()));
    m_navToolbar->insertSeparator();

    m_idLast = m_navToolbar->insertWidget(-1, 0, new KPushButton(KIcon("go-last"), i18n("Last Page"), m_navToolbar));
    m_navToolbar->addConnection(m_idLast, SIGNAL(clicked()), this, SLOT(slotLastClicked()));
    m_navToolbar->insertSeparator();

    resize(width(), kapp->desktop()->height()*4 / 5);

//! @todo progress bar...

    QTimer::singleShot(50, this, SLOT(initLater()));
}
开发者ID:KDE,项目名称:calligra-history,代码行数:90,代码来源:kexisimpleprintpreviewwindow.cpp

示例3: 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 );
//.........这里部分代码省略.........
开发者ID:Fale,项目名称:qtmoko,代码行数:101,代码来源:toplevel.cpp

示例4: QDialog

QAutoGenDialog::QAutoGenDialog(QWidget * parent, const char * name, Qt::WFlags f)
: QDialog(parent, name, f), m_pModels(NULL), m_pVehicleList(NULL), m_pModelList(NULL), m_pVehicleIPs(NULL), m_pModelNames(NULL), m_pMapParams(NULL), m_pVecModelTypes(NULL)
{
	QWidget * pVehiclesBox = new QWidget(this);
	QLabel * labelVehicles = new QLabel("Node Type:", pVehiclesBox);
	QWidget * pRegionTypeBox = new QWidget(this);
	QLabel * labelRegionIDs = new QLabel("Parameter:", pRegionTypeBox);
	QLabel * labelRegionType = new QLabel("Region Type:", pRegionTypeBox);
	QSplitter * splitterDivider = new QSplitter(Qt::Vertical, this);
	QWidget * pMapBox = new QWidget(splitterDivider);
	QWidget * pButtonBox = new QWidget(this);

	Q3VBoxLayout * pLayout = new Q3VBoxLayout(this, 8, 8);
	Q3HBoxLayout * pVehiclesBoxLayout = new Q3HBoxLayout(pVehiclesBox, 0, 8);
	Q3HBoxLayout * pRegionTypeBoxLayout = new Q3HBoxLayout(pRegionTypeBox, 0, 8);
	Q3VBoxLayout * pMapBoxLayout = new Q3VBoxLayout(pMapBox, 0, 8);
	Q3HBoxLayout * pButtonBoxLayout = new Q3HBoxLayout(pButtonBox, 0, 8);

	setCaption("GrooveNet - Auto-Generate Nodes...");
	setIcon(app16x16_xpm);

	m_comboVehicleType = new QComboBox(false, pVehiclesBox);
	m_txtVehicles = new QSpinBox(1, 99999, 1, pVehiclesBox);
	m_comboRegionIDs = new QComboBox(true, pRegionTypeBox);
	m_comboRegionType = new QComboBox(false, pRegionTypeBox);
	m_pMap = new QMapWidget(pMapBox);
	m_labelRegionInfo = new QLabel("", pMapBox);
	m_tableProperties = new Q3Table(0, 3, splitterDivider);
	m_txtPropertiesHelp = new Q3TextEdit("", QString::null, splitterDivider);
	m_buttonOK = new QPushButton("&OK", pButtonBox);
	m_buttonCancel = new QPushButton("&Cancel", pButtonBox);

	connect(m_comboVehicleType, SIGNAL(activated(int)), this, SLOT(slotVehicleTypeActivated(int)));
	connect(m_comboRegionIDs, SIGNAL(activated(int)), this, SLOT(slotParameterActivated(int)));
	connect(m_comboRegionType, SIGNAL(activated(int)), this, SLOT(slotRegionTypeActivated(int)));
	connect(m_pMap, SIGNAL(selectionChanged()), this, SLOT(slotMapSelectionChanged()));
	connect(m_tableProperties, SIGNAL(valueChanged(int, int)), this, SLOT(slotPropertiesValueChanged(int, int)));
	connect(m_tableProperties, SIGNAL(currentChanged(int, int)), this, SLOT(slotPropertiesCurrentChanged(int, int)));
	connect(m_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
	connect(m_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));

	m_txtVehicles->setSuffix(" nodes");
	m_comboRegionIDs->insertItem(OTHERADDRESSES);
	m_comboRegionType->insertItem("Bounding Rectangle", 0);
	m_pMap->SetSelectionMode(QMapWidget::SelectionModeRect);
	m_tableProperties->verticalHeader()->hide();
	m_tableProperties->setLeftMargin(0);
	m_tableProperties->horizontalHeader()->setClickEnabled(false);
	m_tableProperties->horizontalHeader()->setMovingEnabled(false);
	m_tableProperties->horizontalHeader()->setLabel(0, "Parameter");
	m_tableProperties->horizontalHeader()->setLabel(1, "Type");
	m_tableProperties->horizontalHeader()->setLabel(2, "Value");
	m_tableProperties->setSorting(false);
	m_tableProperties->setSelectionMode(Q3Table::SingleRow);
	m_tableProperties->setFocusStyle(Q3Table::FollowStyle);
	m_tableProperties->setColumnReadOnly(0, true);
	m_tableProperties->setColumnReadOnly(1, false);
	m_tableProperties->setColumnReadOnly(2, false);
	m_tableProperties->setColumnStretchable(2, true);
	m_txtPropertiesHelp->setReadOnly(true);
	m_buttonOK->setAutoDefault(false);
	m_buttonCancel->setAutoDefault(false);
	slotVehicleTypeActivated(m_comboVehicleType->currentItem());
	slotParameterActivated(m_comboRegionIDs->currentItem());
	slotRegionTypeActivated(m_comboRegionType->currentItem());

	pLayout->addWidget(pVehiclesBox);
	pLayout->addWidget(pRegionTypeBox);
	pLayout->addWidget(splitterDivider);
//	pLayout->addWidget(m_txtPropertiesHelp);
	pLayout->addWidget(pButtonBox);
	pVehiclesBoxLayout->addWidget(labelVehicles, 0, Qt::AlignLeft);
	pVehiclesBoxLayout->addWidget(m_comboVehicleType, 1);
	pVehiclesBoxLayout->addWidget(m_txtVehicles, 1);
	pRegionTypeBoxLayout->addWidget(labelRegionIDs, 0, Qt::AlignLeft);
	pRegionTypeBoxLayout->addWidget(m_comboRegionIDs, 1);
	pRegionTypeBoxLayout->addWidget(labelRegionType, 0, Qt::AlignLeft);
	pRegionTypeBoxLayout->addWidget(m_comboRegionType, 1);
	pMapBoxLayout->addWidget(m_pMap, 1);
	pMapBoxLayout->addWidget(m_labelRegionInfo, 0, Qt::AlignLeft);
	pButtonBoxLayout->addStretch(1);
	pButtonBoxLayout->addWidget(m_buttonOK, 0, Qt::AlignCenter);
	pButtonBoxLayout->addWidget(m_buttonCancel, 0, Qt::AlignCenter);
}
开发者ID:vigneshananth,项目名称:Groovenet-Qt4,代码行数:84,代码来源:QAutoGenDialog.cpp


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