当前位置: 首页>>代码示例>>C++>>正文


C++ KComboBox::findText方法代码示例

本文整理汇总了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;
}
开发者ID:vishesh,项目名称:kde-baseapps,代码行数:28,代码来源:widgets.cpp

示例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);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:8,代码来源:kis_input_mode_delegate.cpp

示例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);
}
开发者ID:JongHong,项目名称:kdenlive,代码行数:8,代码来源:tracksconfigdialog.cpp

示例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());
    }
}
开发者ID:KDE,项目名称:koffice,代码行数:83,代码来源:ConditionalDialog.cpp


注:本文中的KComboBox::findText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。