本文整理汇总了C++中currentText函数的典型用法代码示例。如果您正苦于以下问题:C++ currentText函数的具体用法?C++ currentText怎么用?C++ currentText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currentText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: currentText
QTime KTimeEdit::getTime() const
{
//kdDebug(5300) << "KTimeEdit::getTime(), currentText() = " << currentText() << endl;
// TODO use KLocale::WithoutSeconds in HEAD
bool ok = false;
QTime time = KGlobal::locale()->readTime(currentText(), KLocale::WithoutSeconds, &ok);
if(!ok)
{
// Also try to accept times in "military format", i.e. no delimiter, like 1200
int tm = currentText().toInt(&ok);
if((0 <= tm) && (tm < 2400) && (tm % 100 < 60) && ok)
{
time.setHMS(tm / 100, tm % 100, 0);
}
else
{
ok = false;
}
}
kdDebug(5300) << "KTimeEdit::getTime(): " << time.toString() << endl;
return time;
}
示例2: slotPatternChanged
/**
* Called when the pattern has changed. This method
* sets the current pattern to the value chosen.
*/
void QG_PatternBox::slotPatternChanged(int index) {
RS_DEBUG->print("QG_PatternBox::slotPatternChanged %d\n", index);
currentPattern = RS_PATTERNLIST->requestPattern(currentText());
if (currentPattern!=NULL) {
RS_DEBUG->print("Current pattern is (%d): %s\n",
index, currentPattern->getFileName().toLatin1().data());
}
emit patternChanged(currentPattern);
}
示例3: currentText
QString QgsFieldExpressionWidget::currentField( bool *isExpression, bool *isValid ) const
{
QString text = currentText();
if ( isValid )
{
*isValid = isValidExpression();
}
if ( isExpression )
{
*isExpression = this->isExpression();
}
return text;
}
示例4: currentText
GeocoordType GeocoordTypeComboBox::getGeocoordType() const
{
if (currentIndex() != -1)
{
std::string typeText = currentText().toStdString();
if (typeText.empty() == false)
{
return StringUtilities::fromDisplayString<GeocoordType>(typeText);
}
}
return GeocoordType();
}
示例5: currentText
bool CommandComboBox::event(QEvent *e)
{
if (e->type() == QEvent::ToolTip) {
const QString text = currentText();
if (const Core::Command *cmd = command(text)) {
const QString tooltip = tr("Activate %1 Pane").arg(text);
setToolTip(cmd->stringWithAppendedShortcut(tooltip));
} else {
setToolTip(text);
}
}
return QComboBox::event(e);
}
示例6: setUpdatesEnabled
void KonqCombo::removeURL( const QString& url )
{
setUpdatesEnabled( false );
lineEdit()->setUpdatesEnabled( false );
removeFromHistory( url );
applyPermanent();
setTemporary( currentText() );
setUpdatesEnabled( true );
lineEdit()->setUpdatesEnabled( true );
update();
}
示例7: currentText
QgsVectorColorRampV2* QgsColorRampComboBox::currentColorRamp()
{
QString rampName = currentText();
if ( rampName == tr( "Random colors" ) )
{
return new QgsRandomColorsV2();
}
else if ( rampName == "[source]" && mSourceColorRamp )
return mSourceColorRamp->clone();
else
return mStyle->colorRamp( rampName );
}
示例8: currentText
ModisUtilities::RasterConversionType RasterConversionTypeComboBox::getRasterConversion() const
{
if (currentIndex() != -1)
{
std::string typeText = currentText().toStdString();
if (typeText.empty() == false)
{
return StringUtilities::fromDisplayString<ModisUtilities::RasterConversionType>(typeText);
}
}
return ModisUtilities::RasterConversionType();
}
示例9: currentText
bool ClassNameValidatingComboBox::isValid() const
{
const QString baseClass = currentText().trimmed();
if (!baseClass.isEmpty())
{
if (!d->m_validator.validate(baseClass)) {
d->m_errorMessage = tr("Invalid base class name");
return false;
}
}
d->m_errorMessage.clear();
return true;
}
示例10: Assert
void
VBoxDbgConsoleInput::returnPressed()
{
Assert(m_hGUIThread == RTThreadNativeSelf());
QString strCommand = currentText();
/** @todo trim whitespace? */
if (strCommand.isEmpty())
return;
/* deal with the current command. */
emit commandSubmitted(strCommand);
/*
* Add current command to history.
*/
bool fNeedsAppending = true;
/* invariant: empty line at the end */
int iLastItem = count() - 1;
Assert(itemText(iLastItem).isEmpty());
/* have previous command? check duplicate. */
if (iLastItem > 0)
{
const QString strPrevCommand(itemText(iLastItem - 1));
if (strCommand == strPrevCommand)
fNeedsAppending = false;
}
if (fNeedsAppending)
{
/* history full? drop the oldest command. */
if (count() == maxCount())
{
removeItem(0);
--iLastItem;
}
/* insert before the empty line. */
insertItem(iLastItem, strCommand);
}
/* invariant: empty line at the end */
int iNewLastItem = count() - 1;
Assert(itemText(iNewLastItem).isEmpty());
/* select empty line to present "new" command line to the user */
setCurrentIndex(iNewLastItem);
}
示例11: switch
void RComboBox::keyPressEvent(QKeyEvent *e)
{
timer->stop();
if (completer && completer->popup()->isVisible())
{
// The following keys are forwarded by the completer to the widget
switch (e->key())
{
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
case Qt::Key_Tab:
case Qt::Key_Backtab:
e->ignore();
return; // Let the completer do default behavior
}
}
if (e->text().length() > 0 && e->text().at(0).isPrint()){
if(this->lineEdit()->selectedText().size() > 0)
this->lineEdit()->del();
QString cur = currentText();
int pos = this->lineEdit()->cursorPosition();
cur = cur.left(pos)
.append(e->text())
.append(cur.right(cur.length()-pos));
setEditText(cur);
this->lineEdit()->setCursorPosition(pos+1);
//CustomComboBox::keyPressEvent(e);
}
else CustomComboBox::keyPressEvent(e);
if(currentText().length() < min_chars && completer->popup()->isVisible())
completer->popup()->close();
this->lineEdit()->deselect();
timer->start(timeout);
}
示例12: currentText
void hashBox::setupHashes(QList<int> nids)
{
QString md = currentText();
if (!wanted_md.isEmpty())
md = wanted_md;
clear();
for (unsigned i=0; i<ARRAY_SIZE(hashalgos); i++) {
if (nids.contains(hashalgos[i].md->type)) {
addItem(QString(hashalgos[i].name));
}
}
setDefaultHash();
setCurrentString(md);
}
示例13: currentText
//! Slot called when QComboBox has changed
void QgsScaleComboBox::fixupScale()
{
QStringList txtList = currentText().split( ':' );
bool userSetScale = txtList.size() != 2;
bool ok;
double newScale = toDouble( currentText(), &ok );
// Valid string representation
if ( ok )
{
// if a user types scale = 2345, we transform to 1:2345
if ( userSetScale && newScale >= 1.0 )
{
newScale = 1 / newScale;
}
setScale( newScale );
}
else
{
setScale( mScale );
}
}
示例14: setCurrentByDictionaryName
void DictionaryComboBox::setCurrentByDictionaryName( const QString & name )
{
if ( name.isEmpty() || name == currentText() )
return;
int idx = findText( name );
if ( idx == -1 ) {
kDebug() << "name not found" << name;
return;
}
setCurrentIndex( idx );
d->slotDictionaryChanged( idx );
}
示例15: currentItem
void OCompletionBox::down()
{
int i = currentItem();
if ( i == 0 && d->down_workaround ) {
d->down_workaround = false;
setCurrentItem( 0 );
setSelected( 0, true );
emit highlighted( currentText() );
}
else if ( i < (int) count() - 1 )
setCurrentItem( i + 1 );
}