本文整理汇总了C++中QChar::toLower方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::toLower方法的具体用法?C++ QChar::toLower怎么用?C++ QChar::toLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChar
的用法示例。
在下文中一共展示了QChar::toLower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: searchTargetFromScreen
void searchTargetFromScreen(QEditor *editor, const QChar &target)
{
m_targetPos.clear();
if (editor == NULL) {
return;
}
m_currentGroup = 0;
m_targetChar = target;
QTextDocument *doc = editor->document();
int cursorPos = editor->textCursor().position();
QPair<int, int> visibleRange = getFirstAndLastVisiblePosition(editor);
int firstPos = visibleRange.first;
int lastPos = visibleRange.second;
bool notCaseSensative = target.category() != QChar::Letter_Uppercase;
for (int offset = 1; cursorPos - offset >= firstPos || cursorPos + offset <= lastPos; offset++) {
if (cursorPos + offset <= lastPos) {
QChar c = doc->characterAt(cursorPos + offset);
if (notCaseSensative) {
c = c.toLower();
}
if (c == target) {
m_targetPos << (cursorPos + offset);
}
}
if (cursorPos - offset >= firstPos) {
QChar c = doc->characterAt(cursorPos - offset);
if (notCaseSensative) {
c = c.toLower();
}
if (c == target) {
m_targetPos << (cursorPos - offset);
}
}
}
}
示例2: strcasecmp
bool DOM::strcasecmp(const DOMStringImpl* a, const DOMStringImpl* b)
{
if (!(a && b))
return (a && a->l) || (b && b->l);
if (a->l != b->l)
return true;
QChar* ai = a->s;
QChar* bi = b->s;
int l = a->l;
while (l--) {
if (*ai != *bi && ai->toLower() != bi->toLower())
return true;
++ai, ++bi;
}
return false;
}
示例3: processKeyEvents
void QOpenKODEWindow::processKeyEvents(const KDEvent *event)
{
#ifdef KD_ATX_keyboard
//KD_KEY_PRESS_ATX 1
QEvent::Type keyPressed = QEvent::KeyRelease;
if (event->data.keyboardInputKey.flags)
keyPressed = QEvent::KeyPress;
//KD_KEY_LOCATION_LEFT_ATX // don't care for now
//KD_KEY_LOCATION_RIGHT_ATX
//KD_KEY_LOCATION_NUMPAD_ATX
Qt::KeyboardModifiers mod = Qt::NoModifier;
int openkodeMods = event->data.keyboardInputKey.flags;
if (openkodeMods & KD_KEY_MODIFIER_SHIFT_ATX)
mod |= Qt::ShiftModifier;
if (openkodeMods & KD_KEY_MODIFIER_CTRL_ATX)
mod |= Qt::ControlModifier;
if (openkodeMods & KD_KEY_MODIFIER_ALT_ATX)
mod |= Qt::AltModifier;
if (openkodeMods & KD_KEY_MODIFIER_META_ATX)
mod |= Qt::MetaModifier;
Qt::Key qtKey;
QChar keyText;
int key = event->data.keyboardInputKey.keycode;
if (key >= 0x20 && key <= 0x0ff){ // 8 bit printable Latin1
qtKey = Qt::Key(key);
keyText = QChar(event->data.keyboardInputKeyChar.character);
if (!(mod & Qt::ShiftModifier))
keyText = keyText.toLower();
} else {
qtKey = keyTranslator(key);
}
QWindowSystemInterface::handleKeyEvent(0,event->timestamp,keyPressed,qtKey,mod,keyText);
#endif
}
示例4: initTable
bool CChinesePinyinTable::initTable()
{
bool value_ret = false;
int num_records = sizeof(p2h)/sizeof(p2h[0]);
int i=0;
if(!openDatabase())
{
value_ret = DataBaseNotOpen;
}
else
{
QSqlQuery query(db);
QString strSqlDelete = "delete * from "+ m_TableName;
query.exec(strSqlDelete);
for(i=0;i<num_records;i++)
{
pyhz_tab tempRecord = p2h[i];
QChar firstAlphabet = tempRecord.py.at(0);
QChar lowFirstAlphabet = firstAlphabet.toLower();
tempRecord.py.replace(0,1,lowFirstAlphabet);
QString strSQL = "insert into " + m_TableName + " (pinyin,pinyin_shengdiao,shengdiao,ChineseCharactor,First_Alphabet) values (\'"
+ tempRecord.py + "\',\'"
+ tempRecord.py_shengdiao + "\',"
+ QString::number(tempRecord.shengdiao) + ",\'"
+ tempRecord.hz + "\',\'"
+ lowFirstAlphabet + "\')";
/*QString strSQL = "insert into " + m_TableName + " (pinyin,pinyin_shengdiao) values (\'"
+ tempRecord.py + "\',\'"
+ tempRecord.py_shengdiao + "\')";*/
// strSQL = "select * from " + m_TableName;
//qDebug()<<strSQL;
if(query.exec(strSQL))
{
value_ret = true;
}
else
{
value_ret = false;
}
}
}
return value_ret;
}
示例5: sendKeyEvent
void SysmgrIMEModel::sendKeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers)
{
QWidget* focusedWidget = QApplication::focusWidget();
if (focusedWidget && (type == QEvent::KeyPress || type == QEvent::KeyRelease)) {
QChar qchar;
switch(key) {
case Qt::Key_Return:
case Qt::Key_Enter:
qchar = '\r';
break;
case Qt::Key_Tab:
qchar = '\t';
break;
case Qt::Key_Backspace:
qchar = '\b';
break;
default:
qchar = QChar(key);
}
// only lower case A to Z. Other keys are unicode characters with proper casing already...
if (key >= Qt::Key_A && key <= Qt::Key_Z && !(modifiers & Qt::ShiftModifier))
qchar = qchar.toLower();
QApplication::postEvent(focusedWidget, new QKeyEvent(type, key, modifiers, qchar));
}
}
示例6: createSetNFA
NFA RE2NFA::parseSet()
{
QSet<InputType> set;
bool negate = false;
next(TOK_STRING);
do {
Q_ASSERT(symbol().lexem.length() == 1);
// ###
QChar ch = symbol().lexem.at(0);
if (set.isEmpty() && ch == QLatin1Char('^')) {
negate = true;
continue;
}
// look ahead for ranges like a-z
bool rangeFound = false;
if (test(TOK_STRING)) {
if (symbol().lexem.length() == 1
&& symbol().lexem.at(0) == QLatin1Char('-')) {
next(TOK_STRING);
Q_ASSERT(symbol().lexem.length() == 1);
QChar last = symbol().lexem.at(0);
if (ch.unicode() > last.unicode())
qSwap(ch, last);
for (ushort i = ch.unicode(); i <= last.unicode(); ++i) {
if (caseSensitivity == Qt::CaseInsensitive) {
set.insert(QChar(i).toLower().unicode());
} else {
set.insert(i);
}
}
rangeFound = true;
} else {
prev();
}
}
if (!rangeFound) {
if (caseSensitivity == Qt::CaseInsensitive) {
set.insert(ch.toLower().unicode());
} else {
set.insert(ch.unicode());
}
}
} while (test(TOK_STRING));
if (negate) {
QSet<InputType> negatedSet = maxInputSet;
negatedSet.subtract(set);
set = negatedSet;
}
return NFA::createSetNFA(set);
}
示例7: expect
void LineParser::expect(const QChar &c, Qt::CaseSensitivity cs)
{
if (_i < _line.length())
{
QChar lhs = c;
QChar rhs = _line.at(_i);
if (cs == Qt::CaseInsensitive)
{
lhs = lhs.toLower();
rhs = rhs.toLower();
}
if (lhs == rhs) {
_i++;
return;
}
}
throw SegmentParseExpectedException(_line.atAsSegment(_i), QString(c));
}
示例8: func_toggle
// Function: TOGGLE
Value func_toggle(valVector args, ValueCalc *calc, FuncExtra *)
{
QString str = calc->conv()->asString(args[0]).asString();
int i;
int l = str.length();
for (i = 0; i < l; ++i) {
QChar c = str[i];
QChar lc = c.toLower();
QChar uc = c.toUpper();
if (c == lc) // it is in lowercase
str[i] = c.toUpper();
else if (c == uc) // it is in uppercase
str[i] = c.toLower();
}
return Value(str);
}
示例9: translatedToVanity
QChar QPhoneNumberString::translatedToVanity(const QChar c) {
if ( c.isNull() ) return QChar();
if ( c.isNumber() ) return c;
if ( c.isSpace() ) return QChar('1');
QChar vanityChar = m_VanityChars[ c.toLower() ];
if ( vanityChar.isNull() )
kDebug() << " did not found char "
<< c << hex << c.unicode()
<< "\" to translate.";
return( vanityChar );
}
示例10:
QChar
toLower(QChar c)
{
#if QT_VERSION>=0x040000
// QT4 code
return c.toLower();
#else
// QT3 code
return c.lower();
#endif
}
示例11: getPosAlphabet
//------------------------------------------------------------------------------
QString StringMod::getPosAlphabet(const QChar word) {
QString res = word;
char alphabet[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v','w','x','y','z','0','1',
'2','3','4','5','6','7','8','9','-'};
for (int i = 0; i < sizeof(alphabet); ++i) {
if (word.toLower()==alphabet[i]) {
res = QString::number(i+1);
break;
}
}
return res;
}
示例12: CharMatch
static bool CharMatch(QChar ref, QChar test)
// ----------------------------------------------------------------------------
// Character matching function used by incremental search
// ----------------------------------------------------------------------------
// * Comparison is case-insensitive
// * Space and underscore are equivalent
// * Accent folding: a letter without accent matches itself and the same
// letter with any accent; but an accented letter matches only itself.
// For instance: CharMatch('e', 'é') => true
// CharMatch('e', 'e') => true
// CharMatch('é', 'e') => false
{
static QMap<QChar, QChar> fold;
if (fold.empty())
{
# define F(from, to) fold[QChar(from)] = QChar(to)
F(0xE0, 'a'); F(0xE1, 'a'); F(0xE2, 'a'); F(0xE3, 'a'); F(0xE4, 'a');
F(0xE5, 'a');
F(0xE8, 'e'); F(0xE9, 'e'); F(0xEA, 'e'); F(0xEB, 'e');
F(0xEC, 'i'); F(0xED, 'i'); F(0xEE, 'i'); F(0xEF, 'i');
F(0xF2, 'o'); F(0xF3, 'o'); F(0xF4, 'o'); F(0xF5, 'o'); F(0xF6, 'o');
F(0xF8, 'o');
F(0xF9, 'u'); F(0xFA, 'u'); F(0xFB, 'u'); F(0xFC, 'u');
F(0xFD, 'y'); F(0xFF, 'y');
# undef F
}
if (test.toLower() == ref.toLower())
return true;
if ((test.isSpace() || test == '_') &&
( ref.isSpace() || ref == '_'))
return true;
if (fold.contains(test) && fold[test] == ref)
return true;
return false;
}
示例13: toggleCase
void LetterButton::toggleCase()
{
if ( skip ) {
// Don't toggle case the first time
skip=false;
return;
}
QChar ch = text()[0];
QChar nch = ch.toLower();
if ( ch == nch )
nch = ch.toUpper();
setText(QString(nch));
}
示例14: is_a_vowel
bool is_a_vowel(QChar single_letter)
{
// Make sure we are dealing with lowercase letters.
single_letter = single_letter.toLower();
if (!single_letter.isLower()) return FALSE;
if (single_letter == 'a') return TRUE;
if (single_letter == 'e') return TRUE;
if (single_letter == 'i') return TRUE;
if (single_letter == 'o') return TRUE;
if (single_letter == 'u') return TRUE;
return (FALSE);
}
示例15: fixupQString
const QString ctkLDAPExpr::fixupQString( const QString &s )
{
QString sb;
int len = s.length();
for(int i=0; i<len; i++) {
QChar c = s.at(i);
if (!c.isSpace()) {
if (c.isUpper())
c = c.toLower();
sb.append(c);
}
}
return sb;
}