本文整理汇总了C++中QComboBox::setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setMinimumHeight方法的具体用法?C++ QComboBox::setMinimumHeight怎么用?C++ QComboBox::setMinimumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::setMinimumHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEditor
QWidget* ComboDelegate::createEditor( QWidget* parent,
const QStyleOptionViewItem&,
const QModelIndex&) const {
QComboBox* combo = new QComboBox(parent);
combo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
combo->setMinimumHeight(ComboDelegate::MINIMUM_EDITOR_HEIGHT);
return combo;
}
示例2: addCombo
// Create new combo widget
QtWidgetObject* AtenTreeGuiDialog::addCombo(TreeGuiWidget* widget, QString label)
{
QtWidgetObject* qtwo = widgetObjects_.add();
QComboBox* combo = new QComboBox(this);
qtwo->set(widget, combo, label);
// Add items to combo and set current index
for (int n=0; n<widget->comboItems().count(); ++n) combo->addItem(widget->comboItems().at(n));
combo->setCurrentIndex(widget->valueI() - 1);
combo->setEnabled(widget->enabled());
combo->setVisible(widget->visible());
combo->setMinimumHeight(WIDGETHEIGHT);
combo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// Connect signal to master slot
QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(comboWidget_currentIndexChanged(int)));
return qtwo;
}
示例3: QComboBox
QWidget * MTPageNym_AltLocation::createSingleContactItem(GroupBoxContactItems * pGroupBox, int nComboIndex/*=0*/,
const QString textValue/*=""*/, const bool bIsPrimary/*=false*/)
{
QWidget * pWidgetContactItem = new QWidget;
// ----------------------------------------------------------
QComboBox * pComboType = new QComboBox(pWidgetContactItem);
QLineEdit * pLineEditItemValue = new QLineEdit(pWidgetContactItem);
QPushButton * pBtnDelete = new QPushButton(tr("Delete"), pWidgetContactItem);
QRadioButton * pBtnRadio = new QRadioButton(tr("Primary"), pWidgetContactItem);
pGroupBox->addRadioButton(pBtnRadio);
// ----------------------------------------------------------
pComboType->setMinimumWidth(60);
pComboType->setMinimumHeight(25);
pComboType->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
pBtnDelete->setMinimumHeight(25);
pBtnDelete->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
pLineEditItemValue->setMinimumWidth(55);
pLineEditItemValue->setMinimumHeight(25);
pLineEditItemValue->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// ----------------------------------------------------------
pWidgetContactItem->setProperty("groupbox", VPtr<GroupBoxContactItems>::asQVariant(pGroupBox));
pWidgetContactItem->setProperty("combo", VPtr<QComboBox>::asQVariant(pComboType));
pWidgetContactItem->setProperty("lineedit", VPtr<QLineEdit>::asQVariant(pLineEditItemValue));
pWidgetContactItem->setProperty("deletebtn", VPtr<QPushButton>::asQVariant(pBtnDelete));
pWidgetContactItem->setProperty("radiobtn", VPtr<QRadioButton>::asQVariant(pBtnRadio));
// ----------------------------------------------------------
pComboType ->setProperty("contactitemwidget", VPtr<QWidget>::asQVariant(pWidgetContactItem));
pLineEditItemValue->setProperty("contactitemwidget", VPtr<QWidget>::asQVariant(pWidgetContactItem));
pBtnDelete ->setProperty("contactitemwidget", VPtr<QWidget>::asQVariant(pWidgetContactItem));
pBtnRadio ->setProperty("contactitemwidget", VPtr<QWidget>::asQVariant(pWidgetContactItem));
// ---------------------------------------------------------
// pBtnDelete->setMinimumWidth(60);
// pBtnDelete->setProperty("contactSection", contactSection);
// pBtnDelete->setProperty("contactSectionType", contactSectionType);
// ----------------------------------------------------------
for (QMap<uint32_t, QString>::iterator it_types = pGroupBox->mapTypeNames_.begin();
it_types != pGroupBox->mapTypeNames_.end();
++it_types)
{
const uint32_t & key = it_types.key(); // section type ID
const QString & value = it_types.value(); // section type name
pComboType->addItem(value, QVariant::fromValue(key));
}
// ----------------------------------------------------------
// We don't set this until here, underneath the above loop.
// After all, you can't set the combo box to a certain current index
// if you haven't even populated it yet!
//
pBtnRadio->setChecked(bIsPrimary);
pComboType->setCurrentIndex(nComboIndex);
pLineEditItemValue->setText(textValue);
// ----------------------------------------------------------
QHBoxLayout *layout = new QHBoxLayout(pWidgetContactItem);
layout->setMargin(0);
layout->addWidget(pComboType);
layout->addWidget(pLineEditItemValue);
layout->addWidget(pBtnRadio);
layout->addWidget(pBtnDelete);
// ----------------------------------------------------------
pWidgetContactItem->setLayout(layout);
connect(pComboType, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBox_currentIndexChanged(int)) );
connect(pBtnDelete, SIGNAL(clicked()), this, SLOT(on_btnContactItemDelete_clicked()));
connect(pLineEditItemValue, SIGNAL(textChanged(QString)), this, SLOT(on_lineEditItemValue_textChanged(QString)));
connect(pBtnRadio, SIGNAL(toggled(bool)), this, SLOT(on_btnPrimary_toggled(bool)));
// connect(this, SIGNAL(initialNameProfileSetting(QString)), pLineEditItemValue, SIGNAL(textChanged(QString)));
// ----------------------------------------------------------
// layout->setStretch(0, 0);
// layout->setStretch(1, -1);
// layout->setStretch(2, 0);
// ----------------------------------------------------------
return pWidgetContactItem;
}