本文整理汇总了C++中Shortcut::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Shortcut::clear方法的具体用法?C++ Shortcut::clear怎么用?C++ Shortcut::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shortcut
的用法示例。
在下文中一共展示了Shortcut::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void Shortcut::load()
{
QFile f(dataPath + "/shortcuts.xml");
if (!f.exists())
f.setFileName(":/data/shortcuts.xml");
if (!f.open(QIODevice::ReadOnly)) {
printf("cannot open shortcuts\n");
return;
}
QDomDocument doc;
int line, column;
QString err;
if (!doc.setContent(&f, false, &err, &line, &column)) {
printf("error reading shortcuts.xml at line %d column %d: %s\n",
line, column, qPrintable(err));
return;
}
f.close();
QString key;
for (QDomElement e = doc.documentElement(); !e.isNull(); e = e.nextSiblingElement()) {
if (e.tagName() == "Shortcuts") {
for (QDomElement ee = e.firstChildElement(); !ee.isNull(); ee = ee.nextSiblingElement()) {
if (ee.tagName() == "SC") {
Shortcut* sc = 0;
for (QDomElement eee = ee.firstChildElement(); !eee.isNull(); eee = eee.nextSiblingElement()) {
const QString& tag(eee.tagName());
const QString& val(eee.text());
if (tag == "key") {
sc = getShortcut(val.toAscii().data());
if (!sc) {
printf("cannot find shortcut <%s>\n", qPrintable(val));
break;
}
sc->clear();
}
else if (tag == "std")
sc->_standardKey = QKeySequence::StandardKey(val.toInt());
else if (tag == "seq")
sc->_keys.append(QKeySequence::fromString(val, QKeySequence::PortableText));
else
domError(eee);
}
}
else
domError(ee);
}
}
else
domError(e);
}
dirty = false;
}
示例2: load
void Shortcut::load()
{
QFile f(dataPath + "/shortcuts.xml");
if (!f.exists())
f.setFileName(":/data/shortcuts.xml");
if (!f.open(QIODevice::ReadOnly)) {
qDebug("Cannot open shortcuts <%s>", qPrintable(f.fileName()));
return;
}
if (MScore::debugMode)
qDebug("read shortcuts from <%s>", qPrintable(f.fileName()));
XmlReader e(&f);
while (e.readNextStartElement()) {
if (e.name() == "Shortcuts") {
while (e.readNextStartElement()) {
if (e.name() == "SC") {
Shortcut* sc = 0;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "key") {
QString val(e.readElementText());
sc = getShortcut(val.toLatin1().data());
if (!sc)
qDebug("cannot find shortcut <%s>", qPrintable(val));
else
sc->clear();
}
else if (tag == "std") {
int i = e.readInt();
if(sc)
sc->_standardKey = QKeySequence::StandardKey(i);
}
else if (tag == "seq") {
QString s = e.readElementText();
if(sc)
sc->_keys.append(Shortcut::keySeqFromString(s, QKeySequence::PortableText));
// sc->_keys.append(QKeySequence::fromString(e.readElementText(), QKeySequence::PortableText));
}
else
e.unknown();
}
}
else
e.unknown();
}
}
else
e.unknown();
}
dirty = false;
}
示例3: load
void Shortcut::load()
{
QFile f(dataPath + "/shortcuts.xml");
if (!f.exists())
f.setFileName(":/data/shortcuts.xml");
if (!f.open(QIODevice::ReadOnly)) {
printf("cannot open shortcuts\n");
return;
}
XmlReader e(&f);
QString key;
while (e.readNextStartElement()) {
if (e.name() == "Shortcuts") {
while (e.readNextStartElement()) {
if (e.name() == "SC") {
Shortcut* sc = 0;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "key") {
QString val(e.readElementText());
sc = getShortcut(val.toLatin1().data());
if (!sc) {
printf("cannot find shortcut <%s>\n", qPrintable(val));
break;
}
sc->clear();
}
else if (tag == "std")
sc->_standardKey = QKeySequence::StandardKey(e.readInt());
else if (tag == "seq")
sc->_keys.append(QKeySequence::fromString(e.readElementText(), QKeySequence::PortableText));
else if (tag == "code")
sc->_keys.append(QKeySequence(e.readInt()));
else
e.unknown();
}
}
else
e.unknown();
}
}
else
e.unknown();
}
dirty = false;
}