本文整理汇总了C++中QDateEdit::setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QDateEdit::setMinimumSize方法的具体用法?C++ QDateEdit::setMinimumSize怎么用?C++ QDateEdit::setMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateEdit
的用法示例。
在下文中一共展示了QDateEdit::setMinimumSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRangedSearch
void ExprParamElement::setRangedSearch(bool ranged)
{
if (inRangedConfig == ranged) return; // nothing to do here
inRangedConfig = ranged;
QHBoxLayout* hbox = (dynamic_cast<QHBoxLayout*>(internalframe->layout()));
// add additional or remove extra input fields depending on whether
// ranged search or not
if (inRangedConfig)
{
QLabel * toLbl = new QLabel(tr("to"));
toLbl->setMinimumSize(10, FIELDS_MIN_HEIGHT);
toLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
if (searchType == DateSearch) {
internalframe->setMinimumSize(250,26);
QDateEdit * dateEdit = new QDateEdit(QDate::currentDate(), internalframe);
dateEdit->setMinimumSize(DATE_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
dateEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
dateEdit->setObjectName("param2");
dateEdit->setDisplayFormat(tr("dd.MM.yyyy"));
dateEdit->setMinimumDate(QDate(1970, 1, 1));
dateEdit->setMaximumDate(QDate(2099, 12,31));
hbox->addSpacing(9);
hbox->addWidget(toLbl, Qt::AlignLeft);
hbox->addSpacing(9);
hbox->addWidget(dateEdit, Qt::AlignLeft);
hbox->addStretch();
} else if (searchType == SizeSearch) {
internalframe->setMinimumSize(340,26);
QLineEdit * lineEdit = new QLineEdit(internalframe);
lineEdit->setMinimumSize(SIZE_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
lineEdit->setMaximumSize(SIZE_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
lineEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
lineEdit->setObjectName("param2");
lineEdit->setValidator(numValidator);
QComboBox * cb = new QComboBox(internalframe);
cb->setObjectName("unitsCb2");
cb-> addItem(tr("KB"), QVariant(1024));
cb->addItem(tr("MB"), QVariant(1048576));
cb->addItem(tr("GB"), QVariant(1073741824));
hbox->addSpacing(9);
hbox->addWidget(toLbl, Qt::AlignLeft);
hbox->addSpacing(9);
hbox->addWidget(lineEdit, Qt::AlignLeft);
hbox->addSpacing(9);
hbox->addWidget(cb);
hbox->addStretch();
}
// else if (searchType == PopSearch)
// {
// elem->layout()->addWidget(new QLabel(tr("to")), Qt::AlignCenter);
// QLineEdit * lineEdit = new QLineEdit(elem);
// lineEdit->setObjectName("param2");
// lineEdit->setValidator(numValidator);
// elem->layout()->addWidget(slineEdit);
// }
hbox->invalidate();
internalframe->adjustSize();
internalframe->show();
this->adjustSize();
} else {
adjustForSearchType(searchType);
}
}
示例2: adjustForSearchType
void ExprParamElement::adjustForSearchType(ExprSearchType type)
{
// record which search type is active
searchType = type;
QRegExp regExp("0|[1-9][0-9]*");
numValidator = new QRegExpValidator(regExp, this);
QRegExp hexRegExp("[A-Fa-f0-9]*");
hexValidator = new QRegExpValidator(hexRegExp, this);
// remove all elements
QList<QWidget*> children = qFindChildren<QWidget*>(internalframe);
QWidget* child;
QLayout * lay_out = internalframe->layout();
while (!children.isEmpty())
{
child = children.takeLast();
child->hide();
lay_out->removeWidget(child);
delete child;
}
delete lay_out;
QHBoxLayout* hbox = createLayout();
internalframe->setLayout(hbox);
internalframe->setMinimumSize(320,26);
if (isStringSearchExpression())
{
// set up for default of a simple input field
QLineEdit* lineEdit = new QLineEdit(internalframe);
lineEdit->setMinimumSize(STR_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
lineEdit->setObjectName("param1");
hbox->addWidget(lineEdit);
hbox->addSpacing(9);
QCheckBox* icCb = new QCheckBox(tr("ignore case"), internalframe);
icCb->setObjectName("ignoreCaseCB");
icCb->setCheckState(Qt::Checked);
// hex search specifics: hidden case sensitivity and hex validator
if (searchType == HashSearch) {
icCb->hide();
lineEdit->setValidator(hexValidator);
}
hbox->addWidget(icCb);
hbox->addStretch();
} else if (searchType == DateSearch)
{
QDateEdit * dateEdit = new QDateEdit(QDate::currentDate(), internalframe);
dateEdit->setMinimumSize(DATE_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
dateEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
dateEdit->setDisplayFormat(tr("dd.MM.yyyy"));
dateEdit->setObjectName("param1");
dateEdit->setMinimumDate(QDate(1970, 1, 1));
dateEdit->setMaximumDate(QDate(2099, 12,31));
hbox->addWidget(dateEdit, Qt::AlignLeft);
hbox->addStretch();
} else if (searchType == SizeSearch)
{
QLineEdit * lineEdit = new QLineEdit(internalframe);
lineEdit->setMinimumSize(SIZE_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
lineEdit->setMaximumSize(SIZE_FIELDS_MIN_WIDTH, FIELDS_MIN_HEIGHT);
lineEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
lineEdit->setObjectName("param1");
lineEdit->setValidator(numValidator);
hbox->addWidget(lineEdit, Qt::AlignLeft);
QComboBox * cb = new QComboBox(internalframe);
cb->setObjectName("unitsCb1");
cb-> addItem(tr("KB"), QVariant(1024));
cb->addItem(tr("MB"), QVariant(1048576));
cb->addItem(tr("GB"), QVariant(1073741824));
hbox->addSpacing(9);
internalframe->layout()->addWidget(cb);
hbox->addStretch();
}
/* POP Search not implemented
else if (searchType == PopSearch)
{
QLineEdit * lineEdit = new QLineEdit(elem);
lineEdit->setObjectName("param1");
lineEdit->setValidator(numValidator);
elem->layout()->addWidget(lineEdit);
}*/
hbox->invalidate();
internalframe->adjustSize();
internalframe->show();
this->adjustSize();
}