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. widget with Qt::WA_NoSystemBackground attribute make text coincides with previous text
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 3.6k 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.
  • hello qterH Offline
    hello qterH Offline
    hello qter
    wrote on last edited by kshegunov
    #1
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QWidget widget;
        widget.setAttribute(Qt::WA_NoSystemBackground);
        widget.resize(100,100);
        QLabel* lable = new QLabel(&widget);
        lable->setStyleSheet("color:blue");
        lable->setText("1111111");
        QPushButton button("button",&widget);
        QVBoxLayout v;
        v.addWidget(lable);
        v.addWidget(&button);
        widget.setLayout(&v);
        QObject::connect(&button,&QPushButton::clicked,[=]()
        {
            lable->setText("222222222");
        });
        widget.show();
        return a.exec();
    }
    

    0_1504488050684_1504283236_331319.png

    [Added code tags ~kshegunov]

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

      Hi,

      What is your question ?

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

      hello qterH 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What is your question ?

        hello qterH Offline
        hello qterH Offline
        hello qter
        wrote on last edited by
        #3

        @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

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

          What issues do you have that requires that attribute set ?

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

          hello qterH 1 Reply Last reply
          0
          • SGaistS SGaist

            What issues do you have that requires that attribute set ?

            hello qterH Offline
            hello qterH Offline
            hello qter
            wrote on last edited by
            #5

            @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

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

              Did you try to track the reason of the flickering ?

              What else are you doing that could trigger that ?

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

              hello qterH 1 Reply Last reply
              0
              • SGaistS SGaist

                Did you try to track the reason of the flickering ?

                What else are you doing that could trigger that ?

                hello qterH Offline
                hello qterH Offline
                hello qter
                wrote on last edited by
                #7

                @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

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

                  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 ?

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

                  hello qterH 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    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 ?

                    hello qterH Offline
                    hello qterH Offline
                    hello qter
                    wrote on last edited by
                    #9

                    @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->setAttribute(Qt::WA_NoSystemBackground)
                    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

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

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

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

                      hello qterH 1 Reply Last reply
                      0
                      • SGaistS SGaist

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

                        hello qterH Offline
                        hello qterH Offline
                        hello qter
                        wrote on last edited by
                        #11

                        @SGaist Yes,it support OpenGL

                        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