Painting on top of QAxWidget



  • I host an ActiveX control which displays video. It is wrapped in QAxWidget. I try painting within QAxWidget but it always appears behind:

    @
    void MainWindow::paintEvent(QPaintEvent* e)
    {
    QMainWindow::paintEvent(e);
    QPainter p(this);
    p.setPen(Qt::red);
    p.drawRect(10,10,100,100);
    p.end();
    }
    @

    I can see the left top and left bottom corners of the rect to know it's drawn but don't understand how to get the z-order changed. The items are laid out in QDesigner. Below is some of the derived header from the UI compiler:

    ui_mainwindow.h
    @
    centralWidget = new QWidget(MainWindow);
    centralWidget->setObjectName(QStringLiteral("centralWidget"));
    gridLayout = new QGridLayout(centralWidget);
    gridLayout->setSpacing(6);
    gridLayout->setContentsMargins(11, 11, 11, 11);
    gridLayout->setObjectName(QStringLiteral("gridLayout"));
    HDVideo = new QAxWidget(centralWidget);
    HDVideo->setControl(QStringLiteral("{cb1671db-6c24-4c48-b5f9-8276d135501e}"));
    HDVideo->setObjectName(QStringLiteral("HDVideo"));

        gridLayout->addWidget(HDVideo, 0, 0, 1, 1);
    

    @

    I've tried calling ui->HDVideo->lower as well as ui->HDVideo->stackUnder(this) which doesn't work. How can you paint on a QAxWidget?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.