@ -18,16 +18,14 @@
|
||||
#include <QDomNodeList>
|
||||
#include <QVariant>
|
||||
|
||||
NewsEntry::NewsEntry(QObject* parent) :
|
||||
QObject(parent)
|
||||
NewsEntry::NewsEntry(QObject* parent) : QObject(parent)
|
||||
{
|
||||
this->title = tr("Untitled");
|
||||
this->content = tr("No content.");
|
||||
this->link = "";
|
||||
}
|
||||
|
||||
NewsEntry::NewsEntry(const QString& title, const QString& content, const QString& link, QObject* parent) :
|
||||
QObject(parent)
|
||||
NewsEntry::NewsEntry(const QString& title, const QString& content, const QString& link, QObject* parent) : QObject(parent)
|
||||
{
|
||||
this->title = title;
|
||||
this->content = content;
|
||||
@ -37,16 +35,13 @@ NewsEntry::NewsEntry(const QString& title, const QString& content, const QString
|
||||
/*!
|
||||
* Gets the text content of the given child element as a QVariant.
|
||||
*/
|
||||
inline QString childValue(const QDomElement& element, const QString& childName, QString defaultVal="")
|
||||
inline QString childValue(const QDomElement& element, const QString& childName, QString defaultVal = "")
|
||||
{
|
||||
QDomNodeList nodes = element.elementsByTagName(childName);
|
||||
if (nodes.count() > 0)
|
||||
{
|
||||
if (nodes.count() > 0) {
|
||||
QDomElement elem = nodes.at(0).toElement();
|
||||
return elem.text();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user