<item> <widget class="QScrollArea" name="scrollArea"> <property name="widgetResizable"> <bool>true</bool> </property> </widget> </item>
#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; };
MainWindow::MainWindow (QWidget *parent) : StackedMainWindow(parent) , preview(this) , scaleFactor(1.0) { ui.setupUi(this); ui.scrollArea->setWidget(&preview); }