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. Widgets and painter is getting overlayed by QVideoWidget

Widgets and painter is getting overlayed by QVideoWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 237 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.
  • D Offline
    D Offline
    drakejest
    wrote on last edited by
    #1

    I have a VideoWidget that is occupies the whole window. And i would like to have to have a QPushButton and some text via Qpainter that overlays on top of the video.

    What is happening though is the button and the text is the one being overlayed by the VideoWidget. The button is there i can even click it, i just cant see it

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
    
        video = new QVideoWidget(this);
        video->setGeometry(0,0,this->width(),this->height());
        video->show();
    
        this->repaint();
    
        optionsButton = new QPushButton(this);
        optionsButton->setText("O");
        optionsButton->setGeometry(20,20,40,40);
        optionsButton->show();
    
        connect(optionsButton,SIGNAL(clicked()),this,SLOT(optionsButtonClicked()));
    
        player = new QMediaPlayer(this);
        audio = new QAudioOutput(this);
    
        connect(player,&QMediaPlayer::errorChanged,this,&MainWindow::mediaPlayerDebugError);
        connect(player,&QMediaPlayer::mediaStatusChanged,this,&MainWindow::mediaPlayerDebugStatus);
    
    
        player->setAudioOutput(audio);
        player->setVideoOutput(video);
        player->setSource(QUrl("rtsp://admin:admin@192.168.1.199:554/mpeg4/ch0/main/av_stream"));
    
        player->play();
    
    }
    
    void MainWindow::paintEvent(QPaintEvent *)
    {
        QPainter painter(this);
        painter.setPen(Qt::blue);
        painter.setFont(QFont("Arial", 30));
        painter.drawText(rect(), Qt::AlignCenter, "Qt");
    }
    
    

    Here is a screen shot of what i see

    b08c0de8-d93f-427a-89bc-6b50477bfc12-image.png

    and a screenshot without the VideoWidget

    49e5a523-b023-45ed-9c7e-8f077b082ca4-image.png

    How can i bring to front the PushButton and Painter ?

    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