QLabel partially over a QOpenGlWidget



  • Hi,

    I have a problem when I render a QLabel partially over a QOpenGlWidget and another QLabel.
    The QOpenGlWidget and the QLabel under have the same black background.
    The render of the QLabel over is not the same over the QOpenGlWidget and the QLabel.

    Here the code :

    QApplication* l_app = new QApplication(argc, argv);
    QWidget* l_widget = new QWidget();
    l_widget->setObjectName("l_widget");
    l_widget->setStyleSheet("QWidget#l_widget{"\
                                            "    background-color:rgba(255, 255, 255, 255);" \
                                       "}");
    
    QVBoxLayout* l_layout = new QVBoxLayout();
    l_widget->setLayout(l_layout);
    
    QLabel* l_label = new QLabel();
    l_label->setObjectName("l_label");
    l_label->setText("Label Under");
    l_label->setStyleSheet("QLabel#l_label{"\
                           "    background-color:rgba(0, 0, 0, 255);" \
                           "    color : rgb(190,190,190);"
                           "    font: 40pt;"
                           "    font-weight : bold"
                                       "}");
    
    QOpenGLWidget* l_openGLWidget = new QOpenGLWidget();
    
    l_layout->addWidget(l_label);
    l_layout->addWidget(l_openGLWidget);
    
    QLabel* l_labelOver = new QLabel(l_widget);
    l_labelOver->setObjectName("l_labelOver");
    l_labelOver->setText("Label Over");
    l_labelOver->setStyleSheet("QLabel#l_labelOver{"\
                               "    background-color:rgba(255, 0, 0, 100);" \
                               "    color : rgb(190,190,190);"
                               "    font: 35pt;"
                               "    font-weight : bold"
                                           "}");
    l_labelOver->setGeometry(150,150,300,300);
    
    l_widget->setMinimumSize(QSize(600,600));
    l_widget->setMaximumSize(QSize(600,600));
    l_widget->show();
    
    int res = l_app->exec();
    return res;

Log in to reply
 

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