本文整理汇总了C++中QComboBox::setInsertPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setInsertPolicy方法的具体用法?C++ QComboBox::setInsertPolicy怎么用?C++ QComboBox::setInsertPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::setInsertPolicy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEditor
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const {
QComboBox* editor = new QComboBox(parent);
editor->setInsertPolicy(QComboBox::NoInsert);
editor->addItem(output2text(ClipCommand::IGNORE), QVariant::fromValue<ClipCommand::Output>(ClipCommand::IGNORE));
editor->addItem(output2text(ClipCommand::REPLACE), QVariant::fromValue<ClipCommand::Output>(ClipCommand::REPLACE));
editor->addItem(output2text(ClipCommand::ADD), QVariant::fromValue<ClipCommand::Output>(ClipCommand::ADD));
return editor;
}
示例2: QComboBox
QWidget *ComboPayeursDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
QComboBox * combo = new QComboBox(parent);
combo->setEditable(true);
combo->setInsertPolicy(QComboBox::InsertAtTop);
return combo;
}
示例3: sMask
static
QComboBox *controlParamComboBox (
synthv1_controls::Type ctype, QWidget *pParent )
{
QComboBox *pComboBox = new QComboBox(pParent);
synthv1widget_controls::Names map;
int iParamMin = 0;
int iParamMax = iParamMin;
switch(ctype) {
case synthv1_controls::CC:
iParamMin = 0;
iParamMax = 128;
map = synthv1widget_controls::controllerNames();
break;
case synthv1_controls::RPN:
map = synthv1widget_controls::rpnNames();
break;
case synthv1_controls::NRPN:
map = synthv1widget_controls::nrpnNames();
break;
case synthv1_controls::CC14:
iParamMin = 1;
iParamMax = 32;
map = synthv1widget_controls::control14Names();
// Fall thru...
default:
break;
}
const bool bEditable = (iParamMin >= iParamMax);
pComboBox->setEditable(bEditable);
pComboBox->setInsertPolicy(QComboBox::NoInsert);
const QString sMask("%1 - %2");
if (bEditable) {
synthv1widget_controls::Names::ConstIterator iter
= map.constBegin();
const synthv1widget_controls::Names::ConstIterator& iter_end
= map.constEnd();
for ( ; iter != iter_end; ++iter) {
const unsigned short param = iter.key();
pComboBox->addItem(sMask.arg(param).arg(iter.value()), int(param));
}
} else {
for (int iParam = iParamMin; iParam < iParamMax; ++iParam) {
const unsigned short param = iParam;
pComboBox->addItem(sMask.arg(param).arg(map.value(param)), iParam);
}
}
return pComboBox;
}
示例4:
QWidget *EventsWindow::createTagsInput()
{
QComboBox *tagInput = new QComboBox;
tagInput->setEditable(true);
tagInput->setInsertPolicy(QComboBox::NoInsert);
#if QT_VERSION >= 0x040700
tagInput->lineEdit()->setPlaceholderText(tr("Type or select a tag to filter"));
#endif
return tagInput;
}
示例5: createEditor
QWidget* ComboBoxItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
QComboBox* editor = new QComboBox(parent);
editor->setModel(m_model);
editor->setEditable(m_editable);
editor->setInsertPolicy(QComboBox::NoInsert);
return editor;
}
示例6: prepareTilesetGroup
void TilesetItemBox::prepareTilesetGroup(const SimpleTilesetGroup &tilesetGroups)
{
if(lockTilesetBox) return;
QWidget *t = findTabWidget(tilesetGroups.groupCat);
if(!t)
t = makeCategory(tilesetGroups.groupCat);
QComboBox *c = getGroupComboboxOfTab(t);
if(!c)
return;
c->setInsertPolicy(QComboBox::InsertAlphabetically);
if(!util::contains(c, tilesetGroups.groupName))
c->addItem(tilesetGroups.groupName);
c->model()->sort(0);
c->setCurrentIndex(0);
connect(c, SIGNAL(currentIndexChanged(int)), this, SLOT(on_tilesetGroup_currentIndexChanged(int)));
}
示例7: QWidget
QWidget *TilesetItemBox::makeCategory(const QString &categoryItem)
{
QTabWidget *TileSetsCategories = ui->TileSetsCategories;
QWidget *catWid;
QWidget *scrollWid;
QGridLayout *catLayout;
QLabel *grpLabel;
QComboBox *tilesetGroup;
QSpacerItem *spItem;
QScrollArea *TileSets;
FlowLayout *theLayOut;
catWid = new QWidget();
scrollWid = new QWidget();
catLayout = new QGridLayout(catWid);
catLayout->setSpacing(0);
catLayout->setContentsMargins(0, 0, 0, 0);
grpLabel = new QLabel(catWid);
grpLabel->setText(tr("Group:"));
catLayout->addWidget(grpLabel, 0, 0, 1, 1);
tilesetGroup = new QComboBox(catWid);
catLayout->addWidget(tilesetGroup, 0, 1, 1, 1);
tilesetGroup->setInsertPolicy(QComboBox::InsertAlphabetically);
spItem = new QSpacerItem(1283, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
catLayout->addItem(spItem, 0, 2, 1, 1);
TileSets = new QScrollArea(catWid);
TileSets->setWidget(scrollWid);
TileSets->setWidgetResizable(true);
TileSets->setFrameShape(QFrame::StyledPanel);
TileSets->setFrameShadow(QFrame::Raised);
TileSets->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
TileSets->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
theLayOut = new FlowLayout(scrollWid);
theLayOut->setSizeConstraint(QLayout::SetNoConstraint);
catLayout->addWidget(TileSets, 1, 0, 1, 3);
TileSetsCategories->addTab(catWid, QString());
TileSetsCategories->setTabText(TileSetsCategories->indexOf(catWid), categoryItem);
return catWid;
}
示例8: createToolBar
//.........这里部分代码省略.........
mToolBar->addSeparator();
//
// align group button
QToolButton *alignButton = new QToolButton(mToolBar);
alignButton->setIcon(findIcon("tool-align.png"));
alignButton->setPopupMode(QToolButton::InstantPopup);
alignButton->setToolTip(tr("Alignment"));
mToolBar->addWidget(alignButton);
//Grid alignment
action = new QAction(findIcon("tool-align-grid.png"), tr("Grid alignment"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("5", "Grid alignment")));
alignButton->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onGridAlignment()));
// tuple alignment
action = new QAction(findIcon("tool-align-tuple.png"), tr("Tuple alignment"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("6", "Tuple alignment")));
alignButton->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onTupleAlignment()));
//Vertical alignment
action = new QAction(findIcon("tool-align-vert.png"), tr("Vertical alignment"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("7", "Vertical alignment")));
alignButton->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onVerticalAlignment()));
//Horizontal alignment
action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("8", "Horizontal alignment")));
alignButton->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment()));
// selection group button
QToolButton *selectButton = new QToolButton(mToolBar);
selectButton->setIcon(findIcon("tool-select-group.png"));
selectButton->setPopupMode(QToolButton::InstantPopup);
selectButton->setToolTip(tr("Selection group"));
mToolBar->addWidget(selectButton);
// input/output selection
action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar);
action->setCheckable(false);
selectButton->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput()));
// sbgraph selection
action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar);
action->setCheckable(false);
selectButton->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph()));
mToolBar->addSeparator();
action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("0", "Export image")));
mToolBar->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onExportImage()));
//
mToolBar->addSeparator();
//
//Zoom in
action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("+", "Zoom in")));
mToolBar->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn()));
//Scale combobox
QComboBox* b = new QComboBox(mToolBar);
b->setEditable(true);
b->setInsertPolicy(QComboBox::NoInsert);
b->addItems(SCgWindow::mScales);
b->setCurrentIndex(mScales.indexOf("100"));
mZoomFactorLine = b->lineEdit();
mZoomFactorLine->setInputMask("D90%");
mToolBar->addWidget(b);
connect(mZoomFactorLine, SIGNAL(textChanged(const QString&)), mView, SLOT(setScale(const QString&)));
connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal)));
//Zoom out
action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar);
action->setCheckable(false);
action->setShortcut(QKeySequence(tr("-", "Zoom out")));
mToolBar->addAction(action);
connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut()));
mToolBar->setWindowTitle(tr("SCg Tools"));
mToolBar->setObjectName("SCgMainToolBar");
//! @bug toolbar state is not saved
mToolBar->setMovable(false);
}
示例9: QWidget
ServerTab::ServerTab(QWidget *parent)
: QWidget(parent)
{
const short int labelWidth = 80;
QComboBox* enginesCombo = new QComboBox;
enginesCombo->setEditable(false);
enginesCombo->setInsertPolicy(QComboBox::InsertAlphabetically);
enginesCombo->addItem("Rapidshare");
QLabel* downloadsLabel = new QLabel(tr("Simultanious downloads:"));
downloadsLabel->setMinimumWidth(labelWidth);
QSpinBox* downloadsSpin = new QSpinBox;
downloadsSpin->setRange(1,999);
downloadsSpin->setValue(2);
downloadsSpin->setMaximumWidth(45);
QHBoxLayout* downloadsLayout = new QHBoxLayout;
downloadsLayout->addWidget(downloadsLabel);
downloadsLayout->addWidget(downloadsSpin);
downloadsLayout->addStretch(1);
QCheckBox* credentialsCheck = new QCheckBox(tr("Use credentials"));
connect(credentialsCheck,SIGNAL( stateChanged ( int ) ), this, SLOT( useCredentialChecked( int ) ) );
QLabel* userLabel = new QLabel(tr("User:"));
userLabel->setMinimumWidth(labelWidth);
m_UserEdit = new QLineEdit;
QHBoxLayout* userLayout = new QHBoxLayout;
userLayout->addWidget(userLabel);
userLayout->addWidget(m_UserEdit);
userLayout->addStretch(1);
QLabel* passwordLabel = new QLabel(tr("Password:"));
passwordLabel->setMinimumWidth(labelWidth);
m_PasswordEdit = new QLineEdit;
//m_PasswordEdit->setDisabled(true);
m_PasswordEdit->setEchoMode(QLineEdit::Password);
QHBoxLayout* passwordLayout = new QHBoxLayout;
passwordLayout->addWidget(passwordLabel);
passwordLayout->addWidget(m_PasswordEdit);
passwordLayout->addStretch(1);
QVBoxLayout* layout = new QVBoxLayout;
layout->addSpacing(settings_ui::SpaceBeforeFirstWidget);
layout->addWidget(enginesCombo);
layout->addSpacing(settings_ui::SpaceBeforeFirstWidget);
layout->addLayout(downloadsLayout);
layout->addSpacing(settings_ui::SpaceBeetwenWidgets);
layout->addWidget(credentialsCheck);
layout->addSpacing(settings_ui::SpaceBeetwenWidgets/2);
layout->addLayout(userLayout);
layout->addSpacing(settings_ui::SpaceBeetwenWidgets/2);
layout->addLayout(passwordLayout);
layout->addStretch(1);
setLayout(layout);
QString userName = Proxy::settings()->value(SettingsValNames::scPluginUsername,Settings::PLUGINS,QString("rapidshare")).toString();
QString userPass = Proxy::settings()->value(SettingsValNames::scPluginPassword,Settings::PLUGINS,QString("rapidshare")).toString();
bool useCredentials = Proxy::settings()->value(SettingsValNames::scUseCredentials,Settings::PLUGINS,QString("rapidshare")).toBool();
if (!userPass.isEmpty())
userPass = Proxy::decrypt(userPass);
//LOG(QString("User Name and pass from QSettings are : %1 - %2 ").arg( userName ).arg( userPass ));
credentialsCheck->setChecked(useCredentials);
m_UserEdit->setText(userName);
m_PasswordEdit->setText(userPass);
useCredentialChecked(credentialsCheck->checkState());
}