Qt5 porting tips/findings
-
I'm sorry I'm not familiar with the VS addin. Maybe someone else can give some suggestions.
-
[quote author="puffosauro" date="1389276361"]I have used the Visual Studio Addin to create the VS projects and also to add Qt classes etc... so I don't have a .pro file.
[/quote]You can export the project to .pro file from vsaddin. This is part of the Qt menu in msvc. I have done my migration from msvc to Qt creator that way.
-
[quote author="JKSH" date="1369361247"]I found another previously-undocumented change:
- QPen now has a default width of 1 instead of 0, so it is no longer cosmetic by default.[/quote]
Ouch
-
[quote author="koahnig" date="1389278461"]
You can export the project to .pro file from vsaddin. This is part of the Qt menu in msvc. I have done my migration from msvc to Qt creator that way. [/quote]Thanks. But I continue to use Visual Studio with the addin.
I have seen that it is easier than I thought, it's almost "automatic", I have only to add the new modules using the addin and I have to change the names of the libraries in the project settings (eg QtCore4.lib -> Qt5Core.lib)
....
[quote author="JKSH" date="1369361247"]
- QPen now has a default width of 1 instead of 0, so it is no longer cosmetic by default.
[/quote]
mamma mia!!!!!! :(
- QPen now has a default width of 1 instead of 0, so it is no longer cosmetic by default.
-
ERROR: 'class QApplication' has no member named 'argc'
FIX for QApplication::argc():
@
s_argc = app->arguments().size();
@FIX for QApplication::argv():
@
s_argv = new char*[s_argc + 1];
//
for (int i = 0; i < s_argc; i++) {
// current arg
std::string arg =
app->arguments().at(i).toStdString();
// copy arg to char** structure
s_argv[i] = new char[strlen(arg.c_str()) + 1];
memcpy(s_argv[i], arg.c_str(),
strlen(arg.c_str()) + 1); // +1 for '\0'
}
s_argv[s_argc] = ((char)NULL);
@My two cents :-)
-
ERROR: 'class QApplication' has no member named 'argc'
FIX for QApplication::argc():
@
s_argc = app->arguments().size();
@FIX for QApplication::argv():
@
s_argv = new char*[s_argc + 1];
//
for (int i = 0; i < s_argc; i++) {
// current arg
std::string arg =
app->arguments().at(i).toStdString();
// copy arg to char** structure
s_argv[i] = new char[strlen(arg.c_str()) + 1];
memcpy(s_argv[i], arg.c_str(),
strlen(arg.c_str()) + 1); // +1 for '\0'
}
s_argv[s_argc] = ((char)NULL);
@My two cents :-)
-
ERROR: 'qWaitForWindowShown' is not a member of 'QTest'
FIX:
@
QWidget* panel;panel->hide();
panel->show();#if QT_VERSION >= 0x050000
QTest::qWaitForWindowActive(panel);
#else
QTest::qWaitForWindowShown(panel);
#endif
@ -
ERROR: 'qWaitForWindowShown' is not a member of 'QTest'
FIX:
@
QWidget* panel;panel->hide();
panel->show();#if QT_VERSION >= 0x050000
QTest::qWaitForWindowActive(panel);
#else
QTest::qWaitForWindowShown(panel);
#endif
@ -
ERROR: QSpinBox: No such file or directory
FIX: Add this in your .pro file:
@
equals(QT_MAJOR_VERSION, 5) {
QT += widgets
}
@ -
ERROR: QSpinBox: No such file or directory
FIX: Add this in your .pro file:
@
equals(QT_MAJOR_VERSION, 5) {
QT += widgets
}
@