QGraphicsView fitInView doesn't do anything on restore (down)
-
Hello, I'm having a problem with QGraphicsView.
I'm resizing an image on resize, but when I restore (down) the window, it keeps, and doesn't do anything:
I have to resize it to go back to normal.
Here's what I'm doing:ui->graphicsView_LeftHand->fitInView(svgLeft, Qt::KeepAspectRatio);
-
Hi,
When are you doing that call ?
Can you share your code ? -
How do you do your restore ?
-
Silly question, did you check that resizeEvent is properly called when you click the restore button ?
-
Silly question, did you check that resizeEvent is properly called when you click the restore button ?
-
Which version of Qt are you using ?
On which version of Windows ?
Can you provide a minimal compilable example that shows this behaviour ? -
Which version of Qt are you using ?
On which version of Windows ?
Can you provide a minimal compilable example that shows this behaviour ? -
Just for the sake of testing, what happens if you trigger a single shot QTimer in the resizeEvent to trigger the fitInView ?
-
Just for the sake of testing, what happens if you trigger a single shot QTimer in the resizeEvent to trigger the fitInView ?
Hi @SGaist, not sure what you meant by that, but I've got this:
QTimer timer; timer.singleShot(1000, this, SLOT(QResizeEvent)); ui->graphicsView_LeftHand->fitInView(svgLeft, Qt::KeepAspectRatio);
And it prints:
QObject::connect: Parentheses expected, slot MainWindow::QResizeEvent QObject::connect: (receiver name: 'MainWindow')
-
Hi @SGaist, not sure what you meant by that, but I've got this:
QTimer timer; timer.singleShot(1000, this, SLOT(QResizeEvent)); ui->graphicsView_LeftHand->fitInView(svgLeft, Qt::KeepAspectRatio);
And it prints:
QObject::connect: Parentheses expected, slot MainWindow::QResizeEvent QObject::connect: (receiver name: 'MainWindow')
-
-
-
QTimer::singleShot is a static function so there's no need to create an instance for it.