本文整理汇总了C++中QVariant::toUInt方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariant::toUInt方法的具体用法?C++ QVariant::toUInt怎么用?C++ QVariant::toUInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariant
的用法示例。
在下文中一共展示了QVariant::toUInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: impliedValue
QVariant IntervalRange::impliedValue(const QVariant& v) const
{
bool ok;
quint32 index = v.toUInt(&ok);
if (!ok){
ERROR2(ERR_COULD_NOT_CONVERT_2,v.toString(), "raw value");
return sUNDEF;
}
if ( index < _items.size())
return _items[index]->name();
return sUNDEF;
}
示例2: compareValues
bool AWSSettingsRecord_Impl::compareValues(const QSqlQuery& query) const {
OS_ASSERT(query.isValid());
OS_ASSERT(query.isActive());
OS_ASSERT(query.isSelect());
bool result = CloudSettingsRecord_Impl::compareValues(query);
QVariant value;
value = query.value(AWSSettingsRecord::ColumnsType::userAgreementSigned);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_userAgreementSigned == value.toBool());
value = query.value(AWSSettingsRecord::ColumnsType::numWorkers);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_numWorkers == value.toUInt());
value = query.value(AWSSettingsRecord::ColumnsType::terminationDelayEnabled);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_terminationDelayEnabled == value.toBool());
value = query.value(AWSSettingsRecord::ColumnsType::terminationDelay);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_terminationDelay == value.toUInt());
value = query.value(AWSSettingsRecord::ColumnsType::region);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_region == value.toString().toStdString());
value = query.value(AWSSettingsRecord::ColumnsType::serverInstanceType);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_serverInstanceType == value.toString().toStdString());
value = query.value(AWSSettingsRecord::ColumnsType::workerInstanceType);
OS_ASSERT(value.isValid() && !value.isNull());
result = result && (m_workerInstanceType == value.toString().toStdString());
return result;
}
示例3: itemFunctionId
quint32 FunctionsTreeWidget::itemFunctionId(const QTreeWidgetItem* item) const
{
if (item == NULL || item->parent() == NULL)
return Function::invalidId();
else
{
QVariant var = item->data(COL_NAME, Qt::UserRole);
if (var.isValid() == false)
return Function::invalidId();
return var.toUInt();
}
}
示例4: setData
bool TrackerModel::setData(const QModelIndex & index,const QVariant & value,int role)
{
if (!tc || !index.isValid() || index.row() < 0 || index.row() >= trackers.count())
return false;
if (role == Qt::CheckStateRole)
{
KUrl url = trackers.at(index.row());
tc->getTrackersList()->setTrackerEnabled(url,(Qt::CheckState)value.toUInt() == Qt::Checked);
return true;
}
return false;
}
示例5: operationShift
//-----------------------------------------------------------------------------
void SetupTabMatrix::operationShift()
{
QAction *a = qobject_cast<QAction *>(sender());
QVariant var = a->data();
bool ok;
quint32 index = var.toUInt(&ok);
if (ok)
{
bool leftShift = ((index & 0x80000000) != 0);
index &= 0x7fffffff;
quint32 mask;
int shift;
bool left;
this->mPreset->matrix()->operation(index, &mask, &shift, &left);
if (leftShift)
{
if (shift > 0)
{
if (left)
shift++;
else
shift--;
}
else
{
shift = 1;
left = true;
}
}
else
{
if (shift > 0)
{
if (left)
shift--;
else
shift++;
}
else
{
shift = 1;
left = false;
}
}
this->mPreset->matrix()->operationReplace(index, mask, shift, left);
}
}
示例6: CreateValue
QScriptValue CreateValue(const QVariant& value, QScriptEngine& engine)
{
if(value.type() == QVariant::Map)
{
QScriptValue obj = engine.newObject();
QVariantMap map = value.toMap();
QVariantMap::const_iterator it = map.begin();
QVariantMap::const_iterator end = map.end();
while(it != end)
{
obj.setProperty( it.key(), ::CreateValue(it.value(), engine) );
++it;
}
return obj;
}
if(value.type() == QVariant::List)
{
QVariantList list = value.toList();
QScriptValue array = engine.newArray(list.length());
for(int i=0; i<list.count(); i++)
array.setProperty(i, ::CreateValue(list.at(i),engine));
return array;
}
switch(value.type())
{
case QVariant::String:
return QScriptValue(value.toString());
case QVariant::Int:
return QScriptValue(value.toInt());
case QVariant::UInt:
return QScriptValue(value.toUInt());
case QVariant::Bool:
return QScriptValue(value.toBool());
case QVariant::ByteArray:
return QScriptValue(QLatin1String(value.toByteArray()));
case QVariant::Double:
return QScriptValue((qsreal)value.toDouble());
default:
break;
}
if(value.isNull())
return QScriptValue(QScriptValue::NullValue);
return engine.newVariant(value);
}
示例7: insert
bool FileHelper::insert(Field key, const QVariant &value)
{
// Standard tags
TagLib::String v = value.toString().toStdString();
switch (key) {
case Field_Album:
_file->tag()->setAlbum(v);
break;
case Field_Artist:
_file->tag()->setArtist(v);
break;
case Field_Comment:
_file->tag()->setComment(v);
break;
case Field_Genre:
_file->tag()->setGenre(v);
break;
case Field_Title:
_file->tag()->setTitle(v);
break;
case Field_Track:
_file->tag()->setTrack(value.toUInt());
break;
case Field_Year:
_file->tag()->setYear(value.toUInt());
break;
case Field_ArtistAlbum:
this->setArtistAlbum(value.toString());
break;
case Field_Disc:
this->setDiscNumber(value.toString());
break;
default:
return false;
}
return true;
}
示例8: resetPartialSettings
void ConfigTreeObject_Math::resetPartialSettings()
{
ConfigObject* pObj = ConfigTreeObject::getConfigObject(DISP_DELEGATE_TREND_PARTIAL_SWITCH);
if(pObj) {
QVariant valueSwitch = pObj->getData();
if(valueSwitch.toUInt() == 1) {
ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART)->setHideFlag(false);
ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_ONOFF)->setHideFlag(false);
ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_ONOFF)->changeData(0, false, false);
ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_BOUND)->setHideFlag(true);
ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_EXPAND)->setHideFlag(true);
}
}
}
示例9: tabMoved
void MainWindow::tabMoved(int, int)
{
QList<quint32> values;
for (int i = 0; i < this->mdiAreaTabBar->count(); i++)
{
QVariant data = this->mdiAreaTabBar->tabData(i);
if (!data.isNull())
values << data.toUInt();
}
SETTINGS.set("windowOrder", values);
SETTINGS.save();
}
示例10: addrinfo
uint IcdPrivate::addrinfo(QString& service_type, uint service_attrs,
QString& service_id, QString& network_type,
uint network_attrs, QByteArray& network_id,
IcdAddressInfoResult& addr_result)
{
QTimer timer;
QVariant reply;
uint total_signals;
QVariantList vl;
clearState();
reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ,
service_type, service_attrs, service_id,
network_type, network_attrs, network_id);
if (reply.type() != QVariant::List)
return 0;
vl = reply.toList();
if (vl.isEmpty())
return 0;
reply = vl.first();
total_signals = reply.toUInt();
if (!total_signals)
return 0;
timer.setSingleShot(true);
timer.start(timeout);
mInterface.clear();
while (timer.isActive() && mInterface.isEmpty()) {
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) {
mInterface.clear();
continue;
}
}
timer.stop();
if (mError.isEmpty()) {
get_addrinfo_all_result(mArgs, addr_result);
} else {
qWarning() << "Error:" << mError;
}
// The returned value should be one because we asked for one addrinfo
return total_signals;
}
示例11: QObject
MasterTimer::MasterTimer(Doc* doc)
: QObject(doc)
, m_stopAllFunctions(false)
, m_fader(new GenericFader(doc))
, d_ptr(new MasterTimerPrivate(this))
{
Q_ASSERT(doc != NULL);
Q_ASSERT(d_ptr != NULL);
QSettings settings;
QVariant var = settings.value(MASTERTIMER_FREQUENCY);
if (var.isValid() == true)
s_frequency = var.toUInt();
}
示例12: setData
bool CheckboxList::setData (const QModelIndex &index, const QVariant &value, int role)
{
if (index.row() < 0 || index.row() >= rowCount())
return false;
if(role == Qt::EditRole || role == Qt::DisplayRole)
stringList().replace(index.row(), value.toString());
if(role == Qt::CheckStateRole)
checkedStatus[index.row()] = static_cast<Qt::CheckState>(value.toUInt());
emit dataChanged(index, index);
return true;
}
示例13: insertNotEmpty
void Asterisk::insertNotEmpty(QVariantHash *headers, QString key, QVariant value)
{
bool isEmpty = false;
switch (value.type()) {
case QMetaType::UInt: isEmpty = value.toUInt() == 0;
break;
default: isEmpty = value.isNull();
break;
}
if (!isEmpty)
headers->insert(key, value);
}
示例14: set
void itemList::set(ParameterList &pParams)
{
QVariant param;
bool valid;
param = pParams.value("item_id", &valid);
if (valid)
_itemid = param.toInt();
else
_itemid = -1;
param = pParams.value("sql", &valid);
if (valid)
{
_sql = param.toString();
_useQuery = TRUE;
}
else
_useQuery = FALSE;
param = pParams.value("itemType", &valid);
if (valid)
{
_itemType = param.toUInt();
setWindowTitle(buildItemLineEditTitle(_itemType, tr("Items")));
_showMake->setChecked(_itemType & ItemLineEdit::cGeneralManufactured);
_showBuy->setChecked(_itemType & ItemLineEdit::cGeneralPurchased);
}
else
{
_itemType = ItemLineEdit::cUndefined;
_showMake->hide();
_showBuy->hide();
}
param = pParams.value("extraClauses", &valid);
if (valid)
_extraClauses = param.toStringList();
_showInactive->setChecked(FALSE);
_showInactive->setEnabled(!(_itemType & ItemLineEdit::cActive));
if(!_showInactive->isEnabled())
_showInactive->hide();
param = pParams.value("caption", &valid);
if (valid)
setWindowTitle(param.toString());
sFillList();
}
示例15: setData
bool ParameterModel::setData(const QModelIndex & index,
const QVariant& value, int role)
{
if (!index.isValid() || !m_root)
return false;
DescriptorNode * node =
static_cast< DescriptorNode * >(index.internalPointer());
if (role == Qt::CheckStateRole && node && isCheckable(node->descriptor))
{
QList< int > path;
node->check_for_initialized();
const DescriptorNode * cnode = node;
// Calculate path
while(cnode && cnode->parent)
{
path.push_front(cnode->index);
cnode = cnode->parent;
}
Qt::CheckState state =
static_cast<Qt::CheckState>(value.toUInt());
bool check = (state == Qt::Checked)? true: false;
bool old = node->checked;
if (check != old)
{
node->checked = check;
emit dataChanged(index, index);
if (check)
{
emit checked(m_root->descriptor, path);
}
else
{
emit unchecked(m_root->descriptor, path);
}
}
return true;
}
return false;
}