[LyX/master] Adjust code preview spacing

Juergen Spitzmueller spitz at lyx.org
Sun Feb 28 12:07:22 UTC 2021


commit 11548c523aedddfc6f43798c65b6362b6ede8949
Author: Daniel Ramoeller <d.lyx at web.de>
Date:   Sat Feb 20 15:40:17 2021 +0100

    Adjust code preview spacing
    
    Partial fix of bug #12152.
---
 src/frontends/qt/GuiViewSource.cpp  |    2 +-
 src/frontends/qt/ui/ViewSourceUi.ui |  152 +++++++++++++++++++----------------
 2 files changed, 82 insertions(+), 72 deletions(-)

diff --git a/src/frontends/qt/GuiViewSource.cpp b/src/frontends/qt/GuiViewSource.cpp
index 310d24e..f83e020 100644
--- a/src/frontends/qt/GuiViewSource.cpp
+++ b/src/frontends/qt/GuiViewSource.cpp
@@ -359,7 +359,7 @@ void ViewSourceWidget::updateDefaultFormat(BufferView const & bv)
 
 void ViewSourceWidget::resizeEvent (QResizeEvent * event)
 {
-	QSize const & formSize = formLayout->sizeHint();
+	QSize const & formSize = gridLayout->sizeHint();
 	// minimize the size of the part that contains the buttons
 	if (width() * formSize.height() < height() * formSize.width()) {
 		layout_->setDirection(QBoxLayout::TopToBottom);
diff --git a/src/frontends/qt/ui/ViewSourceUi.ui b/src/frontends/qt/ui/ViewSourceUi.ui
index c18b284..bd4ddef 100644
--- a/src/frontends/qt/ui/ViewSourceUi.ui
+++ b/src/frontends/qt/ui/ViewSourceUi.ui
@@ -20,14 +20,26 @@
    <string/>
   </property>
   <layout class="QGridLayout" name="gridLayout_2">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
    <property name="topMargin">
-    <number>3</number>
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
    </property>
    <property name="bottomMargin">
-    <number>3</number>
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>0</number>
    </property>
    <item row="0" column="0">
     <layout class="QHBoxLayout" name="layout_" stretch="1,0">
+     <property name="spacing">
+      <number>0</number>
+     </property>
      <property name="sizeConstraint">
       <enum>QLayout::SetMaximumSize</enum>
      </property>
@@ -57,81 +69,46 @@
       </widget>
      </item>
      <item>
-      <layout class="QFormLayout" name="formLayout">
-       <property name="sizeConstraint">
-        <enum>QLayout::SetDefaultConstraint</enum>
+      <layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
+       <property name="leftMargin">
+        <number>6</number>
        </property>
-       <property name="fieldGrowthPolicy">
-        <enum>QFormLayout::ExpandingFieldsGrow</enum>
+       <property name="topMargin">
+        <number>6</number>
        </property>
-       <property name="labelAlignment">
-        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+       <property name="rightMargin">
+        <number>6</number>
        </property>
-       <property name="horizontalSpacing">
+       <property name="bottomMargin">
         <number>6</number>
        </property>
-       <property name="verticalSpacing">
-        <number>4</number>
+       <property name="spacing">
+        <number>6</number>
        </property>
        <item row="0" column="0">
-        <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
-         <property name="spacing">
-          <number>3</number>
-         </property>
-         <property name="sizeConstraint">
-          <enum>QLayout::SetMinAndMaxSize</enum>
+        <widget class="QLabel" name="outputFormatLA">
+         <property name="text">
+          <string>F&ormat:</string>
          </property>
-         <property name="bottomMargin">
-          <number>3</number>
+         <property name="buddy">
+          <cstring>outputFormatCO</cstring>
          </property>
-         <item>
-          <widget class="QLabel" name="outputFormatLA">
-           <property name="text">
-            <string>F&ormat:</string>
-           </property>
-           <property name="buddy">
-            <cstring>outputFormatCO</cstring>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QComboBox" name="outputFormatCO">
-           <property name="enabled">
-            <bool>true</bool>
-           </property>
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="toolTip">
-            <string>Select the output format</string>
-           </property>
-           <property name="sizeAdjustPolicy">
-            <enum>QComboBox::AdjustToContents</enum>
-           </property>
-          </widget>
-         </item>
-        </layout>
+        </widget>
        </item>
-       <item row="2" column="0">
-        <widget class="QCheckBox" name="masterPerspectiveCB">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
+       <item row="5" column="0" colspan="2">
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
          </property>
-         <property name="toolTip">
-          <string>Show the source as the master document gets it</string>
-         </property>
-         <property name="text">
-          <string>Master's perspective</string>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
          </property>
-        </widget>
+        </spacer>
        </item>
-       <item row="3" column="0">
+       <item row="3" column="0" colspan="2">
         <widget class="QCheckBox" name="autoUpdateCB">
          <property name="text">
           <string>Automatic update</string>
@@ -141,13 +118,19 @@
          </property>
         </widget>
        </item>
-       <item row="4" column="0" colspan="2">
-        <widget class="QPushButton" name="updatePB">
-         <property name="enabled">
-          <bool>false</bool>
+       <item row="2" column="0" colspan="2">
+        <widget class="QCheckBox" name="masterPerspectiveCB">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="toolTip">
+          <string>Show the source as the master document gets it</string>
          </property>
          <property name="text">
-          <string>&Update</string>
+          <string>Master's perspective</string>
          </property>
         </widget>
        </item>
@@ -181,6 +164,35 @@
          </item>
         </widget>
        </item>
+       <item row="4" column="0" colspan="2">
+        <widget class="QPushButton" name="updatePB">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="text">
+          <string>&Update</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QComboBox" name="outputFormatCO">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="toolTip">
+          <string>Select the output format</string>
+         </property>
+         <property name="sizeAdjustPolicy">
+          <enum>QComboBox::AdjustToContents</enum>
+         </property>
+        </widget>
+       </item>
       </layout>
      </item>
     </layout>
@@ -189,8 +201,6 @@
  </widget>
  <tabstops>
   <tabstop>viewSourceTV</tabstop>
-  <tabstop>autoUpdateCB</tabstop>
-  <tabstop>updatePB</tabstop>
  </tabstops>
  <includes>
   <include location="local">qt_i18n.h</include>


More information about the lyx-cvs mailing list