From f20e471e275428d38f222e278327d3b870ce990f 2012-09-05 07:49:24 From: Michal Klocek Date: 2012-09-05 07:49:24 Subject: [PATCH] Fix layouting in mapviewer --- diff --git a/demos/chartviewer/window.cpp b/demos/chartviewer/window.cpp index 09666ea..dcd496b 100644 --- a/demos/chartviewer/window.cpp +++ b/demos/chartviewer/window.cpp @@ -65,8 +65,6 @@ Window::Window(QWidget* parent) : m_template(0) { createProxyWidgets(); - connectSignals(); - // create layout QGraphicsLinearLayout *settingsLayout = new QGraphicsLinearLayout(); settingsLayout->setOrientation(Qt::Vertical); @@ -109,12 +107,14 @@ Window::Window(QWidget* parent) : m_rubberBand->setVisible(false); m_view = new View(m_scene, m_form); - m_view->setMinimumSize(m_form->preferredSize().toSize()); + m_view->setMinimumSize(m_form->minimumSize().toSize()); // Set defaults m_antialiasCheckBox->setChecked(true); updateUI(); setCentralWidget(m_view); + + connectSignals(); } Window::~Window() @@ -123,6 +123,7 @@ Window::~Window() void Window::connectSignals() { + QObject::connect(m_form, SIGNAL(geometryChanged()),this ,SLOT(handleGeometryChanged())); QObject::connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); QObject::connect(m_antialiasCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateUI())); QObject::connect(m_openGLCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateUI())); @@ -581,3 +582,8 @@ QAction* Window::createMenuAction(QMenu *menu, const QIcon &icon, const QString action->setData(data); return action; } + +void Window::handleGeometryChanged() +{ + m_view->scene()->setSceneRect(0, 0, this->width(), this->height()); +} diff --git a/demos/chartviewer/window.h b/demos/chartviewer/window.h index 74f96c2..83817d0 100644 --- a/demos/chartviewer/window.h +++ b/demos/chartviewer/window.h @@ -51,6 +51,7 @@ public: private Q_SLOTS: void updateUI(); + void handleGeometryChanged(); private: QComboBox* createThemeBox(); QComboBox* createAnimationBox();