本文整理汇总了C++中QDialogButtonBox::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialogButtonBox::setObjectName方法的具体用法?C++ QDialogButtonBox::setObjectName怎么用?C++ QDialogButtonBox::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox::setObjectName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void WebDialogProvider::init(const QString &title, const QString &lbl,
QWidget *input)
{
setWindowTitle(title);
QVBoxLayout *vbox = new QVBoxLayout(this);
QLabel *label = new QLabel(lbl, this);
vbox->addWidget(label);
vbox->addStretch(1);
input->setParent(this);
vbox->addWidget(input);
vbox->addStretch(1);
#ifndef QT_NO_SHORTCUT
label->setBuddy(input);
#endif
QDialogButtonBox *buttonBox =
new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this);
buttonBox->setObjectName(QLatin1String("qt_inputdlg_buttonbox"));
okButton = static_cast<QPushButton *> (buttonBox->addButton(QDialogButtonBox::Ok));
okButton->setDefault(true);
vbox->addWidget(buttonBox);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
disableSizeGrip();
}
示例2: file
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QgsDistanceArea myDa, QWidget* parent, bool showDialogButtons )
: mDialog( 0 )
, mSettingsPath( "/Windows/AttributeDialog/" )
, mLayer( vl )
, mFeature( thepFeature )
, mFeatureOwner( featureOwner )
, mHighlight( 0 )
, mFormNr( -1 )
, mShowDialogButtons( showDialogButtons )
{
if ( !mFeature || !vl->dataProvider() )
return;
const QgsFields &theFields = vl->pendingFields();
if ( theFields.isEmpty() )
return;
QgsAttributes myAttributes = mFeature->attributes();
QDialogButtonBox *buttonBox = NULL;
if ( vl->editorLayout() == QgsVectorLayer::UiFileLayout && !vl->editForm().isEmpty() )
{
// UI-File defined layout
QFile file( vl->editForm() );
if ( file.open( QFile::ReadOnly ) )
{
QUiLoader loader;
QFileInfo fi( vl->editForm() );
loader.setWorkingDirectory( fi.dir() );
QWidget *myWidget = loader.load( &file, parent );
file.close();
mDialog = qobject_cast<QDialog*>( myWidget );
buttonBox = myWidget->findChild<QDialogButtonBox*>();
}
}
else if ( vl->editorLayout() == QgsVectorLayer::TabLayout )
{
// Tab display
mDialog = new QDialog( parent );
QGridLayout *gridLayout;
QTabWidget *tabWidget;
mDialog->resize( 447, 343 );
gridLayout = new QGridLayout( mDialog );
gridLayout->setObjectName( QString::fromUtf8( "gridLayout" ) );
tabWidget = new QTabWidget( mDialog );
gridLayout->addWidget( tabWidget );
foreach ( const QgsAttributeEditorElement *widgDef, vl->attributeEditorElements() )
{
QWidget* tabPage = new QWidget( tabWidget );
tabWidget->addTab( tabPage, widgDef->name() );
QGridLayout *tabPageLayout = new QGridLayout( tabPage );
if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer )
{
tabPageLayout->addWidget( QgsAttributeEditor::createWidgetFromDef( widgDef, tabPage, vl, myAttributes, mProxyWidgets, false ) );
}
else
{
QgsDebugMsg( "No support for fields in attribute editor on top level" );
}
}
buttonBox = new QDialogButtonBox( mDialog );
buttonBox->setObjectName( QString::fromUtf8( "buttonBox" ) );
gridLayout->addWidget( buttonBox );
}
示例3: init
void QgsAttributeDialog::init()
{
if ( !mFeature || !mLayer->dataProvider() )
return;
const QgsFields &theFields = mLayer->pendingFields();
if ( theFields.isEmpty() )
return;
QDialogButtonBox *buttonBox = NULL;
if ( mLayer->editorLayout() == QgsVectorLayer::UiFileLayout && !mLayer->editForm().isEmpty() )
{
// UI-File defined layout
QFile file( mLayer->editForm() );
if ( file.open( QFile::ReadOnly ) )
{
QUiLoader loader;
QFileInfo fi( mLayer->editForm() );
loader.setWorkingDirectory( fi.dir() );
QWidget *myWidget = loader.load( &file, qobject_cast<QWidget*>( parent() ) );
file.close();
mDialog = qobject_cast<QDialog*>( myWidget );
buttonBox = myWidget->findChild<QDialogButtonBox*>();
}
}
else if ( mLayer->editorLayout() == QgsVectorLayer::TabLayout )
{
// Tab display
mDialog = new QDialog( qobject_cast<QWidget*>( parent() ) );
QGridLayout *gridLayout;
QTabWidget *tabWidget;
mDialog->resize( 447, 343 );
gridLayout = new QGridLayout( mDialog );
gridLayout->setObjectName( QString::fromUtf8( "gridLayout" ) );
tabWidget = new QTabWidget( mDialog );
gridLayout->addWidget( tabWidget );
foreach ( const QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() )
{
QWidget* tabPage = new QWidget( tabWidget );
tabWidget->addTab( tabPage, widgDef->name() );
QGridLayout *tabPageLayout = new QGridLayout( tabPage );
if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer )
{
QString dummy1;
bool dummy2;
tabPageLayout->addWidget( QgsAttributeEditor::createWidgetFromDef( widgDef, tabPage, mLayer, *mFeature, mContext, dummy1, dummy2 ) );
}
else
{
QgsDebugMsg( "No support for fields in attribute editor on top level" );
}
}
buttonBox = new QDialogButtonBox( mDialog );
buttonBox->setObjectName( QString::fromUtf8( "buttonBox" ) );
gridLayout->addWidget( buttonBox );
}
示例4: buildDialog
bool MachinesDialog::buildDialog(bool examMode)
#endif
{
ui->setupUi(this);
ui->retranslateUi(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setStandardButtons(QDialogButtonBox::NoButton);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
QStringList horizontalHeaderLabels = QString(HORIZONTAL_HEADERS).split(";");
ui->treeWidget->setColumnCount(horizontalHeaderLabels.count());
ui->treeWidget->setHeaderLabels(horizontalHeaderLabels);
ui->treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
if(fileName == "")
{
QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
horizontalLayout->setObjectName("horizontalLayout");
checkBox = new QCheckBox(this);
checkBox->setObjectName("checkBox");
checkBox->setText("Comprimi file");
horizontalLayout->addWidget(checkBox);
horizontalLayout->addWidget(buttonBox);
ui->verticalLayout->addLayout(horizontalLayout);
setWindowTitle(QApplication::translate("SummaryDialog", "Esporta macchine", 0, QApplication::UnicodeUTF8));
for(int row = 0; row < vmTab_vec->size(); row++)
{
VMTabSettings *vmTabSettings = vmTab_vec->at(row);
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setCheckState(0, Qt::Unchecked);
item->setText(0, QString("Macchina: ").append(vmTabSettings->getMachineName()));
for(int iface_index = 0; iface_index < vmTabSettings->vm->ifaces_size; iface_index++)
{
QTreeWidgetItem *childItem = new QTreeWidgetItem(item);
childItem->setText(0, vmTabSettings->vm->ifaces[iface_index]->name);
childItem->setText(1, vmTabSettings->vm->ifaces[iface_index]->mac);
#ifdef CONFIGURABLE_IP
childItem->setText(2, vmTabSettings->vm->ifaces[iface_index]->ip);
childItem->setText(3, vmTabSettings->vm->ifaces[iface_index]->subnetMask);
#endif
}
ui->treeWidget->addTopLevelItem(item);
ui->treeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
}
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
#ifndef USE_ZLIB
checkBox->setChecked(false);
checkBox->setEnabled(false);
#endif
#ifdef EXAM_MODE
if(examMode)
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotExamExportMachines()));
else
#endif
{
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotExportMachines()));
}
}
else
{
ui->verticalLayout->addWidget(buttonBox);
setWindowTitle(QApplication::translate("SummaryDialog", "Importa macchine", 0, QApplication::UnicodeUTF8));
read_result_t read_result = loadMachines(&settings_header, &settings_ifaces, &machines_number);
switch(read_result)
{
case NO_ERROR:
break;
case E_UNINMPLEMENTED:
{
QMessageBox qm(QMessageBox::Critical, "Ripristino impostazioni", QString::fromUtf8("Funzione non implementata."), QMessageBox::Ok, this);
qm.setPalette(palette());
qm.exec();
return false;
}
case E_INVALID_FILE:
case E_INVALID_HEADER:
default:
{
QMessageBox qm(QMessageBox::Critical, "Ripristino impostazioni", QString::fromUtf8("Il file selezionato non è valido."), QMessageBox::Ok, this);
qm.setPalette(palette());
qm.exec();
return false;
}
}
for(int i = 0; i < machines_number; i++)
{
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setCheckState(0, Qt::Unchecked);
//.........这里部分代码省略.........
示例5: addParam
void EditParams::addParam(QWidget* parent, QGridLayout* layout, const ppk_proto_param* pparam)
{
if(!layout)
{
qDebug("EditParams::addParam: Tried to add a param to a NULL tab widget !\n");
return;
}
QAbstractFormField* field=abstractFormFieldFromParamProto(parent, pparam);
if(field)
{
field->setFieldName(QString::fromUtf8(pparam->name));
field->setHelpText(QString::fromUtf8(pparam->help_text));
int line=layout->rowCount();
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
field->widget()->setSizePolicy(sizePolicy);
field->widget()->setToolTip(QString::fromUtf8(pparam->help_text));
if(field->layout()!=NULL)
{
layout->addLayout(field->layout(), line, 1, 1, 1);
}
else
{
sizePolicy.setHeightForWidth(field->widget()->sizePolicy().hasHeightForWidth());
layout->addWidget(field->widget(), line, 1, 1, 1);
}
QLabel* nameParamLbl = new QLabel(createNameString(pparam), parent);
nameParamLbl->setToolTip(QString::fromUtf8(pparam->help_text));
nameParamLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
layout->addWidget(nameParamLbl, line, 0, 1, 1);
QPushButton* helpParamBtn = new QPushButton(tr("?"), parent);
helpParamBtn->setObjectName(QString::fromUtf8("helpParamBtn"));
QSizePolicy sizePolicy1(QSizePolicy::Maximum, QSizePolicy::Fixed);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(helpParamBtn->sizePolicy().hasHeightForWidth());
helpParamBtn->setSizePolicy(sizePolicy1);
helpParamBtn->setMaximumSize(QSize(40, 16777215));
helpParamBtn->setToolTip(QString::fromUtf8(pparam->help_text));
layout->addWidget(helpParamBtn, line, 2, 1, 1);
QDialogButtonBox* rstParamBtn = new QDialogButtonBox(parent);
rstParamBtn->setObjectName(QString::fromUtf8("rstParamBtn"));
sizePolicy1.setHeightForWidth(rstParamBtn->sizePolicy().hasHeightForWidth());
rstParamBtn->setSizePolicy(sizePolicy1);
rstParamBtn->setStandardButtons(QDialogButtonBox::Reset);
rstParamBtn->setToolTip(tr("Reset to the default value"));
layout->addWidget(rstParamBtn, line, 3, 1, 1);
//Add the field to the field vector
fields.push_back(field);
connect(helpParamBtn, SIGNAL(clicked()), field, SLOT(showHelpText()));
connect(rstParamBtn, SIGNAL(clicked(QAbstractButton*)), field, SLOT(reset()));
}
}