Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-102245

Erroneous Error: "Cannot create a QWidget without QApplication

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.2.2
    • Widgets: Main Window
    • None
    • Visual Studio 2019, Windows x64
    • Windows

    Description

      Player,h

      #pragma once
      #include <QWidget>
      class Player : public QWidget
      {
          Q_OBJECT
      public:
          explicit Player(QWidget *parent = nullptr) : QWidget(parent)
          {
              setAutoFillBackground(false);
              setAttribute(Qt::WA_NoSystemBackground, true);
              setAttribute(Qt::WA_PaintOnScreen, true);
          }
          ~Player() = default;
      };
      
      
      #include <QApplication>
      #include "player.h"
      int main(int argc, char *argv[]) 
      { 
        QCoreApplication a(argc, argv); 
        Player player; 
        player.show(); 
        return a.exec(); 
      }
      

      Error occurs in Player constructor

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            doug_rogers Doug Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes