studing sddm code official git (https://github.com/sddm/sddm), try add test code:
void usermodel::test() { qstring str1 = "test"; qwarning("%s",str1); } but have error:
whithin context.
what mean? how should intialise new qstring variable?
you're not posting complete error, , can't pass qstring directly qwarning. use c format string, need convert local encoding , pass const char* that, or better yet use debug stream:
void usermodel::test() { auto str1 = qstringliteral("test"); // preferred qwarning() << str1; // acceptable qwarning("%s", str1.tolocal8bit().constdata()); }
Comments
Post a Comment