QT4 Designer - not able to adjust top level QScroll Area to screen Size



  • Hello

    I am working with QT4 designer to create my UI. Today I spent some hours in making the fixed WYSIWYG UI adjustable to screen resolution.

    Here a scheme of my UI:
    @
    QMainWindow (Name PCLViewer)
    |----QWidget(name centralwidget)
    |-----------QScrollArea(name scrollarea)
    |----QWidget(name scrollAreaWidgetContents)
    |--------all UI elemtens wrapped in a QFrame with fixed min, max and preferred size
    @
    I am just not able to make the size of my scollarea ajusted to the screen size. My main window goes to full screen, ofc without problems. I am kind of guessing that centralwidget does adjust the size too. Next Level is the scrollarea then. This one has an added Layout (needed to show up scroll bars.) Its size yet is always the size I hardcoded as preferred size.

    Here is the UI without any Content other than the Wrap QFrame:
    @
    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
    <class>PCLViewer</class>
    <widget class="QMainWindow" name="PCLViewer">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>1110</width>
    <height>759</height>
    </rect>
    </property>
    <property name="minimumSize">
    <size>
    <width>0</width>
    <height>0</height>
    </size>
    </property>
    <property name="maximumSize">
    <size>
    <width>5000</width>
    <height>5000</height>
    </size>
    </property>
    <property name="windowTitle">
    <string>PCLViewer</string>
    </property>
    <widget class="QWidget" name="centralwidget">
    <property name="palette">
    <palette>
    <active>
    <colorrole role="ToolTipBase">
    <brush brushstyle="SolidPattern">
    <color alpha="255">
    <red>0</red>
    <green>0</green>
    <blue>0</blue>
    </color>
    </brush>
    </colorrole>
    </active>
    <inactive>
    <colorrole role="ToolTipBase">
    <brush brushstyle="SolidPattern">
    <color alpha="255">
    <red>0</red>
    <green>0</green>
    <blue>0</blue>
    </color>
    </brush>
    </colorrole>
    </inactive>
    <disabled>
    <colorrole role="ToolTipBase">
    <brush brushstyle="SolidPattern">
    <color alpha="255">
    <red>0</red>
    <green>0</green>
    <blue>0</blue>
    </color>
    </brush>
    </colorrole>
    </disabled>
    </palette>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_2">
    <property name="sizeConstraint">
    <enum>QLayout::SetMaximumSize</enum>
    </property>
    <item>
    <widget class="QScrollArea" name="scrollArea">
    <property name="enabled">
    <bool>true</bool>
    </property>
    <property name="sizePolicy">
    <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
    <horstretch>0</horstretch>
    <verstretch>0</verstretch>
    </sizepolicy>
    </property>
    <property name="widgetResizable">
    <bool>true</bool>
    </property>
    <widget class="QWidget" name="scrollAreaWidgetContents">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>1918</width>
    <height>1198</height>
    </rect>
    </property>
    <property name="sizePolicy">
    <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
    <horstretch>0</horstretch>
    <verstretch>0</verstretch>
    </sizepolicy>
    </property>
    <property name="minimumSize">
    <size>
    <width>1918</width>
    <height>1198</height>
    </size>
    </property>
    <property name="maximumSize">
    <size>
    <width>1918</width>
    <height>1198</height>
    </size>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout">
    <property name="spacing">
    <number>0</number>
    </property>
    <property name="bottomMargin">
    <number>0</number>
    </property>
    <item>
    <widget class="QFrame" name="main_frame">
    <property name="sizePolicy">
    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
    <horstretch>0</horstretch>
    <verstretch>0</verstretch>
    </sizepolicy>
    </property>
    <property name="minimumSize">
    <size>
    <width>1920</width>
    <height>1080</height>
    </size>
    </property>
    <property name="maximumSize">
    <size>
    <width>1920</width>
    <height>1080</height>
    </size>
    </property>
    <property name="frameShape">
    <enum>QFrame::StyledPanel</enum>
    </property>
    <property name="frameShadow">
    <enum>QFrame::Raised</enum>
    </property>
    </widget>
    </item>
    </layout>
    </widget>
    </widget>
    </item>
    </layout>
    </widget>
    </widget>
    <resources/>
    <connections/>
    </ui>
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.