widget with Qt::WA_NoSystemBackground attribute make text coincides with previous text
-
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(); }
[Added code tags ~kshegunov]
-
Hi,
What is your question ?
-
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 -
Did you try to track the reason of the flickering ?
What else are you doing that could trigger that ?
-
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->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 -
Did you check that your embedded system has proper OpenGL support ?