multiple resize callbacks on QWindow when user drags corner
-
When debugging an overriden resizeEvent for a QWindow derived class, if you drag a corner of the screen, it emits two resize events. If I maximize or minimize from the bar, its only one resize event. Any way to make it only one?
The values are also very odd. For the first resize event the dimensions for dragging down from the top on width() and height are 1920x1079. The second resize event dimensions are 1920x1080.
Edit* It sends two events, with one actually decreasing height by 1 pixel, then the second event has the same dimensions as the old. So it goes down by one pixel and back up.
Are there any extraneous events that can trigger multiple resize events?
void window::resizeEvent(QResizeEvent* ev) {
const int w = width();
const int h = height();
}This is kind of an issue for me since recreating the graphics canvas twice is not performant.
-
Don't redraw on a resize event but use a QTimer so you repaint only when e.g. the size did not change for 50ms or so.