diff --git a/retroshare-gui/src/gui/mainpagestack.cpp b/retroshare-gui/src/gui/mainpagestack.cpp index 778a446ac..6e9124d62 100644 --- a/retroshare-gui/src/gui/mainpagestack.cpp +++ b/retroshare-gui/src/gui/mainpagestack.cpp @@ -20,6 +20,26 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ +/* ccr . 2015 Aug 01 . Resize Main page and Main window. + * + * On very small legacy CRTs of about 15" (38 cm) RetroShare pages are + * initially too deep (too tall) to fit the screen at 1024x768 + * resolution. Some can be shrunk down manually from their initial + * size. Others cannot. This patch tries to allow each page to be + * shrunk somewhat. Then code that runs elsewhere to fit the logical + * Main window into the physical screen will have a better chance of + * success. Notably, on Linux -- Gnome3 -- X11 systems, only when the + * Main window first fits entirely into the physical screen, can it + * then be maximized. + * + * This code is borrowed from a Stack Overflow post: + * + * o Darkgaze. "Resize QStackedWidget to the Page Which Is Opened." 23 + * Jan. 2013. Online posting. Stack Overflow. 1 Aug. 2015 + * . + * + */ + #include #include "mainpagestack.h" @@ -34,6 +54,7 @@ void MainPageStack::add(MainPage *page, QAction *action) { _pages.insert(action, page); + page->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); /* 2015 Aug 01 */ insertWidget(count(), page); } @@ -61,3 +82,14 @@ MainPageStack::showPage(QAction *pageAction) setCurrentWidget(_pages.value(pageAction)); } +/** Adjusts the size of the Main page and the Main window. */ +void +MainPageStack::onCurrentChanged(int index) /* 2015 Aug 01 */ +{ + QWidget* pWidget = widget(index); + Q_ASSERT(pWidget); + pWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + pWidget->adjustSize(); + adjustSize(); +} + diff --git a/retroshare-gui/src/gui/mainpagestack.h b/retroshare-gui/src/gui/mainpagestack.h index 53988f50e..ca8aa50f9 100644 --- a/retroshare-gui/src/gui/mainpagestack.h +++ b/retroshare-gui/src/gui/mainpagestack.h @@ -50,6 +50,8 @@ public: public slots: /** Displays the page associated with the activated action. */ void showPage(QAction *pageAction); + /** Adjusts the size of the Main page and the Main window. */ + void onCurrentChanged(int index); private: /** Maps an action to a Main page. */