Hi,
Here are the files:
The UI window that holds the child widget:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>documentWindow</class>
<widget class="QMainWindow" name="documentWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>517</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>documentWindow</class>
<widget class="QMainWindow" name="documentWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>517</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
To copy to clipboard, switch view to plain text mode
Abstract of the child widget. I use layouts for some if its widgets but the child widget itself does not have a layout.
See image here:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>countries</class>
<widget class="QWidget" name="countries">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>250</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<widget class="QLabel" name="Panel2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>11</x>
<y>32</y>
<width>567</width>
<height>3</height>
</rect>
</property>
<property name="toolTip">
<string/>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>16</x>
<y>48</y>
<width>300</width>
<height>180</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
.....
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>countries</class>
<widget class="QWidget" name="countries">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>250</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<widget class="QLabel" name="Panel2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>11</x>
<y>32</y>
<width>567</width>
<height>3</height>
</rect>
</property>
<property name="toolTip">
<string/>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>16</x>
<y>48</y>
<width>300</width>
<height>180</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
.....
To copy to clipboard, switch view to plain text mode
Thanks.
Added after 39 minutes:
Even if I set size max and min to the child item and copying that to the container window. The window starts very small
child->setCentralWidget(cnt);
child->show();
child->setGeometry(cnt->geometry());
child->setMaximumSize(cnt->maximumSize());
child->setMinimumSize(cnt->minimumSize());
child->setCentralWidget(cnt);
child->show();
child->setGeometry(cnt->geometry());
child->setMaximumSize(cnt->maximumSize());
child->setMinimumSize(cnt->minimumSize());
To copy to clipboard, switch view to plain text mode
But when I try to expand it does it automatic to the min size... However there is a refresh error where the content of the tableview does not show properly.
Bookmarks