本文整理汇总了C++中KComboBox::itemText方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::itemText方法的具体用法?C++ KComboBox::itemText怎么用?C++ KComboBox::itemText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::itemText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extraArgumentsHistory
QStringList CMakeBuildDirChooser::extraArgumentsHistory() const
{
QStringList list;
KComboBox* extraArguments = m_chooserUi->extraArguments;
if (!extraArguments->currentText().isEmpty()) {
list << extraArguments->currentText();
}
for (int i = 0; i < qMin(maxExtraArgumentsInHistory, extraArguments->count()); ++i) {
if (!extraArguments->itemText(i).isEmpty() &&
(extraArguments->currentText() != extraArguments->itemText(i))) {
list << extraArguments->itemText(i);
}
}
return list;
}
示例2: _k_appChanged
void KBugReportPrivate::_k_appChanged(int i)
{
QString appName = appcombo->itemText(i);
int index = appName.indexOf( '/' );
if ( index > 0 )
appName = appName.left( index );
kDebug() << "appName " << appName;
QString strDisplayVersion; //Version string to show in the UI
if (appname == appName && m_aboutData) {
m_strVersion = m_aboutData->version();
strDisplayVersion = m_strVersion;
} else {
m_strVersion = QLatin1String("unknown"); //English string to put in the bug report
strDisplayVersion = i18nc("unknown program name", "unknown");
}
if ( !submitBugWeb ) {
m_strVersion += ' ' + kde_version;
strDisplayVersion += ' ' + kde_version;
}
m_version->setText(strDisplayVersion);
if ( submitBugWeb )
_k_updateUrl();
}
示例3: setWallpaper
void BGDialog::setWallpaper(const QString &s)
{
KComboBox *comboWallpaper = m_urlWallpaperBox;
int i = comboWallpaper->count();
if (i == 0)
return;
comboWallpaper->blockSignals(true);
if (m_wallpaper.find(s) == m_wallpaper.end()) {
QString imageCaption;
int slash = s.lastIndexOf('/') + 1;
int endDot = s.lastIndexOf('.');
// strip the extension if it exists
if (endDot != -1 && endDot > slash)
imageCaption = s.mid(slash, endDot - slash);
else
imageCaption = s.mid(slash);
if (comboWallpaper->itemText(i - 1) == imageCaption) {
i--;
comboWallpaper->removeItem(i);
}
comboWallpaper->addItem(imageCaption);
m_wallpaper[s] = i;
comboWallpaper->setCurrentIndex(i);
} else {
comboWallpaper->setCurrentIndex(m_wallpaper[s]);
}
comboWallpaper->blockSignals(false);
}
示例4: setDirName
void FindFilesDialog::setDirName(const QString &dir)
{
KComboBox *combo = dir_combo->comboBox();
if (findListItem(combo, dir) < 0) {
combo->addItem(dir);
}
if (combo->itemText(0) != dir) {
slotClear();
}
}
示例5: testChildActionStateChangeComboMode
void KSelectAction_UnitTest::testChildActionStateChangeComboMode()
{
KSelectAction selectAction("selectAction", 0);
selectAction.setToolBarMode(KSelectAction::ComboBoxMode);
QWidget parent;
QWidget* widget = selectAction.requestWidget(&parent);
KComboBox* comboBox = qobject_cast<KComboBox*>(widget);
QVERIFY(comboBox);
const QString itemText = "foo";
KAction* childAction = selectAction.addAction(itemText);
QCOMPARE(comboBox->itemText(0), itemText);
childAction->setEnabled(false);
// There's no API for item-is-enabled, need to go via the internal model like kselectaction does...
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(comboBox->model());
QVERIFY(model);
QVERIFY(!model->item(0)->isEnabled());
// Now remove the action
selectAction.removeAction(childAction);
QCOMPARE(comboBox->count(), 0);
}