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::paintEngine: Should no longer be called
Forum Update on Monday, May 27th 2025

QWidget::paintEngine: Should no longer be called

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 1.1k 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.
  • J Offline
    J Offline
    Jakob Clausen
    wrote on last edited by
    #1

    I am trying to make a simple widget that can show videos.
    I have

    #include "video.h"
    #include <QVideoWidget>
    
    Video::Video(QWidget* parent, QString videofile) : QVideoWidget(parent)
    {
        player = new QMediaPlayer(this);
        player->setMedia(QUrl::fromLocalFile(videofile));
        player->setVolume(50);
        player->setVideoOutput(this);
    }
    
    void Video::play()
    {
        player->play();
    }
    
    Video::~Video()
    {
        if (player)
            delete player;
    }
    
    
    

    And then I get the message:
    QWidget::paintEngine: Should no longer be called

    What am I doing wrong?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Well it might not be your fault :)

      But one thing is wrong
      player = new QMediaPlayer(this); << the "this" is a parent

      and will delete anything it owns. Most of Qt works this way.

      So you very rarely need to delete manually anything you give a parent.

      so don't delete the player manually, as your Video class will do it.

      This ownership system is explained here
      https://doc.qt.io/qt-5/objecttrees.html

      1 Reply Last reply
      1
      • J Offline
        J Offline
        Jakob Clausen
        wrote on last edited by
        #3

        Hi.
        And thank you.
        You make a good point. But I guess that's not the reason.
        What do you mean - it might not be your fault?

        mrjjM 1 Reply Last reply
        0
        • J Jakob Clausen

          Hi.
          And thank you.
          You make a good point. But I guess that's not the reason.
          What do you mean - it might not be your fault?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Jakob-Clausen
          "by not your fault" I mean that i see no use of QPainter in the code shown so
          it could be QMediaPlayer that does something wrong unless there far more
          code to Video , you didnt show.

          J 1 Reply Last reply
          1
          • mrjjM mrjj

            @Jakob-Clausen
            "by not your fault" I mean that i see no use of QPainter in the code shown so
            it could be QMediaPlayer that does something wrong unless there far more
            code to Video , you didnt show.

            J Offline
            J Offline
            Jakob Clausen
            wrote on last edited by
            #5

            @mrjj I have shown you everything. Should I just ignore it?

            mrjjM 1 Reply Last reply
            0
            • J Jakob Clausen

              @mrjj I have shown you everything. Should I just ignore it?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Jakob-Clausen

              Yes, then just ignore it for now.

              What Qt version and platform are you on ?

              This used to be a bug. Didnt track it so not sure it was fixed at some point.

              You could try player->stop(); via a button to test if that makes the error go away

              J 1 Reply Last reply
              1
              • mrjjM mrjj

                @Jakob-Clausen

                Yes, then just ignore it for now.

                What Qt version and platform are you on ?

                This used to be a bug. Didnt track it so not sure it was fixed at some point.

                You could try player->stop(); via a button to test if that makes the error go away

                J Offline
                J Offline
                Jakob Clausen
                wrote on last edited by
                #7

                @mrjj I am using Qt 5.15 on linux.
                I get the error when the widget is shown, so play() is never run.
                If it used to be a bug, then I guess it still is.
                I will ignore it.

                mrjjM 1 Reply Last reply
                0
                • J Jakob Clausen

                  @mrjj I am using Qt 5.15 on linux.
                  I get the error when the widget is shown, so play() is never run.
                  If it used to be a bug, then I guess it still is.
                  I will ignore it.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #8

                  @Jakob-Clausen
                  Oh, so its not even when you close or anything ?
                  Well, then, i think it's still the same bug as it sounds like how it was reported from other users.
                  It should be safe to ignore it.

                  1 Reply Last reply
                  1
                  • J Offline
                    J Offline
                    Jakob Clausen
                    wrote on last edited by
                    #9

                    Ok.
                    Thank you very much for your help.
                    Have a nice weekend. :-)

                    mrjjM 1 Reply Last reply
                    0
                    • J Jakob Clausen

                      Ok.
                      Thank you very much for your help.
                      Have a nice weekend. :-)

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Jakob-Clausen
                      Same to you :)
                      Also please use the "Topic Tool" button to set this as solved. ( in first post, to the right )

                      1 Reply Last reply
                      0

                      • Login

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