19 #include <QXmlStreamReader>
22 const QString modelTag =
"ToolTipsData";
23 const QString contextTag =
"context";
24 const QString categoryTag =
"category";
25 const QString propertyTag =
"property";
26 const QString tooltipTag =
"tooltip";
27 const QString whatsthisTag =
"whatsthis";
28 const QString nameAttribute =
"name";
29 const QString sampleViewContext =
"SampleView";
30 const QString titleProperty =
"Title";
31 const QString descriptionProperty =
"Description";
53 QString modelName(className);
54 modelName.remove(
"FormFactor");
60 QFile file(
":/mainwindow/tooltips.xml");
61 if (!file.open(QIODevice::ReadOnly))
64 QXmlStreamReader reader(&file);
66 QString contextName, className, propertyName;
67 while (!reader.atEnd()) {
68 switch (reader.readNext()) {
69 case QXmlStreamReader::StartElement: {
70 const QStringRef tag = reader.name();
71 if (tag == modelTag) {
74 if (tag == contextTag) {
75 const QXmlStreamAttributes attributes = reader.attributes();
76 contextName = attributes.value(nameAttribute).toString();
79 if (tag == categoryTag) {
80 const QXmlStreamAttributes attributes = reader.attributes();
81 className = attributes.value(nameAttribute).toString();
84 if (tag == propertyTag) {
85 const QXmlStreamAttributes attributes = reader.attributes();
86 propertyName = attributes.value(nameAttribute).toString();
89 if (tag == tooltipTag) {
91 QString toolTip = reader.text().toString();
92 addToolTip(contextName, className, propertyName, toolTip);
97 case QXmlStreamReader::EndElement: {
105 if (reader.hasError())
110 const QString& propertyName)
112 return QString(
"/%1/%2/%3").arg(contextName, categoryName, propertyName);
116 const QString& propertyName,
const QString& tooltip)
118 if (!tooltip.isEmpty())
123 const QString& propertyName)
Defines the macro ASSERT.
#define ASSERT(condition)
Defines class GUIHelpers functions.