Unsolved QPainter not working on Android
-
Hello,
I needed to write a little and simple test app. Wrote the 200 line app and tested on Windows and everything is fine. I compiled it for android and noticed that it ignores completly my QPainter calls. Code:
void MainWindow::paintEvent(QPaintEvent *event) { qDebug() << "Paint, imp "<<imagePos; QPainter p(this); if(imagePos != currentImage.width())p.drawImage(0,0,currentImage,imagePos,0,currentImage.width()-imagePos); if(imagePos != 0)p.drawImage(currentImage.width()-imagePos,0,currentImage,0,0,imagePos); p.end(); }
the Output is written on the Console, but the widget is not drawn. Works flawless on Windows...
Any help?
Also tried setting autoFillBackground but nothing
-
Hi,
What are the values of imagePos ? currentImage ? Where does currentImage come from ?
-
I guess your MainWindow is derived from QMainWindow...
AFAIK this may be expected behaviour, though the behaviour depends on the platform and possibly other things. QMainWindow is not supposed to be painted on directly. You should paint on a child widget.
...By googling about it you should have noticed that you are not among the first to ask about this...