本文整理汇总了C++中MainWidget::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ MainWidget::setProperty方法的具体用法?C++ MainWidget::setProperty怎么用?C++ MainWidget::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWidget
的用法示例。
在下文中一共展示了MainWidget::setProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadLayout
int ThemeLoader::loadLayout(const QString& themeName, const QString& path)
{
// const KArchiveDirectory * KArchive::directory ( ) const
QFile themeFile;
QDomDocument doc;
themeFile.setFileName(QString(path + "%1.xml").arg(themeName));
if (!themeFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::information(0, "Error", QString("Unable to open theme xml file: %1").arg(themeFile.fileName()));
return -1;
}
if (!doc.setContent(&themeFile)) {
QMessageBox::information(0, "Error", QString("Unable to parse theme xml file: %1").arg(themeFile.fileName()));
return -2;
}
themeFile.close();
QDomElement docElem = doc.documentElement();
QDomNodeList wList = docElem.elementsByTagName("buttonWidth");
QDomNode wNode = wList.at(0);
//read default button width
defaultWidth = wNode.attributes().namedItem("width").toAttr().value().toInt();
QDomNodeList nList = (wNode.toElement()).elementsByTagName("item");
for (int a=0; a<nList.count(); a++) {
QDomNode node = nList.at(a);
int width = node.attributes().namedItem("width").toAttr().value().toInt();
QString hintName = node.attributes().namedItem("name").toAttr().value();
widthMap.insert(hintName, width);
//cout << "widths[" << qPrintable(hintName) << "]=>"<< width << endl;
}
wList = docElem.elementsByTagName("buttonHeight");
wNode = wList.at(0);
nList = (wNode.toElement()).elementsByTagName("item");
for (int a=0; a<nList.count(); a++) {
QDomNode node = nList.at(a);
int height = node.attributes().namedItem("height").toAttr().value().toInt();
QString hintName = node.attributes().namedItem("name").toAttr().value();
heightMap.insert(hintName, height);
//cout << "heights[" << qPrintable(hintName) << "]=>"<< height << endl;
}
wList = docElem.elementsByTagName("spacingHints");
wNode = wList.at(0);
nList = (wNode.toElement()).elementsByTagName("item");
for (int a=0; a<nList.count(); a++) {
QDomNode node = nList.at(a);
int width = node.attributes().namedItem("width").toAttr().value().toInt();
QString hintName = node.attributes().namedItem("name").toAttr().value();
spacingMap.insert(hintName, width);
//cout << "spacing[" << qPrintable(hintName) << "]=>"<< width << endl;
}
wList = docElem.elementsByTagName("part");
wNode = wList.at(0);
//insert main part to widget
QString partName = wNode.attributes().namedItem("name").toAttr().value();
MainWidget *part = new MainWidget((QWidget*)parent());
part->setProperty("part", "main");
loadKeys(part, wNode);
wList = wNode.childNodes();
for (int a=0; a<wList.size(); a++) {
QDomNode wNode = wList.at(a);
if (wNode.toElement().tagName() == "extension") {
MainWidget *widget1 = new MainWidget((QWidget*)parent());
widget1->setProperty("part", "extension");
loadKeys(widget1, wNode);
break;
}
}
return 0;
}