本文整理汇总了C++中Q3HBoxLayout::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3HBoxLayout::addItem方法的具体用法?C++ Q3HBoxLayout::addItem怎么用?C++ Q3HBoxLayout::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3HBoxLayout
的用法示例。
在下文中一共展示了Q3HBoxLayout::addItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
FileListDialog::FileListDialog(QWidget* parent,
QString const& _dialogTitle,
QString const& _listTitle,
char const * _filters[]) :
QDialog(parent, "FileListDialog", TRUE), // TRUE = modal dialog
list_(NULL),
delButton_(NULL),
fileDialog_(NULL),
modified_(false)
{
resize(300, 200);
setCaption(_dialogTitle);
Q3VBoxLayout * topBox = new Q3VBoxLayout(this, 0, -1, "boxLayout");
Q3VGroupBox * fileBox = new Q3VGroupBox(this, "fileBox");
list_ = new Q3ListBox(fileBox, "list");
Q3HBox * fileButtonsBox = new Q3HBox(fileBox, "fileButtons");
QPushButton * addButton = new QPushButton("Add...", fileButtonsBox);
delButton_ = new QPushButton("Remove", fileButtonsBox);
fileDialog_ = new Q3FileDialog(this, "config file dialog", TRUE);
topBox->addSpacing(10);
topBox->addWidget(fileBox);
fileBox->setTitle(_listTitle);
topBox->addSpacing(10);
Q3HBoxLayout * dialogButtonsBox = new Q3HBoxLayout(topBox, -1, "hBoxLayout");
QSpacerItem * dBSpace = new QSpacerItem(0, 0);
QPushButton * okButton = new QPushButton("OK", this);
QPushButton * cancelButton = new QPushButton("Cancel", this);
topBox->addSpacing(5);
dialogButtonsBox->addItem(dBSpace);
dialogButtonsBox->addWidget(okButton);
dialogButtonsBox->addSpacing(5);
dialogButtonsBox->addWidget(cancelButton);
dialogButtonsBox->addSpacing(5);
okButton->setDefault(true);
static const char * filters[3] = { "all files (*)", NULL };
fileDialog_->setCaption("File open dialog");
fileDialog_->setFilters((_filters == NULL)? filters : _filters);
// connect the dialogs functionality
connect(okButton, SIGNAL(clicked()), SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), SLOT(reject()));
connect(addButton, SIGNAL(clicked()), SLOT(add()));
connect(delButton_, SIGNAL(clicked()), SLOT(del()));
selectListItem();
}
示例2: 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);
}