我有以下类构造函数:
UeSettings::UeSettings(QObject *parent,
const QString& settingsFile)
: QObject(parent),
m_ueSettingsFile(settingsFile)
{
QString logText=QString();
this->ueSetServerAddress(QString());
this->ueSetServerPort(QString());
this->ueSetDatabaseName(QString());
this->ueSetDatabaseUsername(QString());
this->ueSetDatabasePassword(QString());
this->ueSetSettingsData(new QSettings(this->ueSettingsFile(),
QSettings::IniFormat,
this));
connect(this,
SIGNAL(ueSignalEventInfoAdded(QString)),
parent,
SLOT(ueSlotEventInfoAdded(QString)));
logText=tr("[INFO]").append(" ")
.append(QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss:zzz"))
.append(" ")
.append(tr("Config file status ")
.append(this->ueSettingsData()->fileName())
.append(": ")
.append(this->ueSettingsData()->status()));
emit this->ueSignalEventInfoAdded(logText);
qDebug() << Q_FUNC_INFO
<< this->ueSettingsData()->status();
} // constructor
现在,为什么我要从行QString
中的QSettings::status
获取空logText
,为什么我会得到0
(这没关系,因为这个值意味着{{ 1}})在QSettings::NoError
行?
答案 0 :(得分:0)
我设法用
解决了这个问题.append(QString::number(this->ueSettingsData()->status()));
用户 Sajmplus 已提供提示。