本文整理汇总了C++中Q3VBoxLayout::addLayout方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3VBoxLayout::addLayout方法的具体用法?C++ Q3VBoxLayout::addLayout怎么用?C++ Q3VBoxLayout::addLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3VBoxLayout
的用法示例。
在下文中一共展示了Q3VBoxLayout::addLayout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
ConfigForm::ConfigForm(int aCurrentIntervalValue, QWidget *parent,
const char *name,
bool modal, Qt::WFlags f)
: QDialog( parent, name, modal, f ),
mApplyButton(kNULL), mCancelButton(kNULL)
{
mMinVal_Sec = float(kMIN_POLLING_INT) / 1000.f;
mMaxVal_Sec = float(kMAX_POLLING_INT) / 1000.f;
REG_DBGMSG1("ARPDBG: min val = ", mMinVal_Sec);
REG_DBGMSG1("ARPDBG: max val = ", mMaxVal_Sec);
REG_DBGCON("ConfigForm");
// note aCurrentIntervalValue is in milliseconds - convert to
// seconds for GUI entry
this->setCaption( "Configure Polling" );
resize( 150, 150 );
// create the layouts for the form
Q3VBoxLayout *lFormLayout = new Q3VBoxLayout(this, 10, 10, "configformlayout");
Q3HBoxLayout *lButtonLayout = new Q3HBoxLayout(6, "configbuttonlayout");
lFormLayout->addWidget(new QLabel("Enter interval value (seconds) \n"
"Valid range: "
+QString::number(mMinVal_Sec)
+" - "+QString::number(mMaxVal_Sec)
+" (2 d.p.)", this));
mLineEdit = new QLineEdit( this );
double lVal = (double) aCurrentIntervalValue/1000;
mLineEdit->setText(QString::number(lVal, 'g', 3));
mLineEdit->setValidator( new QDoubleValidator(mLineEdit, "dbleavlidator" ) );
lFormLayout->addWidget( mLineEdit);
mApplyButton = new QPushButton("Apply", this, "Applybutton"); \
mApplyButton->setAutoDefault(FALSE);
QToolTip::add(mApplyButton, "Apply to steerer");
connect(mApplyButton, SIGNAL(clicked()), this, SLOT(applySlot()));
mCancelButton = new QPushButton("Cancel", this, "cancelbutton");
mCancelButton->setAutoDefault(FALSE);
connect(mCancelButton, SIGNAL(clicked()), this, SLOT( reject()));
mCancelButton->setMinimumSize(mCancelButton->sizeHint());
mCancelButton->setMaximumSize(mCancelButton->sizeHint());
mApplyButton->setMinimumSize(mCancelButton->sizeHint());
mApplyButton->setMaximumSize(mApplyButton->sizeHint());
lButtonLayout->addWidget(mApplyButton);
lButtonLayout->addWidget(mCancelButton);
lFormLayout->addLayout(lButtonLayout);
}
示例2: QWidget
KexiCSVInfoLabel::KexiCSVInfoLabel(const QString& labelText, QWidget* parent)
: QWidget(parent)
{
Q3VBoxLayout *vbox = new Q3VBoxLayout(this, 0, KDialog::spacingHint());
Q3HBoxLayout *hbox = new Q3HBoxLayout(this);
vbox->addLayout(hbox);
m_leftLabel = new QLabel(labelText, this);
m_leftLabel->setMinimumWidth(130);
m_leftLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
m_leftLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
m_leftLabel->setWordWrap(true);
hbox->addWidget(m_leftLabel);
m_iconLbl = new QLabel(this);
m_iconLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
m_iconLbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
m_fnameLbl = new QLabel(this);
m_fnameLbl->setOpenExternalLinks(true);
m_fnameLbl->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
m_fnameLbl->setFocusPolicy(Qt::NoFocus);
m_fnameLbl->setTextFormat(Qt::PlainText);
m_fnameLbl->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 1, 0));
m_fnameLbl->setLineWidth(1);
m_fnameLbl->setFrameStyle(Q3Frame::Box);
m_fnameLbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
m_fnameLbl->setWordWrap(true);
hbox->addSpacing(5);
hbox->addWidget(m_iconLbl);
hbox->addWidget(m_fnameLbl, 1, Qt::AlignVCenter | Qt::AlignLeft
#ifdef __GNUC__
#warning TODO | Qt::TextWordWrap
#else
#pragma WARNING( TODO | Qt::TextWordWrap )
#endif
);
hbox->addSpacing(10);
m_commentLbl = new QLabel(this);
m_commentLbl->setOpenExternalLinks(true);
m_commentLbl->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
m_commentLbl->setFocusPolicy(Qt::NoFocus);
m_commentLbl->setTextFormat(Qt::PlainText);
m_commentLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_commentLbl->setLineWidth(1);
m_commentLbl->setFrameStyle(QFrame::Box);
m_commentLbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
m_commentLbl->setWordWrap(true);
hbox->addWidget(m_commentLbl, 0, Qt::AlignVCenter | Qt::AlignRight
#ifdef __GNUC__
#warning TODO | Qt::TextWordWrap
#else
#pragma WARNING( TODO | Qt::TextWordWrap )
#endif
);
m_separator = new Q3Frame(this);
m_separator->setFrameShape(Q3Frame::HLine);
m_separator->setFrameShadow(Q3Frame::Sunken);
vbox->addWidget(m_separator);
}
示例3: QWidget
TicTacToe::TicTacToe( bool meFirst, int boardSize, QWidget *parent, const char *name )
: QWidget( parent, name )
{
Q3VBoxLayout * l = new Q3VBoxLayout( this, 6 );
// Create a message label
message = new QLabel( this );
message->setFrameStyle( Q3Frame::WinPanel | Q3Frame::Sunken );
message->setAlignment( Qt::AlignCenter );
l->addWidget( message );
// Create the game board and connect the signal finished() to this
// gameOver() slot
board = new TicTacGameBoard( meFirst, boardSize, this );
connect( board, SIGNAL(finished()), SLOT(gameOver()) );
l->addWidget( board );
// Create a horizontal frame line
Q3Frame *line = new Q3Frame( this );
line->setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken );
l->addWidget( line );
// Create the combo box for deciding who should start, and
// connect its clicked() signals to the buttonClicked() slot
whoStarts = new QComboBox( this );
whoStarts->insertItem( "Opponent starts" );
whoStarts->insertItem( "You start" );
l->addWidget( whoStarts );
whoStarts->setEnabled(false);
whoStarts->setCurrentIndex(meFirst);
// Create the push buttons and connect their clicked() signals
// to this right slots.
connect( board, SIGNAL(myMove(int)), this, SIGNAL(myMove(int)));
connect( board, SIGNAL(stateChanged()), this, SLOT(newState()));
newGame = new QPushButton( "Play!", this );
connect( newGame, SIGNAL(clicked()), SLOT(newGameClicked()) );
newGame->setEnabled(false);
quit = new QPushButton( "Quit", this );
connect( quit, SIGNAL(clicked()), this, SIGNAL(closing()) );
Q3HBoxLayout * b = new Q3HBoxLayout;
l->addLayout( b );
b->addWidget( newGame );
b->addWidget( quit );
newState();
//board->newGame();
newGameClicked();
}
示例4: QDialog
XListDialog::XListDialog( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) :
QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "XListDialog" );
Q3VBoxLayout * XListDialogLayout = new Q3VBoxLayout( this, 11, 6, "XListDialogLayout");
Q3HBoxLayout * layout13 = new Q3HBoxLayout( 0, 0, 6, "layout13");
_altFrame = new Q3Frame( this, "_altFrame" );
_altFrame->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, 0, 0, _altFrame->sizePolicy().hasHeightForWidth() ) );
_altFrame->setFrameShape( Q3Frame::NoFrame );
_altFrame->setFrameShadow( Q3Frame::Raised );
layout13->addWidget( _altFrame );
Q3VBoxLayout * layout12 = new Q3VBoxLayout( 0, 0, 6, "layout12");
_close = new QPushButton( tr( "&Close" ), this, "_close" );
_close->setAccel( QKeySequence( tr( "Alt+C" ) ) );
layout12->addWidget( _close );
_select = new QPushButton( tr( "&Select" ), this, "_select" );
_select->setAccel( QKeySequence( tr( "Alt+S" ) ) );
_select->setEnabled(FALSE);
layout12->addWidget( _select );
QSpacerItem* spacer = new QSpacerItem( 20, 0, QSizePolicy::Minimum, QSizePolicy::Minimum );
layout12->addItem( spacer );
layout13->addLayout( layout12 );
XListDialogLayout->addLayout( layout13 );
_listLabel = new QLabel( tr( "List:" ), this, "_listLabel" );
XListDialogLayout->addWidget( _listLabel );
_list = new XListView( this, "_list" );
XListDialogLayout->addWidget( _list );
setCaption( tr( "XListDialog" ) );
resize( QSize(420, 380).expandedTo(minimumSizeHint()) );
//clearWState( WState_Polished );
setTabOrder(_list, _select);
setTabOrder(_select, _close);
setTabOrder(_close, _list);
_select->setFocus();
// signals and slots connections
connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) );
connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) );
connect( _list, SIGNAL( itemSelected(int) ), _select, SLOT( animateClick() ) );
connect( _list, SIGNAL( valid(bool) ), _select, SLOT( setEnabled(bool) ) );
}
示例5: 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 );
//.........这里部分代码省略.........
示例6: QDialog
//.........这里部分代码省略.........
count = 0;
for (i=0; i<content.numEntries; i++){
if(!strcmp(content.entries[i].service_type, "SWS") ||
!strcmp(content.entries[i].service_type, "SGS")){
sprintf(mSimName[count], "%s %s %s", content.entries[i].application,
content.entries[i].user, content.entries[i].start_date_time);
sprintf(mSimGSH[count], "%s", content.entries[i].gsh);
count++;
}
}
Delete_registry_table(&content);
mNumSims = count;
// only continue if there is some info to show
if(mNumSims>0)
{
this->setCaption( "Grid Attach" );
resize( 520, 350 );
// create the layouts for the form
Q3VBoxLayout *lFormLayout = new Q3VBoxLayout(this, 10, 10,
"attachformlayout");
Q3HBoxLayout *lFilterLayout = new Q3HBoxLayout(6, "filterlayout");
Q3VBoxLayout *lListLayout = new Q3VBoxLayout(6, "attachlistlayout");
Q3HBoxLayout *lButtonLayout = new Q3HBoxLayout(6, "attachbuttonlayout");
QSpacerItem* lSpacer = new QSpacerItem( 200, 0, QSizePolicy::Expanding,
QSizePolicy::Minimum );
// create the list box for the applications on the grid
lListLayout->addWidget(new TableLabel("Steerable Applications", this));
mTable = new Q3Table(0, 2, this);
mTable->setSelectionMode( Q3Table::Single );
mTable->verticalHeader()->hide();
mTable->setLeftMargin(0);
mTable->horizontalHeader()->setLabel(0, "Application");
mTable->horizontalHeader()->setLabel(1, "Handle");
connect(mTable, SIGNAL(valueChanged(int, int)), this,
SLOT(editHandleSlot(int, int)));
// populate the list box - each listboxitem holds array index
// information - this is what is used by the calling code
// (via aSimIndexSelected) to identify the aSimGSH selected
for (int i=0; i<mNumSims; i++)
{
REG_DBGMSG1("mSimName ", mSimName[i]);
REG_DBGMSG1("mSimGSH ", mSimGSH[i]);
mTable->insertRows(mTable->numRows(),1);
mTable->setItem(mTable->numRows()-1, 0,
new Q3TableItem(mTable, Q3TableItem::Never,
QString(mSimName[i])));
mTable->setItem(mTable->numRows()-1, 1,
new Q3TableItem(mTable, Q3TableItem::WhenCurrent,
QString(mSimGSH[i])));
}
mTable->adjustColumn(0);
mTable->adjustColumn(1);
// We checked that mNumSims was > 0 earlier...
mTable->selectRow(0);
mFilterLineEdit = new QLineEdit(this, "containsfilter");
connect(mFilterLineEdit, SIGNAL(returnPressed()), this,
SLOT(filterSlot()));
// Initialize the filter with the user's username - might be handy
mFilterLineEdit->setText(QString(getenv("USER")));
mFilterLineEdit->selectAll();
lFilterLayout->addWidget(new QLabel("Contains", this));
lFilterLayout->addWidget(mFilterLineEdit);
lListLayout->addWidget(mTable);
lListLayout->addLayout(lFilterLayout);
mAttachButton = new QPushButton("Attach", this, "attachbutton");
mAttachButton->setMinimumSize(mAttachButton->sizeHint());
mAttachButton->setMaximumSize(mAttachButton->sizeHint());
mAttachButton->setAutoDefault(FALSE);
QToolTip::add(mAttachButton, "Attach to selected application");
connect(mAttachButton, SIGNAL(clicked()), this, SLOT(attachSlot()));
mCancelButton = new QPushButton("Cancel", this, "cancelbutton");
mCancelButton->setMinimumSize(mCancelButton->sizeHint());
mCancelButton->setMaximumSize(mCancelButton->sizeHint());
mCancelButton->setAutoDefault(FALSE);
connect(mCancelButton, SIGNAL(clicked()), this, SLOT( reject()));
lButtonLayout->addItem(lSpacer);
lButtonLayout->addWidget(mCancelButton);
lButtonLayout->addWidget(mAttachButton);
lFormLayout->addLayout(lListLayout);
lFormLayout->addLayout(lButtonLayout);
}