Resize flicking on QMainWindow centralWidget in python but not C++

Patrick Stinson <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
Hello,

On MacOS, a QMainWindow with a simple painted centralWidget flickers when resizing quickly in python but not in C++. This only occurs with QMainWindow It is particularly pronounced more complex widgets, as shown in the following video:

https://youtu.be/0Qjy2wm6m9M <https://youtu.be/0Qjy2wm6m9M>

Here is the python example that shows the bug. Just run, rapidly resize the height of the widget , and observe a black flickering on the top edge of the widget as the height changes.

class Widget(QOpenGLWidget):
    def paintEvent(self, e):
        p = QPainter(self)
        p.setBrush(Qt.red)
        p.drawRect(self.rect())

app = QApplication(sys.argv)
mw = QMainWindow()
w = Widget()
mw.setCentralWidget(w)
mw.show()
w.show()
app.exec()


The following 1-to-1 C++ translation shows no such behavior:


#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QPainter>

class Widget : public QWidget {
public:
    void paintEvent(QPaintEvent *) {
        QPainter p(this);
        p.setBrush(Qt::red);
        p.drawRect(rect());
    }
};

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QMainWindow mw;
    QWidget *w = new Widget;
    mw.setCentralWidget(w);
    mw.show();
    return a.exec();
}

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.