Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Button over QVideoWidget
Forum Update on Monday, May 27th 2025

Button over QVideoWidget

Scheduled Pinned Locked Moved Solved Mobile and Embedded
20 Posts 7 Posters 1.9k 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.
  • B Offline
    B Offline
    Bonty
    wrote on last edited by
    #6

    Hi @jsulm ,

    In Qt5.15.2 it is simply drag button over video widget and its working but its not the same in Qt6. So I don't think Qt5 and Qt6 is similar, even there is changes in Qt5.13 and Qt5.15 also.

    Please help !!

    jsulmJ 1 Reply Last reply
    0
    • B Bonty

      Hi @jsulm ,

      In Qt5.15.2 it is simply drag button over video widget and its working but its not the same in Qt6. So I don't think Qt5 and Qt6 is similar, even there is changes in Qt5.13 and Qt5.15 also.

      Please help !!

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #7

      @Bonty said in Button over QVideoWidget:

      but its not the same in Qt6

      What does this mean exactly? What happens in Qt6?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bonty
        wrote on last edited by
        #8

        In QT6 the button hide behind video.

        A 1 Reply Last reply
        1
        • B Bonty

          In QT6 the button hide behind video.

          A Offline
          A Offline
          arsinte_andrei
          wrote on last edited by
          #9

          @Bonty look at the button properties..and bring it to front

          B 1 Reply Last reply
          0
          • A arsinte_andrei

            @Bonty look at the button properties..and bring it to front

            B Offline
            B Offline
            Bonty
            wrote on last edited by
            #10

            @arsinte_andrei

            Still not working, hide behind video.

            JoeCFDJ 1 Reply Last reply
            1
            • B Bonty

              @arsinte_andrei

              Still not working, hide behind video.

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by JoeCFD
              #11

              @Bonty can you try to create the button with the parent of videoWidget?

              QPushButton *button = new QPushButton(videoWidget->parentWidget() );
              

              then move it to the right position

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bonty
                wrote on last edited by
                #12

                Hi @JoeCFD

                Thanks for replying!

                Here is my code and application output image Screenshot from 2024-05-07 10-27-59.png but still same issue:-

                
                #include "mainwindow.h"
                #include "ui_mainwindow.h"
                
                MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow)
                {
                    ui->setupUi(this);
                    m_camera.reset(new QCamera(QMediaDevices::defaultVideoInput()));
                    m_captureSession.setCamera(m_camera.data());
                    m_captureSession.setVideoOutput(ui->videoWidget);
                    m_camera->start();
                    QPushButton *button = new QPushButton(ui->videoWidget->parentWidget() );
                    button->setGeometry(100,100,100,100);
                 }
                
                
                
                MainWindow::~MainWindow()
                {
                    delete ui;
                }
                
                1 Reply Last reply
                1
                • JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by
                  #13

                  Try the following as well and add some background color(like green for testing)
                  button->setWindowFlags((Qt::WindowFlags)(Qt::WindowStaysOnTopHint ) );

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    Hi,

                    In Qt 6, the QVideoWidget uses a QWindow based class to do the rendering which means OpenGL is used for the rendering and it's likely a top level surface hence your buttons that renders behind it.
                    You might want to consider making use of QML for that part.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    B 1 Reply Last reply
                    1
                    • B Bonty has marked this topic as solved on
                    • SGaistS SGaist

                      Hi,

                      In Qt 6, the QVideoWidget uses a QWindow based class to do the rendering which means OpenGL is used for the rendering and it's likely a top level surface hence your buttons that renders behind it.
                      You might want to consider making use of QML for that part.

                      B Offline
                      B Offline
                      Bonty
                      wrote on last edited by Bonty
                      #15

                      Hi @SGaist,

                      Thanks for suggestion! Its working using QML. But there is problem in QML is that I cant change camera input format and frame rate. If possible then how I can change?

                      Please help!!

                      SGaistS 1 Reply Last reply
                      0
                      • B Bonty

                        Hi @SGaist,

                        Thanks for suggestion! Its working using QML. But there is problem in QML is that I cant change camera input format and frame rate. If possible then how I can change?

                        Please help!!

                        SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        @Bonty How is your QtQuick code looking currently ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • X Offline
                          X Offline
                          xylo212
                          wrote on last edited by
                          #17
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • QtFriend2024Q Offline
                            QtFriend2024Q Offline
                            QtFriend2024
                            wrote on last edited by QtFriend2024
                            #18

                            Hello, I have the same problem.

                            QT 6.7.3

                            QT Creator: 15.*
                            Target O.S.: Windows 11

                            I want QPushButton(s) [and QLabel(s)] to display in front of my QVideoWidget object, but the QVideoWidget object keeps getting forced to the front, so all other QObjects get hidden behind the QVideoWidget object. My QVideoWidget displays within a window (not within a QDialog).

                            • I've tried QWidget::lower() / QWidget::raise() on the QVideoWiget and QPushButton but the QVideoWidget still gets forced to the front.

                            • I've tried setting the parent of the QPushButton to the QVideoWidget object but am still not able to force the QPushButton to display in front of the QWidget object.

                            • I've tried adding the QVideoWidget and QPushButton to a QVBoxLayout then used move() and raise() to move the QPushButton to the front of the QVideoWidget object but the QVideoWidget remains forced to the front.

                            Note: I AM able to get a QDialog to display in front of the QVideoWidget but this is not what I want.

                            How can I get a QPushButton to display in front of the QVideoWidget?

                            Thanks!

                            jsulmJ 1 Reply Last reply
                            0
                            • QtFriend2024Q QtFriend2024

                              Hello, I have the same problem.

                              QT 6.7.3

                              QT Creator: 15.*
                              Target O.S.: Windows 11

                              I want QPushButton(s) [and QLabel(s)] to display in front of my QVideoWidget object, but the QVideoWidget object keeps getting forced to the front, so all other QObjects get hidden behind the QVideoWidget object. My QVideoWidget displays within a window (not within a QDialog).

                              • I've tried QWidget::lower() / QWidget::raise() on the QVideoWiget and QPushButton but the QVideoWidget still gets forced to the front.

                              • I've tried setting the parent of the QPushButton to the QVideoWidget object but am still not able to force the QPushButton to display in front of the QWidget object.

                              • I've tried adding the QVideoWidget and QPushButton to a QVBoxLayout then used move() and raise() to move the QPushButton to the front of the QVideoWidget object but the QVideoWidget remains forced to the front.

                              Note: I AM able to get a QDialog to display in front of the QVideoWidget but this is not what I want.

                              How can I get a QPushButton to display in front of the QVideoWidget?

                              Thanks!

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #19

                              @QtFriend2024 Please read what @SGaist wrote. It will not work with widgets, but should work with QML.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              QtFriend2024Q 1 Reply Last reply
                              1
                              • jsulmJ jsulm

                                @QtFriend2024 Please read what @SGaist wrote. It will not work with widgets, but should work with QML.

                                QtFriend2024Q Offline
                                QtFriend2024Q Offline
                                QtFriend2024
                                wrote on last edited by
                                #20

                                @jsulm Ok thank you. I was trying to avoid using QML, but I will try this.

                                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