本文整理汇总了C++中QString::cStr方法的典型用法代码示例。如果您正苦于以下问题:C++ QString::cStr方法的具体用法?C++ QString::cStr怎么用?C++ QString::cStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::cStr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MkStartRecording
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
void MkStartRecording (int N)
{
QString macro = MacroName( MkRecording = N );
luaP_getglobal("Mk");
luaP_pushstring (macro.cStr());
luaP_pushinteger (TK_EM0+N);
luaQQ_rawset(-3); luaQn_pop(1);
}
示例2: MkStopRecording
void MkStopRecording (void) //- - - - - - - - - - - - - - - - - - - - - - - - -
{ // make sure there is no self-refs in
QString macro = MacroName(MkRecording); // string to avoid infinite recursion
MkMacro.replace(MkQuoteCmd(macro), ""); // (one such reference is always
luaP_getglobal("Mk"); // recorded just before stopping)
luaP_pushstring( macro.cStr());
luaP_pushstring(MkMacro.uStr()); MkMacro.clear();
luaQQ_rawset(-3); luaQn_pop(1); MkRecording = 0;
}
示例3: LoadTheWorld
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void jdlvFrame::LoadTheWorld (QString filename)
{
if (isChanged) reLoad->setEnabled(false); isChanged = false;
if (eM & elModePlay) DoPlayStop(); worldFilename = filename;
genNo = 0; playGen->setText("0");
primeWorld->clearTheWorld();
primeWorld->pasteFile(filename.cStr()); vista->lookAtThis(primeWorld);
SetWinTitle(); vista->resize_to_fit();
}
示例4: setRules
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void elMundo::setRules (QString ruleString)
{
QString::const_iterator it;
int B_bitmask = 0, S_bitmask = 0;
QString digits;
if (reBrule.indexIn(ruleString) >= 0) {
digits = reBrule.cap(1);
for (it = digits.constBegin(); it != digits.constEnd(); it++)
B_bitmask |= (1 << it->digitValue());
}
if (reSrule.indexIn(ruleString) >= 0) {
digits = reSrule.cap(1);
for (it = digits.constBegin(); it != digits.constEnd(); it++)
S_bitmask |= (1 << it->digitValue());
}
fprintf(stderr,"Rules(%s=+%x:%x)\n", ruleString.cStr(), B_bitmask,S_bitmask);
setRules(B_bitmask, S_bitmask);
}
示例5: MkConvertKeyMods
//-----------------------------------------------------------------------------
int MkConvertKeyMods (QKeyEvent *event, int &modMask)
{
bool keypad = (event->modifiers() & Qt::KeypadModifier);
int key = event->key();
QString text = event->text();
//
// Revert the Qt intelligence: Ctrl should be Ctrl on any platform, I'm too old
// to re-learn the keysequences twice a day switching from Mac to Linux to Win:
//
modMask = (event->modifiers() & (Qt::AltModifier|Qt::ShiftModifier)) |
#ifdef Q_OS_MAC
((event->modifiers() & Qt::MetaModifier) ? mod_CTRL : 0)|
((event->modifiers() & Qt::ControlModifier) ? mod_META : 0);
#else
((event->modifiers() & Qt::ControlModifier) ? mod_CTRL : 0)|
((event->modifiers() & Qt::MetaModifier) ? mod_META : 0);
#endif
if (MiApp_debugKB) { fprintf(stderr, "OnKey(%x", key);
if (!text.isEmpty()) {
if (text.at(0).isPrint()) fprintf(stderr, ":%s", text.cStr());
else for (int i = 0; i < text.size(); i++)
fprintf(stderr, ".%02x", text[i].unicode());
}
fprintf(stderr, "|%c%c%c%c%c),native=%x:%x:%x", keypad ? '#' : '.',
(modMask & mod_META) ? 'M' : '.', (modMask & mod_CTRL) ? 'c' : '.',
(modMask & mod_ALT) ? 'a' : '.', (modMask & mod_SHIFT) ? 's' : '.',
event->nativeScanCode(), event->nativeModifiers(),
event->nativeVirtualKey());
if (Mk_IsSHIFT(key)) fprintf(stderr, "\n");
} if (Mk_IsSHIFT(key)) return -1;
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#if defined(Q_OS_MAC) && (QT_VERSION < 0x040500)
if (key == Qt::Key_unknown) // old Qt version (4.3.3) did not
switch (event->nativeVirtualKey()) { // convert keys F13…F15 correctly on
case 0x69: key = Qt::Key_F13; break; // Apple new solid aluminum keyboard
case 0x6b: key = Qt::Key_F14; break; // (model A1243), fixing that, using
case 0x71: key = Qt::Key_F15; break; // native virtual key (which is Ok)
}
#endif
if (keypad) { // For whatever reasons, Qt always reports arrow keys with
#ifdef Q_OS_MAC // KeypadMod on Mac, remove it for consistency..
switch (key) { //
case Qt::Key_Up: case Qt::Key_Left:
case Qt::Key_Down: case Qt::Key_Right: return key;
}
#else
# ifdef Q_OS_WIN // completely ignore Alt+Numpad keys,
if (modMask == mod_ALT) return -1; // let Windows handle them by itself
if (key == Qt::Key_Enter) return key;
# endif
switch (key) {
case Qt::Key_Delete: key = '.'; break; // for consistency, ALWAYS convert
case Qt::Key_Insert: key = '0'; break; // base key to digit, so Linux and
case Qt::Key_End: key = '1'; break; // Windows behaves the same as Mac
case Qt::Key_Down: key = '2'; break; //
case Qt::Key_PageDown: key = '3'; break; // (for those attached to standard
case Qt::Key_Left: key = '4'; break; // OS-specific behavior, feel free
case Qt::Key_Clear: key = '5'; break; // to remap command by Lua script)
case Qt::Key_Right: key = '6'; break; //
case Qt::Key_Home: key = '7'; break;
case Qt::Key_Up: key = '8'; break;
case Qt::Key_PageUp: key = '9'; break;
}
#endif
return key | mod_KyPAD;
} return key;
}
示例6: flush
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void elSalvador::flush (QString line)
{
fprintf(stderr, "%s\n", line.cStr());
}