Permalink
Browse files

Removed redundant, nested QVBoxLayout controls

  • Loading branch information...
1 parent f4a0613 commit f26b82e1722a3d2da584f8a2a8b57bf32f32795b @PKEuS PKEuS committed Oct 14, 2012
Showing with 113 additions and 121 deletions.
  1. +76 −80 gui/projectfile.ui
  2. +37 −41 gui/resultsview.ui
View
@@ -25,107 +25,103 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
- <layout class="QVBoxLayout" name="verticalLayout_6">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Defines:</string>
+ </property>
+ <property name="buddy">
+ <cstring>mEditDefines</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="mEditDefines"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Root:</string>
+ </property>
+ <property name="buddy">
+ <cstring>mEditProjectRoot</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="mEditProjectRoot"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
<item>
- <widget class="QLabel" name="label_2">
+ <widget class="QLabel" name="label_3">
<property name="text">
- <string>Defines:</string>
- </property>
- <property name="buddy">
- <cstring>mEditDefines</cstring>
+ <string>Paths:</string>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="mEditDefines"/>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
</item>
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <widget class="QListWidget" name="mListPaths"/>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QLabel" name="label_4">
+ <widget class="QPushButton" name="mBtnAddPath">
<property name="text">
- <string>Root:</string>
- </property>
- <property name="buddy">
- <cstring>mEditProjectRoot</cstring>
+ <string>Add...</string>
</property>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="mEditProjectRoot"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Paths:</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
+ <widget class="QPushButton" name="mBtnEditPath">
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QListWidget" name="mListPaths"/>
+ <widget class="QPushButton" name="mBtnRemovePath">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
</item>
<item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QPushButton" name="mBtnAddPath">
- <property name="text">
- <string>Add...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="mBtnEditPath">
- <property name="text">
- <string>Edit</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="mBtnRemovePath">
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
</item>
</layout>
</item>
View
@@ -30,47 +30,43 @@
<number>0</number>
</property>
<item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QProgressBar" name="mProgress">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="value">
- <number>24</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSplitter" name="mVerticalSplitter">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <widget class="ResultsTree" name="mTree">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- </widget>
- <widget class="QTextEdit" name="mDetails">
- <property name="undoRedoEnabled">
- <bool>false</bool>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </widget>
- </item>
- </layout>
+ <widget class="QProgressBar" name="mProgress">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSplitter" name="mVerticalSplitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="ResultsTree" name="mTree">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ </widget>
+ <widget class="QTextEdit" name="mDetails">
+ <property name="undoRedoEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
</item>
</layout>
</widget>

7 comments on commit f26b82e

@kimmov
Contributor
kimmov commented on f26b82e Oct 16, 2012

Somebody forgot to read the Qt layouts tutorial.

@PKEuS
Collaborator
PKEuS commented on f26b82e Oct 16, 2012

Well, I read the QHBoxLayout and QVBoxLayout documentation before I committed this, not the tutorial. However, after reading the tutorial, it didn't became obvious what you are complaining about. Yes, the tutorial explicitly says, that you can nest Layouts (which was already obvious to me) - but not any special effects if you nest two of the same type. So, its like putting a grid with one row into another one - which has besides from margin no other effect than just adding a few rows to the outer grid.
Nesting two Layouts of different Types (like QHBox and QVBox) can of course not be simplified this way.

Can you please explain your point?

@kimmov
Contributor
kimmov commented on f26b82e Oct 16, 2012

You need to have a root layout. Simplest examples start with it.

@kimmov
Contributor
kimmov commented on f26b82e Oct 16, 2012

Unfortunately there is no shortcut to learning how Qt layouts work - you need read plenty of documentation and do some excercises to see it in action. And remember different platforms and styles etc. Buying a good book and reading it helps too.

@PKEuS
Collaborator
PKEuS commented on f26b82e Oct 16, 2012

If a root layout means that the first element in each form has to be a layout control (I wasn't able to find information about "root layout" in Qt) - then this is still the case.

However, I didn't noticed any visible change neither in Qt UI Designer nor when running it on Win 7. I also didn't noticed complaints from UI Compiler.

@danmar
Owner
danmar commented on f26b82e Oct 17, 2012

Sorry.. I don't see the problem neither.

@lioncash
Contributor

Just to provide some input, it seems to work fine on both Win 7 and Ubuntu 12.04 on my PC for me.

Please sign in to comment.