本文整理汇总了C++中KComboBox::currentText方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::currentText方法的具体用法?C++ KComboBox::currentText怎么用?C++ KComboBox::currentText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::currentText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: slotRenamePinMap
void MicroSettingsDlg::slotRenamePinMap()
{
KComboBox * combo = m_pWidget->pinMapCombo;
QString oldName = combo->currentText();
if ( oldName.isEmpty() )
return;
PinMappingNameValidator * validator = new PinMappingNameValidator( this, oldName );
bool ok = false;
QString newName = KInputDialog::getText( i18n("New Pin Map Name"), i18n("Name"), oldName, & ok, this, 0, validator );
delete validator;
if ( !ok )
return;
if ( newName == oldName )
return;
m_pinMappings[ newName ] = m_pinMappings[ oldName ];
m_pinMappings.remove( oldName );
combo->setCurrentText( newName );
}
示例3: 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;
}
示例4: setModelData
void TracksDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
KComboBox *comboBox = qobject_cast<KComboBox *>(editor);
if (!comboBox)
return;
model->setData(index, comboBox->currentText());
}
示例5: setModelData
void KisInputModeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
KComboBox *combo = qobject_cast<KComboBox *>(editor);
Q_ASSERT(combo);
int i = d->action->shortcutIndexes().value(combo->currentText());
model->setData(index, i, Qt::EditRole);
}
示例6: _k_updateUrl
void KBugReportPrivate::_k_updateUrl()
{
url = KUrl( "https://bugs.kde.org/wizard.cgi" );
url.addQueryItem( "os", os );
url.addQueryItem( "compiler", KDE_COMPILER_VERSION );
url.addQueryItem( "kdeVersion", kde_version );
url.addQueryItem( "appVersion", m_strVersion );
url.addQueryItem( "package", appcombo->currentText() );
url.addQueryItem( "kbugreport", "1" );
}
示例7: slotRemovePinMap
void MicroSettingsDlg::slotRemovePinMap()
{
KComboBox * combo = m_pWidget->pinMapCombo;
QString pinMapID = combo->currentText();
if ( pinMapID.isEmpty() )
return;
m_pinMappings.remove( pinMapID );
combo->removeItem( combo->currentItem() );
updatePinMapButtons();
}
示例8: setModelData
void IngredientNameDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
KComboBox *comboBox = static_cast<KComboBox*>( editor );
QString text = comboBox->currentText();
model->setData( index, text, Qt::EditRole );
if ( index.data(IngredientsEditor::IsHeaderRole).toBool() ) {
//The edited item is a header
if ( m_headerNameToIdMap.contains(text) ) {
model->setData( index, m_headerNameToIdMap.values(text).first(), IngredientsEditor::IdRole );
} else {
model->setData( index, RecipeDB::InvalidId, IngredientsEditor::IdRole );
}
} else {
//The edited item is an ingredient
if ( m_ingredientNameToIdMap.contains(text) ) {
model->setData( index, m_ingredientNameToIdMap.values(text).first(), IngredientsEditor::IdRole );
} else {
model->setData( index, RecipeDB::InvalidId, IngredientsEditor::IdRole );
}
}
}
示例9: tmpOut
CreateChecksumDlg::CreateChecksumDlg(const QStringList& files, bool containFolders, const QString& path)
: QDialog(krApp)
{
setWindowModality(Qt::WindowModal);
setWindowTitle(i18n("Create Checksum"));
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QList<CS_Tool *> tools = getTools(containFolders);
if (tools.count() == 0) { // nothing was suggested?!
QString error = i18n("<qt>Cannot calculate checksum since no supported tool was found. "
"Please check the <b>Dependencies</b> page in Krusader's settings.</qt>");
if (containFolders)
error += i18n("<qt><b>Note</b>: you have selected folders, and probably have no recursive checksum tool installed."
" Krusader currently supports <i>md5deep, sha1deep, sha256deep, tigerdeep and cfv</i></qt>");
KMessageBox::error(0, error);
return;
}
QWidget * widget = new QWidget(this);
QGridLayout *layout = new QGridLayout(widget);
int row = 0;
// title (icon+text)
QHBoxLayout *hlayout = new QHBoxLayout;
QLabel *p = new QLabel(widget);
p->setPixmap(krLoader->loadIcon("document-edit-sign", KIconLoader::Desktop, 32));
hlayout->addWidget(p);
QLabel *l1 = new QLabel(widget);
if (containFolders)
l1->setText(i18n("About to calculate checksum for the following files and folders:"));
else
l1->setText(i18n("About to calculate checksum for the following files:"));
hlayout->addWidget(l1);
layout->addLayout(hlayout, row, 0, 1, 2, Qt::AlignLeft);
++row;
// file list
KrListWidget *lb = new KrListWidget(widget);
lb->addItems(files);
layout->addWidget(lb, row, 0, 1, 2);
++row;
// checksum method
QHBoxLayout *hlayout2 = new QHBoxLayout;
QLabel *l2 = new QLabel(i18n("Select the checksum method:"), widget);
hlayout2->addWidget(l2);
KComboBox *method = new KComboBox(widget);
// -- fill the combo with available methods
int i;
for (i = 0; i < tools.count(); ++i)
method->addItem(cs_typeToText[tools.at(i)->type], i);
method->setFocus();
hlayout2->addWidget(method);
layout->addLayout(hlayout2, row, 0, 1, 2, Qt::AlignLeft);
++row;
mainLayout->addWidget(widget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
mainLayout->addWidget(buttonBox);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
if (exec() != Accepted) return;
// else implied: run the process
QTemporaryFile tmpOut(QDir::tempPath() + QLatin1String("/krusader_XXXXXX.stdout"));
tmpOut.open(); // necessary to create the filename
QTemporaryFile tmpErr(QDir::tempPath() + QLatin1String("/krusader_XXXXXX.stderr"));
tmpErr.open(); // necessary to create the filename
KProcess proc;
CS_Tool *mytool = tools.at(method->currentIndex());
mytool->create(proc, mytool, files, QString(), containFolders, method->currentText());
proc.setOutputChannelMode(KProcess::SeparateChannels); // without this the next 2 lines have no effect!
proc.setStandardOutputFile(tmpOut.fileName());
proc.setStandardErrorFile(tmpErr.fileName());
proc.setWorkingDirectory(path);
krApp->startWaiting(i18n("Calculating checksums..."), 0, true);
QApplication::setOverrideCursor(Qt::WaitCursor);
proc.start();
// TODO make use of asynchronous process starting. waitForStarted(int msec = 30000) is blocking
// it would be better to connect to started(), error() and finished()
if (proc.waitForStarted())
while (proc.state() == QProcess::Running) {
usleep(500);
qApp->processEvents();
if (krApp->wasWaitingCancelled()) { // user cancelled
proc.kill();
QApplication::restoreOverrideCursor();
return;
}
//.........这里部分代码省略.........