Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidget crash on creation

QWidget crash on creation

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 330 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sandro4912
    wrote on last edited by
    #1

    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 0x7741385d

    Is it not allowed to use QWdiget like this anymore?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sandro4912
      wrote on last edited by
      #2

      ok this was stupid it must be

      QApplication app(argc, argv);
      

      in the first line not

      QApplication(argc, argv);
      
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved