View Single Post
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#7
Here are the initializing bits:

1) mainwindow.ui (relevant part only)
Code:
      <item>
       <widget class="QScrollArea" name="scrollArea">
        <property name="widgetResizable">
         <bool>true</bool>
        </property>
       </widget>
      </item>
2) mainwindow.h (simplified)
Code:
#include "stackedmainwindow.h"
#include "ui_mainwindow.h"
#include "preview.h"

class MainWindow : public StackedMainWindow
{
  Q_OBJECT

public:
  explicit MainWindow (QWidget *parent = 0);

private slots:
  void on_buttonZoomHome_clicked ();
  void on_buttonZoomIn_clicked ();
  void on_buttonZoomOut_clicked ();

private:
  Ui::MainWindow ui;
  Preview preview;
  double scaleFactor;
};
3) mainwindow.cpp (simplified)
Code:
MainWindow::MainWindow (QWidget *parent)
  : StackedMainWindow(parent)
  , preview(this)
  , scaleFactor(1.0)
{
  ui.setupUi(this);
  ui.scrollArea->setWidget(&preview);
}
I will try replacing QGLWidget with QWidget. It might be a QGLWidget problem after all, not QScrollArea one. In the meantime, I made another experiment with the only thing changed is reducing the scale factor from 1.5 to 1.25. The result...

w=668, h=424
w=835, h=416
w=1043, h=416
w=1043, h=416
w=1304, h=416
w=1630, h=416
w=2038, h=416
w=2548, h=416, crash!

So it does seem to be size related.
 

The Following 2 Users Say Thank You to pichlo For This Useful Post: