当前位置: 首页>>代码示例>>C++>>正文


C++ QChar::toAscii方法代码示例

本文整理汇总了C++中QChar::toAscii方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::toAscii方法的具体用法?C++ QChar::toAscii怎么用?C++ QChar::toAscii使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QChar的用法示例。


在下文中一共展示了QChar::toAscii方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testTypingValue

void testTypingValue(
    SpinBoxType* sbox, QPushButton *okButton, const QString &value)
{
    sbox->selectAll();
    for (int i = 0; i < value.size(); ++i) {
        const QChar valChar = value[i];
	_keyClick(static_cast<QWidget *>(sbox), valChar.toAscii()); // ### always guaranteed to work?
        if (sbox->hasAcceptableInput())
            QVERIFY(okButton->isEnabled());
        else
            QVERIFY(!okButton->isEnabled());
    }
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:13,代码来源:tst_qinputdialog.cpp

示例2: isQuoteMeta

inline static bool isQuoteMeta( QChar cUnicode )
{
#if 0 // it's not worth it, especially after seeing gcc's asm output ...
    static const uchar iqm[] = {
        0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00
    }; // \'"$

    return (c < sizeof(iqm) * 8) && (iqm[c / 8] & (1 << (c & 7)));
#else
    char c = cUnicode.toAscii();
    return c == '\\' || c == '\'' || c == '"' || c == '$';
#endif
}
开发者ID:vasi,项目名称:kdelibs,代码行数:14,代码来源:kshell_unix.cpp

示例3: modifyReference

void EnhancedPathShape::modifyReference(const QString &reference, qreal value)
{
    if (reference.isEmpty())
        return;

    QChar c = reference[0];

    if (c.toAscii() == '$') {
        bool success = false;
        int modifierIndex = reference.mid(1).toInt(&success);
        if (modifierIndex >= 0 && modifierIndex < m_modifiers.count())
            m_modifiers[modifierIndex] = value;
    }
}
开发者ID:KDE,项目名称:koffice,代码行数:14,代码来源:EnhancedPathShape.cpp

示例4: sendMessage

void OmaSaunalahti::sendMessage(QNetworkAccessManager* manager, QString message) {
    if (message.toAscii().length()==0)
        return;
    this->loggedIn = false;
    connect(manager, SIGNAL(finished(QNetworkReply*)), SLOT(replyFinished(QNetworkReply*)));

    this->message = message;
    this->messageTime = QString("%0 %1").arg(QDate::currentDate().toString("dd.MM.yyyy")).arg(QTime::currentTime().toString("hh:mm:ss.zzz"));
    QChar *messageChar = this->message.data();
    while (!messageChar->isNull()) {
        if (messageChar->isSpace()) {
               QString chr = QString("%0").arg(QString::number( messageChar->toAscii(), 16 ).toUpper());
               if (chr.length()==1)
                   chr = "%0" + chr;
               this->message = this->message.replace(messageChar->toAscii(),chr);
         }
        ++messageChar;
    }
    QUrl url = QUrl(this->server);
    url.addQueryItem("username",this->username);
    url.addQueryItem("login","Sisään");
    url.addQueryItem("password",this->password);

    QNetworkRequest request;
    request.setUrl(url);
    QNetworkReply *reply = manager->post(request,url.toString().split("?")[1].toAscii());

    url.setEncodedQuery(QByteArray());
    url.addQueryItem("sender",this->sender);
    url.addQueryItem("recipients",this->receiver);
    url.addQueryItem("text",this->message);
    url.addQueryItem("size",QString("%0").arg(this->message.toAscii().length()));
    url.addQueryItem("send","Lähetä");
    connect(manager, SIGNAL(finished(QNetworkReply*)), SLOT(messageSent(QNetworkReply*)));
    reply = manager->post(request,url.toString().split("?")[1].toAscii());
}
开发者ID:Jeff-Lewis,项目名称:quickanddirty,代码行数:36,代码来源:omasaunalahti.cpp

示例5: loadSettings

void Settings::loadSettings(const QString & fileName, QByteArray * windowGeometry, QByteArray * windowState)
{
	QString path = fileName;
	if(fileName.isEmpty())
	{
		path = iniDefaultPath();
	}
	QSettings ini(path, QSettings::IniFormat);
	for(ParametersMap::const_iterator iter = defaultParameters_.begin(); iter!=defaultParameters_.end(); ++iter)
	{
		const QString & key = iter.key();
		QVariant value = ini.value(key, QVariant());
		if(value.isValid())
		{
			QString str = value.toString();
			if(str.contains(";") && str.size() != getParameter(key).toString().size())
			{
				// If a string list is modified, update the value
				// (assuming that index < 10... one character for index)
				QChar index = str.at(0);
				str = getParameter(key).toString();
				str[0] = index.toAscii();
				value = QVariant(str);
				printf("Updated list of parameter \"%s\"\n", key.toStdString().c_str());
			}
			setParameter(key, value);
		}
	}

	if(windowGeometry)
	{
		QVariant value = ini.value("windowGeometry", QVariant());
		if(value.isValid())
		{
			*windowGeometry = value.toByteArray();
		}
	}
	if(windowState)
	{
		QVariant value = ini.value("windowState", QVariant());
		if(value.isValid())
		{
			*windowState = value.toByteArray();
		}
	}

	printf("Settings loaded from %s\n", path.toStdString().c_str());
}
开发者ID:moonwalkeryj,项目名称:GPKeypointsObjectDeteciton,代码行数:48,代码来源:Settings.cpp

示例6: ParseTokken

QString ParseTokken(QTextStream &in) {
    static QChar last;
    QChar c;
    QString sum;
    in >> c;
    switch (c.toAscii()) {
    case '(':
    case ';':
    case ')':
    case '[':
    case ']':
    case '\\':
        return c;
    }
    return "";
}
开发者ID:palawijaGit,项目名称:kockandur,代码行数:16,代码来源:parser_main.cpp

示例7: RegistHotkey

bool Settings::RegistHotkey(QWidget *window,
		QChar keyValue,
		Qt::KeyboardModifiers keyMod)
{
#if WIN32
	WId w_handle = window ? window->winId(): 0;
		int modifiy = QtModToWinMod(keyMod);
		return RegisterHotKey(w_handle, hotkey_id, modifiy, VkKeyScan
				(keyValue.toAscii()));
#else //liunx or mac os are not implement...
		Q_UNUSED(window);
		Q_UNUSED(keyValue);
		Q_UNUSED(keyMod);
		return false;
#endif
		
}
开发者ID:jun-zhang,项目名称:libfetion-gui,代码行数:17,代码来源:fxsettings.cpp

示例8: encodeUnicode

 QString encodeUnicode(const QString & unicode)
 {
     QString encoded;
     for (int i = 0; i < unicode.length(); ++i)
     {
         QChar ch = unicode[i];
         if (ch == ch.toAscii())
         {
             encoded += ch;
         }
         else
         {
             encoded += "\\u" + QString("%1").arg((ushort) ch.unicode(), (int) 4, (int) 16, QChar('0')).toUpper();
         }
     }
     return encoded;
 }
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:17,代码来源:utopia_serializer.cpp

示例9: mountNetwork

bool EPath::mountNetwork(QChar drive) {
	// Mount network drive
	QProcess net_use;
	LAPP_ << "Mounting network path to " << drive.toAscii();
	QString mount_command = QString("net use %1: \"%2\"").arg(drive).arg(m_path);
	LDEBUG_ << "Executing: " << QSTR(mount_command);
	net_use.start(mount_command);
	net_use.waitForFinished();
	if (net_use.exitCode() != 0)
		return false;

	m_remote_path_mounted = true;

	m_usable_drive = drive;

	return true;
}
开发者ID:Jellofishi,项目名称:Desktop,代码行数:17,代码来源:epath.cpp

示例10: loadSettings

void Settings::loadSettings(const QString & fileName)
{
	QString path = fileName;
	if(fileName.isEmpty())
	{
		path = iniPath();
	}
	if(!path.isEmpty())
	{
		QSettings ini(path, QSettings::IniFormat);
		for(ParametersMap::const_iterator iter = defaultParameters_.begin(); iter!=defaultParameters_.end(); ++iter)
		{
			const QString & key = iter.key();
			QVariant value = ini.value(key, QVariant());
			if(value.isValid())
			{
				QString str = value.toString();
				if(str.contains(";") && str.size() != getParameter(key).toString().size())
				{
					// If a string list is modified, update the value
					// (assuming that index < 10... one character for index)
					QChar index = str.at(0);
					str = getParameter(key).toString();
					str[0] = index.toAscii();
					value = QVariant(str);
					UINFO("Updated list of parameter \"%s\"", key.toStdString().c_str());
				}
				setParameter(key, value);
			}
		}
		UINFO("Settings loaded from %s.", path.toStdString().c_str());
	}
	else
	{
		parameters_ = defaultParameters_;
		UINFO("Settings set to defaults.");
	}

	if(cv::gpu::getCudaEnabledDeviceCount() == 0)
	{
		Settings::setFeature2D_SURF_gpu(false);
		Settings::setFeature2D_Fast_gpu(false);
		Settings::setFeature2D_ORB_gpu(false);
	}
}
开发者ID:r-ashraf-zein,项目名称:find-object,代码行数:45,代码来源:Settings.cpp

示例11: isVowell

bool isVowell(QChar v){
    if ( v > 'A' || v < 'z')
        return false;
    v = v.toLower();
    switch (v.toAscii())
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        case 'y':
            return true;
        default:
            break;
    }
    return false;
}
开发者ID:joesolbrig,项目名称:OneLine-,代码行数:18,代码来源:catalog.cpp

示例12: characters

bool XLIFFHandler::characters(const QString &ch)
{
    if (currentContext() == XC_ph) {
        // handle the content of <ph> elements
        for (int i = 0; i < ch.count(); ++i) {
            QChar chr = ch.at(i);
            if (accum.endsWith(QLatin1Char('\\')))
                accum[accum.size() - 1] = QLatin1Char(charFromEscape(chr.toAscii()));
            else
                accum.append(chr);
        }
    } else {
        QString t = ch;
        t.replace(QLatin1String("\r"), QLatin1String(""));
        accum.append(t);
    }
    return true;
}
开发者ID:wpbest,项目名称:copperspice,代码行数:18,代码来源:xliff.cpp

示例13: sanitize

QString TextUtils::sanitize(QString const& original)
{
    QString result;

    for (int i = 0; i < original.length(); i++)
    {
        QChar c = original.at(i);
        uchar_t mychar = c.toAscii();
        bool valid = sfn_chars[mychar/8] & ( 1 << (mychar % 8) );

        if (valid) {
            result.append(c);
        } else {
            result.append("_");
        }
    }

    return result;
}
开发者ID:canadainc,项目名称:canadainclib,代码行数:19,代码来源:TextUtils.cpp

示例14: keyPressEvent

void Loader::keyPressEvent(QKeyEvent* e)
{
    int key = e->key();
    if(this->running == false)
        return;

    if(this->disableIO)
        return;

    if(e->matches((QKeySequence::Copy))) {
        copy();
        return;
    }
    if(e->matches((QKeySequence::Paste))) {
        QClipboard *clip = QApplication::clipboard();
        QString command = clip->text();
        this->insertPlainText(command);
        QByteArray barry(command.toAscii());
        process->write(barry);
        return;
    }

    switch(key)
    {
        case Qt::Key_Enter:
        case Qt::Key_Return:
            key = '\n';
            break;
        case Qt::Key_Backspace:
            key = '\b';
            break;
        default:
            if(key & Qt::Key_Escape)
                return;
            QChar c = e->text().at(0);
            key = (int)c.toAscii();
            break;
    }
    QByteArray barry;
    barry.append((char)key);
    process->write(barry);
}
开发者ID:jmbp77umkc,项目名称:propside,代码行数:42,代码来源:loader.cpp

示例15: computeFormula

QVariant Cell::computeFormula(const QString &formula, SpreadSheet *widget) const
{
    QVariant result = QVariant::Invalid,
             firstOperand = QVariant::Invalid,
             secondOperand = QVariant::Invalid;
    QString aux = formula;
    int firstOp = firstOperatorPosition(aux);
    if (firstOp == -1)
        result = parseMember(aux, widget);
    while (firstOp != -1)
    {
        if (result == QVariant::Invalid)
            firstOperand = parseMember(aux.left(firstOp), widget);
        else
            firstOperand = result;
        QChar firstOperator = aux[firstOp];
        aux = aux.mid(firstOp+1);
        firstOp = firstOperatorPosition(aux);
        if (firstOp == -1)
            secondOperand = parseMember(aux, widget);
        else
            secondOperand = parseMember(aux.left(firstOp), widget);

        switch (firstOperator.toAscii())
        {
            case '+':
                result = firstOperand.toDouble() + secondOperand.toDouble();
                break;
            case '-':
                result = firstOperand.toDouble() - secondOperand.toDouble();
                break;
            case '*':
                result = firstOperand.toDouble() * secondOperand.toDouble();
                break;
            case '/':
                result = firstOperand.toDouble() / secondOperand.toDouble();
                break;
        }
    }
    return result;
}
开发者ID:bogdanAco,项目名称:Student-Evaluation-Manager,代码行数:41,代码来源:Cell.cpp


注:本文中的QChar::toAscii方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。