本文整理汇总了C++中KComboBox::findText方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::findText方法的具体用法?C++ KComboBox::findText怎么用?C++ KComboBox::findText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::findText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: comboBox
bool Widgets::comboBox(QWidget *parent, const QString& title, const QString& text, const QStringList& args,
const QString& defaultEntry, QString &result)
{
KDialog dlg( parent );
kapp->setTopWidget( &dlg );
dlg.setCaption( title );
dlg.setButtons( KDialog::Ok|KDialog::Cancel );
dlg.setModal( true );
dlg.setDefaultButton( KDialog::Ok );
KVBox* vbox = new KVBox( &dlg );
dlg.setMainWidget( vbox );
QLabel label (vbox);
label.setText (text);
KComboBox combo (vbox);
combo.insertItems (0, args);
combo.setCurrentIndex( combo.findText( defaultEntry ) );
handleXGeometry(&dlg);
bool retcode = (dlg.exec() == QDialog::Accepted);
if (retcode)
result = combo.currentText();
return retcode;
}
示例2: setEditorData
void KisInputModeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
KComboBox *combo = qobject_cast<KComboBox *>(editor);
Q_ASSERT(combo);
int i = combo->findText(d->action->shortcutIndexes().key(index.data(Qt::EditRole).toUInt()));
combo->setCurrentIndex(i);
}
示例3: setEditorData
void TracksDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
KComboBox *comboBox = qobject_cast<KComboBox *>(editor);
if (!comboBox)
return;
const int pos = comboBox->findText(index.model()->data(index).toString(), Qt::MatchExactly);
comboBox->setCurrentIndex(pos);
}
示例4: init
void ConditionalDialog::init(KCConditional const & tmp, int numCondition)
{
kDebug() << "Adding" << numCondition;
KComboBox * cb = 0;
KComboBox * sb = 0;
KLineEdit * kl1 = 0;
KLineEdit * kl2 = 0;
QString value;
KCMap *const map = m_selection->activeSheet()->map();
KCValueConverter *const converter = map->converter();
switch (numCondition) {
case 0:
cb = m_dlg->m_condition_1;
sb = m_dlg->m_style_1;
kl1 = m_dlg->m_firstValue_1;
kl2 = m_dlg->m_secondValue_1;
break;
case 1:
cb = m_dlg->m_condition_2;
sb = m_dlg->m_style_2;
kl1 = m_dlg->m_firstValue_2;
kl2 = m_dlg->m_secondValue_2;
break;
case 2:
cb = m_dlg->m_condition_3;
sb = m_dlg->m_style_3;
kl1 = m_dlg->m_firstValue_3;
kl2 = m_dlg->m_secondValue_3;
break;
default:
return;
}
if (!tmp.styleName.isEmpty()) {
sb->setCurrentIndex(sb->findText(tmp.styleName));
sb->setEnabled(true);
}
switch (tmp.cond) {
case KCConditional::None :
case KCConditional::IsTrueFormula: // was unhandled
break;
case KCConditional::Equal :
cb->setCurrentIndex(1);
break;
case KCConditional::Superior :
cb->setCurrentIndex(2);
break;
case KCConditional::Inferior :
cb->setCurrentIndex(3);
break;
case KCConditional::SuperiorEqual :
cb->setCurrentIndex(4);
break;
case KCConditional::InferiorEqual :
cb->setCurrentIndex(5);
break;
case KCConditional::Between :
cb->setCurrentIndex(6);
kl2->setText(converter->asString(tmp.value2).asString());
break;
case KCConditional::Different :
cb->setCurrentIndex(7);
kl2->setText(converter->asString(tmp.value2).asString());
break;
case KCConditional::DifferentTo :
cb->setCurrentIndex(8);
break;
}
if (tmp.cond != KCConditional::None) {
kl1->setEnabled(true);
kl1->setText(converter->asString(tmp.value1).asString());
}
}