Hey Lykurg,
Thanks for your reply. I did try to define a macro like:
#define Settings QSettings(QSettings::SystemScope, QApplication::organizationName(), QApplication::applicationName());
#define Settings QSettings(QSettings::SystemScope, QApplication::organizationName(), QApplication::applicationName());
To copy to clipboard, switch view to plain text mode
But then when I would want to use it like:
QSettings settings = Settings;
To copy to clipboard, switch view to plain text mode
I would get the error:
QSettings::QSettings(const QSettings&)' is private
After checking with the QSettings source code i've seen that the copy constructor was disabled
Q_DISABLE_COPY(QSettings)
To copy to clipboard, switch view to plain text mode
So, as a solution I defined my own custom class, SystemSettings which inherits QSettings, and in it's constructor just calls the proper QSettings's constructor.
{
public:
SystemSettings()
};
class SystemSettings : public QSettings
{
public:
SystemSettings()
:QSettings(QSettings::SystemScope, QApplication::organizationName(), QApplication::applicationName()){};
};
To copy to clipboard, switch view to plain text mode
And, to be in the same side Qt is, i am also disabling my copy constructor:
private:
Q_DISABLE_COPY(SystemSettings);
private:
Q_DISABLE_COPY(SystemSettings);
To copy to clipboard, switch view to plain text mode
Would you suggest different?
Thanks,
Wladek
Bookmarks