本文整理汇总了C++中QDialog::sizeHint方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::sizeHint方法的具体用法?C++ QDialog::sizeHint怎么用?C++ QDialog::sizeHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::sizeHint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showDialog
void UpdateDetector::showDialog()
{
// if the version tag is set, there is a newer version.
QString ver = QString::fromLatin1("%1.%2.%3")
.arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QDialog *msgBox = new QDialog;
QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0);
int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0);
msgBox->setWindowIcon(info);
QVBoxLayout *layout = new QVBoxLayout(msgBox);
QHBoxLayout *hlayout = new QHBoxLayout;
layout->addLayout(hlayout);
msgBox->setWindowTitle(tr("New Version Available"));
QLabel *ico = new QLabel;
ico->setFixedSize(iconSize, iconSize);
ico->setPixmap(info.pixmap(iconSize));
QLabel *lbl = new QLabel;
QString txt = tr("<p>A new version of the %1 Client is available.</p>"
"<p><b>%2</b> is available for download. The installed version is %3.<p>")
.arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring()).arg(ver);
lbl->setText(txt);
lbl->setTextFormat(Qt::RichText);
lbl->setWordWrap(true);
hlayout->addWidget(ico);
hlayout->addWidget(lbl);
QDialogButtonBox *bb = new QDialogButtonBox;
QPushButton *skip = bb->addButton(tr("Skip update"), QDialogButtonBox::ResetRole);
QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole);
QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole);
connect(skip, SIGNAL(clicked()), msgBox, SLOT(reject()));
connect(reject, SIGNAL(clicked()), msgBox, SLOT(reject()));
connect(getupdate, SIGNAL(clicked()), msgBox, SLOT(accept()));
connect(skip, SIGNAL(clicked()), SLOT(slotSetVersionSeen()));
connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl()));
layout->addWidget(bb);
msgBox->open();
msgBox->resize(400, msgBox->sizeHint().height());
}
示例2: getConfig
static bool getConfig(QWidget *parent, sigen::interface::Options *options) {
// http://vivi.dyndns.org/vivi/docs/Qt/layout.html
QFormLayout *fLayout = new QFormLayout(parent);
fLayout->setLabelAlignment(Qt::AlignRight);
// http://doc.qt.io/qt-4.8/qlineedit.html
QLineEdit *sxy_lineEdit = addDoubleEdit("1.0", parent);
fLayout->addRow(QObject::tr("Scale XY"), sxy_lineEdit);
QLineEdit *sz_lineEdit = addDoubleEdit("1.0", parent);
fLayout->addRow(QObject::tr("Scale Z"), sz_lineEdit);
QCheckBox *interp_checkbox = new QCheckBox("Interpolation", parent);
interp_checkbox->setCheckState(Qt::Checked);
fLayout->addRow("", interp_checkbox);
QLineEdit *vt_lineEdit = addIntEdit("0", parent);
fLayout->addRow(QObject::tr("Interpolation VT"), vt_lineEdit);
QLineEdit *dt_lineEdit = addDoubleEdit("0.0", parent);
fLayout->addRow(QObject::tr("Interpolation DT"), dt_lineEdit);
// http://www.qtforum.org/article/2430/qcheckbox.html
QObject::connect(interp_checkbox, SIGNAL(toggled(bool)), vt_lineEdit, SLOT(setEnabled(bool)));
QObject::connect(interp_checkbox, SIGNAL(toggled(bool)), dt_lineEdit, SLOT(setEnabled(bool)));
QCheckBox *smoothing_checkbox = new QCheckBox("Smoothing", parent);
smoothing_checkbox->setCheckState(Qt::Checked);
fLayout->addRow("", smoothing_checkbox);
QLineEdit *sm_lineEdit = addIntEdit("0", parent);
fLayout->addRow(QObject::tr("Smoothing Level"), sm_lineEdit);
QObject::connect(smoothing_checkbox, SIGNAL(toggled(bool)), sm_lineEdit, SLOT(setEnabled(bool)));
QCheckBox *clipping_checkbox = new QCheckBox("Clipping", parent);
clipping_checkbox->setCheckState(Qt::Checked);
fLayout->addRow("", clipping_checkbox);
QLineEdit *cl_lineEdit = addIntEdit("0", parent);
fLayout->addRow(QObject::tr("Clipping Level"), cl_lineEdit);
QObject::connect(clipping_checkbox, SIGNAL(toggled(bool)), cl_lineEdit, SLOT(setEnabled(bool)));
QDialogButtonBox *buttonBox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal,
parent);
QVBoxLayout *vLayout = new QVBoxLayout(parent);
vLayout->addLayout(fLayout);
vLayout->addWidget(buttonBox);
QDialog *dialog = new QDialog(parent);
dialog->setWindowTitle("SIGEN");
dialog->setLayout(vLayout);
dialog->setFixedSize(dialog->sizeHint());
QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
bool retval;
switch (dialog->exec()) {
case QDialog::Accepted:
retval = true;
break;
case QDialog::Rejected:
retval = false;
break;
default:
assert(false);
break;
}
// v3d_msg(vt_lineEdit->text() + "/" + dt_lineEdit->text() + "/" + sm_lineEdit->text() + "/" + cl_lineEdit->text(), true);
if (retval) {
options->scale_xy = sxy_lineEdit->text().toDouble();
options->scale_z = sz_lineEdit->text().toDouble();
options->enable_interpolation = interp_checkbox->checkState() == Qt::Checked;
options->volume_threshold = vt_lineEdit->text().toInt();
options->distance_threshold = dt_lineEdit->text().toDouble();
options->enable_smoothing = smoothing_checkbox->checkState() == Qt::Checked;
options->smoothing_level = sm_lineEdit->text().toInt();
options->enable_clipping = clipping_checkbox->checkState() == Qt::Checked;
options->clipping_level = cl_lineEdit->text().toInt();
}
return retval;
}