Important: Please read the Qt Code of Conduct -

widget with Qt::WA_NoSystemBackground attribute make text coincides with previous text

  • int main(int argc, char *argv[])
        QApplication a(argc, argv);
        QWidget widget;
        QLabel* lable = new QLabel(&widget);
        QPushButton button("button",&widget);
        QVBoxLayout v;
        return a.exec();


    [Added code tags ~kshegunov]

  • Lifetime Qt Champion


    What is your question ?

  • @SGaist

    in this programm,when i change the label's text,the previous text does't disappear,old and new text show together
    and i must have the code(widget.setAttribute(Qt::WA_NoSystemBackground);) to solve some issue

  • Lifetime Qt Champion

    What issues do you have that requires that attribute set ?

  • @SGaist sorry for reply later and my unskilled english
    Because flicker appears When i run my application in embedeed system,then i found that set that attribute will solve the issue,But another issue comes,as you see in that picture,the previouse text and the new text show together.Yestoday i found that setAttribute(Qt::WA_TranslucentBackground) worked,But it makes the widget's background transparent

  • Lifetime Qt Champion

    Did you try to track the reason of the flickering ?

    What else are you doing that could trigger that ?

  • @SGaist The reason of the flickering i have asked in another topic,the main code bring the issue is
    QGraphicsView view;
    view.setViewport(new QGLWidget)
    i don't know how it happen

    thank you very much

  • Lifetime Qt Champion

    Ok, then can you explain exactly what is the original problem you have since everything seems related to that flickering issue ? Are you trying to put a label over a QGraphicsScene ? Are you trying to have text on that scene ?

  • @SGaist neither,the original problem is my application flicker in embedded system, i tracked that
    QGraphicsView view;
    view.setViewport(new QGLWidget)
    this code case the problem,But i have no any idea why,I have tryed to track the Qt open-source but failed,then i found that
    this code is effective,But it bring a new problem that the text overlapping,Then i found that set the transparent attribute will solve the overlapping problem,
    so this problem seems has solved

  • Lifetime Qt Champion

    Did you check that your embedded system has proper OpenGL support ?

  • @SGaist Yes,it support OpenGL

Log in to reply