A
A
Artem2014-11-12 18:39:53
Qt
Artem, 2014-11-12 18:39:53

How to solve background layering problem in QLabel?

Hello. Task: place images with transparent background (ARGB32) on QLabel. The Label itself must be transparent.
Here is a piece of code that describes my method for solving this problem:

QWidget root;
root.setStyleSheet("background:transparent;");
QLabel label(&root);

QImage img((uchar*)bitmap, w, h, QImage::Format_ARGB32);
label.setPixmap(QPixmap::fromImage(img));

The problem is that with frequent redrawing artifacts appear, the previous image remains the background of the next one.
ps with pointers to the buffer, everything is ok, everything is cleared and allocated normally, no one except this widget uses it!
How can I force clear the entire contents of the widget? Or maybe I'm not placing the image on the widget correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TriKrista, 2014-11-12
@TriKrista

Try QLabel::repaint()

D
DancingOnWater, 2014-11-12
@DancingOnWater

Most likely the problems of the window manager that updated only part of the screen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question