qt - ASSERT failure in QVariant: "Trying to construct an unknown type", file kernel\qvariant.cpp, line 980 -


qt 5.5.0

i'm switching 1 of gui applications console. i'm having problem qsettings object initiation in console mode.

this code in gui, works fine:

class mainwindow : public qmainwindow {     q_object  public:     mainwindow();     qsettings *setts; //settigns ... } mainwindow::mainwindow() {     qfile setfile("./sa/settings.ini");     if (setfile.exists())         setfile.setpermissions(setfile.permissions() | qfiledevice::readuser | qfiledevice::writeuser);     setts = new qsettings("./sa/settings.ini", qsettings::iniformat);     setfile.setfilename(setts->value("localization","./sa/en.loc").tostring());     ... } int main(int argc, char *argv[]) {     qpointer<qapplication> app;     qpointer<mainwindow> main_window;     app = new qapplication(argc, argv);     main_window = new mainwindow(); ... } 

and code console

class mainwindow : public qobject {     q_object  public:     mainwindow();     ~mainwindow();     qsettings *setts; //settigns ... } mainwindow::mainwindow() {      qfile setfile("./sa/settings.ini");     if (setfile.exists())         setfile.setpermissions(setfile.permissions() | qfiledevice::readuser | qfiledevice::writeuser);     setts = new qsettings("./sa/settings.ini", qsettings::iniformat);     setfile.setfilename(setts->value("localization",qstring("./sa/en.loc")).tostring()); ... } int main(int argc, char *argv[]) {     qcoreapplication a(argc, argv);     mainwindow mw; ... } 

console code fails on calling setts->value error: assert failure in qvariant: "trying construct unknown type", file kernel\qvariant.cpp, line 980.

while debugging noticed warnings when enter class constructor: can't find linker symbol virtual table `qsettings' value.

i tried multiple ways, qsettings doesn`t initialize values in constructor, though file present. calling setts->contains("localization") gives same error. if use setts->setvalue after constructor, works fine. can make qsettings initialize in constructor?

settings.ini

[general] geometry="@bytearray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\aw\xff\xff\xff\xf7\0\0\xf\b\0\0\x4\x10\0\0\bn\0\0\0\x43\0\0\f\x8c\0\0\x4;\0\0\0\x1\x2\0\0\0\a\x80)" localization=./sa/ru.loc locale=windows-1251 consolelocale=csibm866 logfile=./sa/log.txt setnumber=basic comport=com1 status=false console=true file=false time=true direction=true fontdata=@variant(\0\0\0@\0\0\0\x1c\0m\0s\0 \0s\0h\0\x65\0l\0l\0 \0\x44\0l\0g\0 \0\x32@ \0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) monofontdata=@variant(\0\0\0@\0\0\0\x10\0\x43\0o\0n\0s\0o\0l\0\x61\0s@ \0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10) autoclear=true autodetails=true acktimeout=5 naktimeout=2 msgtimeout=45 


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -