标题:QStreamXmlReader读取失败
作者:appledog
日期:2018-08-17 11:09
内容:
读取画笔颜色失败,请问是什么原因呢?
bool GraphicsItem::readBaseAttributes(QXmlStreamReader *xml)
{qreal x = xml->attributes().value(tr("x")).toDouble();
qreal y = xml->attributes().value(tr("y")).toDouble();
m_width = xml->attributes().value("width").toDouble();
m_height = xml->attributes().value("height").toDouble();
pencolor_r=xml->attributes().value("pencolor.r").toInt();
pencolor_g=xml->attributes().value("pencolor.g").toInt();
pencolor_b=xml->attributes().value("pencolor.b").toInt();
}
bool GraphicsItem::writeBaseAttributes(QXmlStreamWriter *xml)
{xml-> ..
#1 [firebolt 08-17 14:15]
读取颜色失败是什么意思,没读出来还是读出来不对?
#2 回 firebolt 的帖子 [appledog 08-18 15:07]
firebolt:读取颜色失败是什么意思,没读出来还是读出来不对? (2018-08-17 14:15)
读不出来,打开还是随机颜色,但是存进去了
#3 回 firebolt 的帖子 [appledog 08-18 18:02]
firebolt:读取颜色失败是什么意思,没读出来还是读出来不对? (2018-08-17 14:15)
改出来了,加了一个函数setBrushColor(QColor(brushcolor_r,brushcolor_g,brushcolor_b));