本文整理汇总了C++中QVariant函数的典型用法代码示例。如果您正苦于以下问题:C++ QVariant函数的具体用法?C++ QVariant怎么用?C++ QVariant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QVariant函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVariant
/**
* Default constructor
*/
CRotationSensorSym::CRotationSensorSym(QSensor *sensor):CSensorBackendSym(sensor)
{
setReading<QRotationReading>(&iReading);
iBackendData.iSensorType = KSensrvChannelTypeIdRotationData;
sensor->setProperty("hasZ", QVariant(FALSE));
}
示例2: unblockContact
void MoodBoxServer::unblockContact(Callback callback, qint32 contactUserId)
{
unblockContact(callback, QVariant(), contactUserId);
}
示例3: advancedSearchContacts
void MoodBoxServer::advancedSearchContacts(Callback callback, qint32 pageNumber, qint32 recordsPerPage, QString value, QLocale::Country country, QString city, Sex::SexEnum sex, qint32 minAge, qint32 maxAge)
{
advancedSearchContacts(callback, QVariant(), pageNumber, recordsPerPage, value, country, city, sex, minAge, maxAge);
}
示例4: processAuthorizationRequest
void MoodBoxServer::processAuthorizationRequest(Callback callback, qint32 recipientId, QString authorizationMessage)
{
processAuthorizationRequest(callback, QVariant(), recipientId, authorizationMessage);
}
示例5: processAuthorizationResponse
void MoodBoxServer::processAuthorizationResponse(Callback callback, qint32 recipientId, bool isAccepted)
{
processAuthorizationResponse(callback, QVariant(), recipientId, isAccepted);
}
示例6: getContacts
void MoodBoxServer::getContacts(Callback callback)
{
getContacts(callback, QVariant());
}
示例7: getStatus
void MoodBoxServer::getStatus(Callback callback, qint32 userId)
{
getStatus(callback, QVariant(), userId);
}
示例8: getServerInfo
void MoodBoxServer::getServerInfo(Callback callback)
{
getServerInfo(callback, QVariant());
}
示例9: getCommands
void MoodBoxServer::getCommands(Callback callback, qint32 previousPackageId)
{
getCommands(callback, QVariant(), previousPackageId);
}
示例10: QDialog
OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
QDialog(parent),
ui(new Ui::OptionsDialog),
model(0),
mapper(0),
fProxyIpValid(true)
{
ui->setupUi(this);
GUIUtil::restoreWindowGeometry("nOptionsDialogWindow", this->size(), this);
/* Main elements init */
ui->databaseCache->setMinimum(nMinDbCache);
ui->databaseCache->setMaximum(nMaxDbCache);
ui->threadsScriptVerif->setMinimum(-(int)boost::thread::hardware_concurrency());
ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
/* Network elements init */
#ifndef USE_UPNP
ui->mapPortUpnp->setEnabled(false);
#endif
ui->proxyIp->setEnabled(false);
ui->proxyPort->setEnabled(false);
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
ui->proxyIp->installEventFilter(this);
/* Window elements init */
#ifdef Q_OS_MAC
/* remove Window tab on Mac */
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
#endif
/* remove Wallet tab in case of -disablewallet */
if (!enableWallet) {
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet));
}
/* Display elements init */
QDir translations(":translations");
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
foreach(const QString &langStr, translations.entryList())
{
QLocale locale(langStr);
/** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_"))
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
else
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language (locale name)", e.g. "German (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
}
#if QT_VERSION >= 0x040700
ui->thirdPartyTxUrls->setPlaceholderText("https://example.com/tx/%s");
#endif
ui->unit->setModel(new HivemindUnits(this));
/* Widget-to-option mapper */
mapper = new QDataWidgetMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setOrientation(Qt::Vertical);
/* setup/change UI elements when proxy IP is invalid/valid */
connect(this, SIGNAL(proxyIpChecks(QValidatedLineEdit *, int)), this, SLOT(doProxyIpChecks(QValidatedLineEdit *, int)));
}
示例11: QVariant
/**
* Read a char from the byte stream.
* @return a Character
*/
QVariant OSCByteArrayToMsgConverter::readChar()
{
return QVariant(iBytes->at(iStreamPosition++));
}
示例12: QVariant
QVariant ObjectSet::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
Node *node = static_cast<Node *>(index.internalPointer());
if (role == Qt::DisplayRole && index.column() == 0)
return node->displayString();
if (role == Qt::ForegroundRole && index.column() == 0)
{
ComponentType type;
if (node->type() == NT_COMPONENTS)
type = static_cast<Components *>(node)->cType();
else if (node->type() == NT_COMPONENT)
type = static_cast<Components *>(node->parent())->cType();
else
return QVariant();
return QBrush(QColor(modeMatch(_selectionMode, type) ? "black" : "silver"));
}
if (role == Qt::CheckStateRole && index.column() == 2)
{
switch (node->type())
{
case NT_FILE:
{
bool foundUnselected = false, foundSelected = false;
for (auto n : node->children())
{
DisplayObject *obj = static_cast<Patch *>(n)->obj();
foundUnselected |= !obj->fullSelection(_selectionMode);
foundSelected |= obj->hasSelection();
if (foundUnselected && foundSelected)
return Qt::PartiallyChecked;
}
return foundSelected ? Qt::Checked : Qt::Unchecked;
}
case NT_PATCH:
{
DisplayObject *obj = static_cast<Patch *>(node)->obj();
return QVariant(obj->fullSelection(_selectionMode) ? Qt::Checked :
(obj->hasSelection() ? Qt::PartiallyChecked : Qt::Unchecked));
}
case NT_COMPONENT:
if (modeMatch(_selectionMode, static_cast<Components *>(node->parent())->cType()))
return static_cast<Component *>(node)->isSelected() ? Qt::Checked : Qt::Unchecked;
return QVariant();
}
}
if (role == Qt::DecorationRole && index.column() == 1)
{
if (node->type() == NT_PATCH)
{
DisplayObject *obj = static_cast<Patch *>(node)->obj();
QString base = ":/icons/%1_%2.png";
switch (obj->type())
{
case OT_VOLUME: base = base.arg("volume"); break;
case OT_SURFACE: base = base.arg("surface"); break;
case OT_CURVE: base = base.arg("curve"); break;
}
base = base.arg(obj->isFullyVisible(false) ? "full" :
(obj->isInvisible(false) ? "hidden" : "partial"));
return QIcon(base);
}
else if (node->type() == NT_FILE)
{
bool allInvisible = true, allVisible = true;
for (auto n : node->children())
{
DisplayObject *obj = static_cast<Patch *>(n)->obj();
allInvisible &= obj->isInvisible(false);
allVisible &= obj->isFullyVisible(false);
if (!allInvisible && !allVisible)
return QIcon(":/icons/file_partial.png");
}
return QIcon(allVisible ? ":/icons/file_full.png" : ":/icons/file_hidden.png");
}
}
return QVariant();
}
示例13: CCoinControlWidgetItem
void CoinControlDialog::updateView()
{
if (!model || !model->getOptionsModel() || !model->getAddressTableModel())
return;
bool treeMode = ui->radioTreeMode->isChecked();
ui->treeWidget->clear();
ui->treeWidget->setEnabled(false); // performance, otherwise updateLabels would be called for every checked checkbox
ui->treeWidget->setAlternatingRowColors(!treeMode);
QFlags<Qt::ItemFlag> flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
std::map<QString, std::vector<COutput> > mapCoins;
model->listCoins(mapCoins);
for (const std::pair<QString, std::vector<COutput>>& coins : mapCoins) {
CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem();
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
QString sWalletAddress = coins.first;
QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
if (sWalletLabel.isEmpty())
sWalletLabel = tr("(no label)");
if (treeMode)
{
// wallet address
ui->treeWidget->addTopLevelItem(itemWalletAddress);
itemWalletAddress->setFlags(flgTristate);
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
// label
itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel);
// address
itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress);
}
CAmount nSum = 0;
int nChildren = 0;
for (const COutput& out : coins.second) {
nSum += out.tx->tx->vout[out.i].nValue;
nChildren++;
CCoinControlWidgetItem *itemOutput;
if (treeMode) itemOutput = new CCoinControlWidgetItem(itemWalletAddress);
else itemOutput = new CCoinControlWidgetItem(ui->treeWidget);
itemOutput->setFlags(flgCheckbox);
itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
// address
CTxDestination outputAddress;
QString sAddress = "";
if(ExtractDestination(out.tx->tx->vout[out.i].scriptPubKey, outputAddress))
{
sAddress = QString::fromStdString(EncodeDestination(outputAddress));
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
if (!treeMode || (!(sAddress == sWalletAddress)))
itemOutput->setText(COLUMN_ADDRESS, sAddress);
}
// label
if (!(sAddress == sWalletAddress)) // change
{
// tooltip from where the change comes from
itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress));
itemOutput->setText(COLUMN_LABEL, tr("(change)"));
}
else if (!treeMode)
{
QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
if (sLabel.isEmpty())
sLabel = tr("(no label)");
itemOutput->setText(COLUMN_LABEL, sLabel);
}
// amount
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->tx->vout[out.i].nValue));
itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.tx->tx->vout[out.i].nValue)); // padding so that sorting works correctly
// date
itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
itemOutput->setData(COLUMN_DATE, Qt::UserRole, QVariant((qlonglong)out.tx->GetTxTime()));
// confirmations
itemOutput->setText(COLUMN_CONFIRMATIONS, QString::number(out.nDepth));
itemOutput->setData(COLUMN_CONFIRMATIONS, Qt::UserRole, QVariant((qlonglong)out.nDepth));
// transaction hash
uint256 txhash = out.tx->GetHash();
itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
// vout index
itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));
// disable locked coins
//.........这里部分代码省略.........
示例14: switch
QVariant ServerItem::data(int column, int role) const {
if (bParent) {
if (column == 0) {
switch (role) {
case Qt::DisplayRole:
return qsName;
case Qt::DecorationRole:
if (itType == FavoriteType)
return loadIcon(QLatin1String("skin:emblems/emblem-favorite.svg"));
else if (itType == LANType)
return loadIcon(QLatin1String("skin:places/network-workgroup.svg"));
else if (! qsCountryCode.isEmpty())
return loadIcon(QString::fromLatin1(":/flags/%1.png").arg(qsCountryCode));
else
return loadIcon(QLatin1String("skin:categories/applications-internet.svg"));
}
}
} else {
if (role == Qt::DisplayRole) {
switch (column) {
case 0:
return qsName;
case 1:
return (dPing > 0.0) ? QString::number(uiPing) : QVariant();
case 2:
return uiUsers ? QString::fromLatin1("%1/%2").arg(uiUsers).arg(uiMaxUsers) : QVariant();
}
} else if (role == Qt::ToolTipRole) {
QStringList qsl;
foreach(const QHostAddress &qha, qlAddresses)
qsl << Qt::escape(qha.toString());
double ploss = 100.0;
if (uiSent > 0)
ploss = (uiSent - qMin(uiRecv, uiSent)) * 100. / uiSent;
QString qs;
qs +=
QLatin1String("<table>") +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Servername"), Qt::escape(qsName)) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Hostname"), Qt::escape(qsHostname));
if (! qsBonjourHost.isEmpty())
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Bonjour name"), Qt::escape(qsBonjourHost));
qs +=
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Port")).arg(usPort) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Addresses"), qsl.join(QLatin1String(", ")));
if (! qsUrl.isEmpty())
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Website"), Qt::escape(qsUrl));
if (uiSent > 0) {
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Packet loss"), QString::fromLatin1("%1% (%2/%3)").arg(ploss, 0, 'f', 1).arg(uiRecv).arg(uiSent));
if (uiRecv > 0) {
qs +=
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Ping (80%)"), ConnectDialog::tr("%1 ms").
arg(boost::accumulators::extended_p_square(* asQuantile)[1] / 1000., 0, 'f', 2)) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Ping (95%)"), ConnectDialog::tr("%1 ms").
arg(boost::accumulators::extended_p_square(* asQuantile)[2] / 1000., 0, 'f', 2)) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Bandwidth"), ConnectDialog::tr("%1 kbit/s").arg(uiBandwidth / 1000)) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Users"), QString::fromLatin1("%1/%2").arg(uiUsers).arg(uiMaxUsers)) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Version")).arg(MumbleVersion::toString(uiVersion));
}
}
qs += QLatin1String("</table>");
return qs;
} else if (role == Qt::BackgroundRole) {
示例15: updatePassword
void MoodBoxServer::updatePassword(Callback callback, QString newPassword, QString oldPassword)
{
updatePassword(callback, QVariant(), newPassword, oldPassword);
}