QWidget crash on creation
-
I have this code based on a book with QT4. It crashes on QT5 on the creation of QWidget:
#include <QApplication> #include <QVBoxLayout> #include <QSlider> int main(int argc, char** argv) { QApplication(argc, argv); QWidget base; QVBoxLayout layout( &base ); QSlider slider( Qt::Horizontal ); layout.addWidget( &slider ); base.show(); return QApplication::exec(); }
On crash it shows this:
1 initFontUnlocked qguiapplication.cpp 250 0x7fecd326f61
2 QGuiApplication::font qguiapplication.cpp 3260 0x7fecd31ddbd
3 QFont::QFont qfont.cpp 611 0x7fecd46d185
4 QWidgetData::QWidgetData Qt5Widgetsd 0x7fece16adb6
5 QWidgetPrivate::QWidgetPrivate qwidget.cpp 262 0x7fece14fe1d
6 QWidget::QWidget qwidget.cpp 1028 0x7fece13f879
7 main main.cpp 11 0x13f113358
8 WinMain qtmain_win.cpp 97 0x13f117dd5
9 invoke_main exe_common.inl 107 0x13f1158dd
10 __scrt_common_main_seh exe_common.inl 288 0x13f11578e
11 __scrt_common_main exe_common.inl 331 0x13f11564e
12 WinMainCRTStartup exe_winmain.cpp 17 0x13f115969
13 BaseThreadInitThunk kernel32 0x772b556d
14 RtlUserThreadStart ntdll 0x7741385dIs it not allowed to use QWdiget like this anymore?
-
ok this was stupid it must be
QApplication app(argc, argv);
in the first line not
QApplication(argc, argv);