From 3bfab9c2c9068cccd13a9caab7c3ad1fa146be57 Mon Sep 17 00:00:00 2001 From: pi03k Date: Mon, 1 Feb 2016 12:39:24 +0100 Subject: [PATCH] extracted creation of scroll area to separate method --- apps/opencs/view/doc/view.cpp | 18 ++++++++++-------- apps/opencs/view/doc/view.hpp | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index e606ff36d..ff5257486 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -419,10 +419,7 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to } else { - mScroll = new QScrollArea(this); - mScroll->setWidgetResizable(true); - mScroll->setWidget(&mSubViewWindow); - setCentralWidget(mScroll); + createScrollArea(); } mOperations = new Operations; @@ -626,10 +623,7 @@ void CSVDoc::View::settingChanged (const CSMPrefs::Setting *setting) } else { - mScroll = new QScrollArea(this); - mScroll->setWidgetResizable(true); - mScroll->setWidget(&mSubViewWindow); - setCentralWidget(mScroll); + createScrollArea(); } } else if (mScroll) @@ -964,3 +958,11 @@ void CSVDoc::View::updateWidth(bool isGrowLimit, int minSubViewWidth) } } } + +void CSVDoc::View::createScrollArea() +{ + mScroll = new QScrollArea(this); + mScroll->setWidgetResizable(true); + mScroll->setWidget(&mSubViewWindow); + setCentralWidget(mScroll); +} diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index 835702e41..d95499191 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -96,6 +96,7 @@ namespace CSVDoc void updateScrollbar(); void updateWidth(bool isGrowLimit, int minSubViewWidth); + void createScrollArea(); public: View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews);