View Issue Details

IDProjectCategoryView StatusLast Update
0017304ScribusGeneralpublic2024-11-21 11:49
Reporterale Assigned Tonitramr  
PrioritynormalSeverityfeatureReproducibilityN/A
Status assignedResolutionopen 
Product Version1.7.0.svn 
Target Version1.7.0 
Summary0017304: spacing in the new document dialog
Descriptioni finally got some time to update my scribus and i generally liked the changes to the UI.

and i like the feeling of the new document page.

there are a two small bugs that might depend on my setup:

- in my setup the right panel has an horizontal scrollbar that does not really make a difference (the margins and bleeds are slightly to wide to fit the current width)
- while its default size is fine, the dialog should resizable and the new size be stored in the settings.
  i think that many people would like to keep the first four sections open.

i attach a screenshot of my dialog as it is now.
i wonder if it would be easy to make the dialog / the right pane slightly wider and make it resizable.

i also have some wishes on some details that could be discussed:

- for the width and height, i would prefer a W and H in front of the input field, in the same way as we have the in the properties palette
- generally speaking, in the document section, the labels below the input fields seems to airy compared to the layout of the other sections.
- i would at least remove them if the user has "Hide Informationals Labels" checked in the preferences. they might be replaced by short labels in front of the fields (if any: the only fields that is not obvious to me without icons is the "number of the pages" which is not optimally labeled anyway).
- i'd prefer the single / double pages as two mutually exclusive push buttons: the current icon is not "perfect" but together with the tooltip it should be easy enough to understand their meaning
- i would remove the sorting options at the top right of the left panel: the ISO-sizes are well named and will be sorted correctly anyway. i'm not sure that the other sizes can be sorted in a meaningful way: the choice will probably always be among a few options of the same "family".
  if the sorting needs to be kept: the dropdown seems out of balance in my eyes... i would rather use three buttons: [name] [size] [up/down] (where the first two are icons and mutually exclusive and the third changes icon when it's pushed)

as said these are small details, not fundamental flaws.
TagsNo tags attached.
PatchYes

Activities

ale

2024-11-07 15:21

manager  

new-document.png (36,066 bytes)   
new-document.png (36,066 bytes)   

ale

2024-11-07 15:52

manager   ~0051537

and here is an (extreme) proposal for compacting the "Document" section...

feel free to get inspiration from some of the changes proposed...

ale

2024-11-07 15:53

manager   ~0051538

Last edited: 2024-11-07 15:55

... somehow, the image does not want to attach itself...

the second line is a bit busy in this proposal... but it would be much faster to use for me...
(and without an icon for the number of pages it would fit more nicely...)
new-document-compact.png (27,886 bytes)   
new-document-compact.png (27,886 bytes)   

nitramr

2024-11-20 19:09

developer   ~0051609

Last edited: 2024-11-20 19:10

Ok, this scrollbar thing was really a nasty bug.

Problem: On dialog startup, the scroll area width based on the content width. But when a user change in example the unit, the input field width changes and you get a horizontal scrollbar.
Fix: I installed an event filter to adjust the scroll container size in case the content size changes.

In addition, I optimized the UI a little based on ale's proposals. And the small labels are hidden if user changed it in app preferences.
newdocdialog_2024-11-20_01.patch (3,480 bytes)   
Index: scribus/ui/newdocdialog.cpp
===================================================================
--- scribus/ui/newdocdialog.cpp	(Revision 26436)
+++ scribus/ui/newdocdialog.cpp	(Arbeitskopie)
@@ -60,6 +60,7 @@
 
 	IconManager &iconManager = IconManager::instance();
 
+	m_labelVisibity = !prefsManager.appPrefs.uiPrefs.hideLabels;
 	m_unitIndex = prefsManager.appPrefs.docSetupPrefs.docUnitIndex;
 	m_unitRatio = unitGetRatioFromIndex(m_unitIndex);
 	m_unitSuffix = unitGetSuffixFromIndex(m_unitIndex);
@@ -191,6 +192,9 @@
 	pageCountSpinBox->setMaximum( 10000 );
 	pageCountSpinBox->setMinimum( 1 );
 
+	IconManager &iconManager = IconManager::instance();
+	pageCountLabel->setPixmap(iconManager.loadPixmap("panel-page"));
+
 	pageLayouts->updateSchemeSelector(prefsManager.appPrefs.pageSets, prefsManager.appPrefs.pageSets[pagePositioning].FirstPage);
 
 	setDocLayout(pagePositioning);
@@ -234,12 +238,16 @@
 	sectionTextFrame->setCanSaveState(true);
 	sectionTextFrame->restorePreferences();
 
-	// We have to calculate the width of the properties panel manually,
-	// because QSizePolicy::Minimum doesn't work as expected
+	labelColumns->setLabelVisibility(m_labelVisibity);
+	labelGap->setLabelVisibility(m_labelVisibity);
+	pageCountLabel->setLabelVisibility(m_labelVisibity);
+	orientationLabel->setLabelVisibility(m_labelVisibity);
+	pageLayouts->toggleLabelVisibility(m_labelVisibity);
+
+	// We have to install an event filter to resize the scroll container width based on the content width.
+	// The content width can change after we calculated the initial ui layout.
+	scrollAreaWidgetContents->installEventFilter(this);
 	scrollAreaWidgetContents->adjustSize();
-	//scrollAreaWidgetContents->setFixedWidth(scrollAreaWidgetContents->width());
-	scrollArea->setWidgetResizable(true);
-	scrollArea->setFixedWidth(scrollAreaWidgetContents->width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent));
 
 }
 
@@ -330,6 +338,7 @@
 		QSignalBlocker sigFormats(listPageFormats);
 		listPageFormats->setOrientation(m_orientation);
 	}
+
 }
 
 void NewDocDialog::setHeight(double)
@@ -405,6 +414,17 @@
 	}
 }
 
+bool NewDocDialog::eventFilter(QObject *object, QEvent *event)
+{
+	if (object->objectName() == "scrollAreaWidgetContents" && event->type() == QEvent::Resize)
+	{
+		int currentWidth = scrollArea->minimumWidth();
+		scrollArea->setMinimumWidth(qMax(scrollAreaWidgetContents->sizeHint().width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent), currentWidth));
+		return true;
+	}
+	return false;
+}
+
 void NewDocDialog::handleAutoFrame()
 {
 	bool setter = autoTextFrame->isChecked();
@@ -439,6 +459,8 @@
 	bleedGroup->setPageWidth(m_pageWidth);
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
+
+
 }
 
 void NewDocDialog::ExitOK()
@@ -523,6 +545,7 @@
 
 	marginGroup->setPageSize(size);
 	bleedGroup->setPageSize(size);
+
 }
 
 void NewDocDialog::setSize(const QString& gr)
Index: scribus/ui/newdocdialog.h
===================================================================
--- scribus/ui/newdocdialog.h	(Revision 26436)
+++ scribus/ui/newdocdialog.h	(Arbeitskopie)
@@ -137,8 +137,10 @@
 	double m_bleedTop { 0.0 };
 	double m_bleedLeft { 0.0 };
 	double m_bleedRight { 0.0 };
+	bool m_labelVisibity {true};
 
 	void windowFitInScreen();
+	bool eventFilter(QObject *object, QEvent *event);
 };
 
 #endif // NEWDOC_H
newdocdialog.ui (29,700 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>newDocDialog</class>
 <widget class="QDialog" name="newDocDialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>900</width>
    <height>650</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Dialog</string>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout">
   <property name="spacing">
    <number>4</number>
   </property>
   <property name="leftMargin">
    <number>8</number>
   </property>
   <property name="topMargin">
    <number>8</number>
   </property>
   <property name="rightMargin">
    <number>8</number>
   </property>
   <property name="bottomMargin">
    <number>8</number>
   </property>
   <item>
    <widget class="QTabWidget" name="tabWidget">
     <property name="currentIndex">
      <number>0</number>
     </property>
     <property name="tabBarAutoHide">
      <bool>true</bool>
     </property>
     <widget class="QWidget" name="tab">
      <attribute name="title">
       <string>New Document</string>
      </attribute>
      <layout class="QHBoxLayout" name="horizontalLayout_7">
       <property name="spacing">
        <number>4</number>
       </property>
       <property name="leftMargin">
        <number>8</number>
       </property>
       <property name="topMargin">
        <number>8</number>
       </property>
       <property name="rightMargin">
        <number>8</number>
       </property>
       <property name="bottomMargin">
        <number>8</number>
       </property>
       <item>
        <layout class="QVBoxLayout" name="verticalLayout_5">
         <property name="spacing">
          <number>4</number>
         </property>
         <item>
          <layout class="QHBoxLayout" name="horizontalLayout_8">
           <property name="spacing">
            <number>4</number>
           </property>
           <item>
            <widget class="PageSizeSelector" name="pageSizeSelector" native="true"/>
           </item>
           <item>
            <spacer name="horizontalSpacer_4">
             <property name="orientation">
              <enum>Qt::Orientation::Horizontal</enum>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>16</width>
               <height>0</height>
              </size>
             </property>
            </spacer>
           </item>
           <item>
            <widget class="QComboBox" name="comboSortSizes"/>
           </item>
          </layout>
         </item>
         <item>
          <widget class="PageSizeList" name="listPageFormats"/>
         </item>
        </layout>
       </item>
       <item>
        <widget class="QScrollArea" name="scrollArea">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="frameShape">
          <enum>QFrame::Shape::NoFrame</enum>
         </property>
         <property name="sizeAdjustPolicy">
          <enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum>
         </property>
         <property name="widgetResizable">
          <bool>true</bool>
         </property>
         <widget class="QWidget" name="scrollAreaWidgetContents">
          <layout class="QVBoxLayout" name="verticalLayout_7">
           <property name="spacing">
            <number>0</number>
           </property>
           <property name="leftMargin">
            <number>0</number>
           </property>
           <property name="topMargin">
            <number>0</number>
           </property>
           <property name="rightMargin">
            <number>0</number>
           </property>
           <property name="bottomMargin">
            <number>8</number>
           </property>
           <item>
            <widget class="SectionContainer" name="sectionPreview">
             <property name="title" stdset="0">
              <string>Preview</string>
             </property>
             <widget class="QWidget" name="page_5">
              <layout class="QVBoxLayout" name="verticalLayout_4">
               <property name="spacing">
                <number>0</number>
               </property>
               <property name="leftMargin">
                <number>0</number>
               </property>
               <property name="topMargin">
                <number>0</number>
               </property>
               <property name="rightMargin">
                <number>0</number>
               </property>
               <property name="bottomMargin">
                <number>0</number>
               </property>
               <item>
                <widget class="PageSizePreview" name="pagePreview" native="true">
                 <property name="minimumSize">
                  <size>
                   <width>120</width>
                   <height>120</height>
                  </size>
                 </property>
                </widget>
               </item>
              </layout>
             </widget>
            </widget>
           </item>
           <item>
            <widget class="SectionContainer" name="sectionDocument">
             <property name="title" stdset="0">
              <string>Document</string>
             </property>
             <widget class="QWidget" name="page">
              <layout class="QVBoxLayout" name="verticalLayout_6">
               <property name="spacing">
                <number>4</number>
               </property>
               <property name="leftMargin">
                <number>8</number>
               </property>
               <property name="topMargin">
                <number>8</number>
               </property>
               <property name="rightMargin">
                <number>8</number>
               </property>
               <property name="bottomMargin">
                <number>8</number>
               </property>
               <item>
                <layout class="QGridLayout" name="gridLayout">
                 <item row="0" column="3">
                  <widget class="QComboBox" name="unitOfMeasureComboBox"/>
                 </item>
                 <item row="0" column="4">
                  <spacer name="horizontalSpacer_8">
                   <property name="orientation">
                    <enum>Qt::Orientation::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0">
                    <size>
                     <width>0</width>
                     <height>0</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                 <item row="0" column="2">
                  <spacer name="horizontalSpacer_5">
                   <property name="orientation">
                    <enum>Qt::Orientation::Horizontal</enum>
                   </property>
                   <property name="sizeType">
                    <enum>QSizePolicy::Policy::Fixed</enum>
                   </property>
                   <property name="sizeHint" stdset="0">
                    <size>
                     <width>16</width>
                     <height>0</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                 <item row="1" column="1">
                  <widget class="ScrSpinBox" name="heightSpinBox"/>
                 </item>
                 <item row="0" column="1">
                  <widget class="ScrSpinBox" name="widthSpinBox"/>
                 </item>
                 <item row="1" column="0">
                  <widget class="QLabel" name="label_2">
                   <property name="text">
                    <string>&amp;H:</string>
                   </property>
                   <property name="alignment">
                    <set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
                   </property>
                   <property name="buddy">
                    <cstring>heightSpinBox</cstring>
                   </property>
                  </widget>
                 </item>
                 <item row="0" column="0">
                  <widget class="QLabel" name="label">
                   <property name="text">
                    <string>&amp;W:</string>
                   </property>
                   <property name="alignment">
                    <set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
                   </property>
                   <property name="buddy">
                    <cstring>widthSpinBox</cstring>
                   </property>
                  </widget>
                 </item>
                </layout>
               </item>
               <item>
                <layout class="QHBoxLayout" name="horizontalLayout_12" stretch="0,0,0,0,0,1">
                 <item>
                  <widget class="FormWidget" name="pageCountLabel">
                   <property name="sizePolicy">
                    <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
                     <horstretch>0</horstretch>
                     <verstretch>0</verstretch>
                    </sizepolicy>
                   </property>
                   <property name="label" stdset="0">
                    <string>Pages</string>
                   </property>
                   <layout class="QHBoxLayout" name="horizontalLayout_2">
                    <property name="leftMargin">
                     <number>0</number>
                    </property>
                    <property name="topMargin">
                     <number>0</number>
                    </property>
                    <property name="rightMargin">
                     <number>0</number>
                    </property>
                    <property name="bottomMargin">
                     <number>0</number>
                    </property>
                    <item>
                     <widget class="QSpinBox" name="pageCountSpinBox"/>
                    </item>
                   </layout>
                  </widget>
                 </item>
                 <item>
                  <spacer name="horizontalSpacer_10">
                   <property name="orientation">
                    <enum>Qt::Orientation::Horizontal</enum>
                   </property>
                   <property name="sizeType">
                    <enum>QSizePolicy::Policy::Fixed</enum>
                   </property>
                   <property name="sizeHint" stdset="0">
                    <size>
                     <width>16</width>
                     <height>0</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                 <item>
                  <widget class="FormWidget" name="orientationLabel">
                   <property name="sizePolicy">
                    <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
                     <horstretch>0</horstretch>
                     <verstretch>0</verstretch>
                    </sizepolicy>
                   </property>
                   <property name="label" stdset="0">
                    <string>Orientation</string>
                   </property>
                   <layout class="QHBoxLayout" name="horizontalLayout_4">
                    <property name="spacing">
                     <number>4</number>
                    </property>
                    <property name="leftMargin">
                     <number>0</number>
                    </property>
                    <property name="topMargin">
                     <number>0</number>
                    </property>
                    <property name="rightMargin">
                     <number>0</number>
                    </property>
                    <property name="bottomMargin">
                     <number>0</number>
                    </property>
                    <item>
                     <spacer name="horizontalSpacer_3">
                      <property name="orientation">
                       <enum>Qt::Orientation::Horizontal</enum>
                      </property>
                      <property name="sizeHint" stdset="0">
                       <size>
                        <width>0</width>
                        <height>0</height>
                       </size>
                      </property>
                     </spacer>
                    </item>
                    <item>
                     <widget class="QToolButton" name="buttonVertical">
                      <property name="text">
                       <string/>
                      </property>
                      <property name="checkable">
                       <bool>true</bool>
                      </property>
                      <property name="checked">
                       <bool>true</bool>
                      </property>
                      <property name="autoExclusive">
                       <bool>true</bool>
                      </property>
                     </widget>
                    </item>
                    <item>
                     <widget class="QToolButton" name="buttonHorizontal">
                      <property name="text">
                       <string/>
                      </property>
                      <property name="checkable">
                       <bool>true</bool>
                      </property>
                      <property name="autoExclusive">
                       <bool>true</bool>
                      </property>
                     </widget>
                    </item>
                    <item>
                     <spacer name="horizontalSpacer_9">
                      <property name="orientation">
                       <enum>Qt::Orientation::Horizontal</enum>
                      </property>
                      <property name="sizeHint" stdset="0">
                       <size>
                        <width>0</width>
                        <height>0</height>
                       </size>
                      </property>
                     </spacer>
                    </item>
                   </layout>
                  </widget>
                 </item>
                 <item>
                  <spacer name="horizontalSpacer_7">
                   <property name="orientation">
                    <enum>Qt::Orientation::Horizontal</enum>
                   </property>
                   <property name="sizeType">
                    <enum>QSizePolicy::Policy::Fixed</enum>
                   </property>
                   <property name="sizeHint" stdset="0">
                    <size>
                     <width>16</width>
                     <height>0</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                 <item>
                  <widget class="PageLayouts" name="pageLayouts" native="true">
                   <property name="minimumSize">
                    <size>
                     <width>24</width>
                     <height>0</height>
                    </size>
                   </property>
                  </widget>
                 </item>
                 <item>
                  <spacer name="horizontalSpacer_6">
                   <property name="orientation">
                    <enum>Qt::Orientation::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0">
                    <size>
                     <width>0</width>
                     <height>0</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                </layout>
               </item>
              </layout>
             </widget>
            </widget>
           </item>
           <item>
            <widget class="SectionContainer" name="sectionMargins">
             <property name="title" stdset="0">
              <string>Margins</string>
             </property>
             <widget class="QWidget" name="page_2">
              <layout class="QVBoxLayout" name="verticalLayout_8">
               <property name="spacing">
                <number>4</number>
               </property>
               <property name="leftMargin">
                <number>8</number>
               </property>
               <property name="topMargin">
                <number>8</number>
               </property>
               <property name="rightMargin">
                <number>8</number>
               </property>
               <property name="bottomMargin">
                <number>8</number>
               </property>
               <item>
                <widget class="NewMarginWidget" name="marginGroup" native="true"/>
               </item>
              </layout>
             </widget>
            </widget>
           </item>
           <item>
            <widget class="SectionContainer" name="sectionBleeds">
             <property name="title" stdset="0">
              <string>Bleeds</string>
             </property>
             <widget class="QWidget" name="page_3">
              <layout class="QVBoxLayout" name="verticalLayout_9">
               <property name="spacing">
                <number>4</number>
               </property>
               <property name="leftMargin">
                <number>8</number>
               </property>
               <property name="topMargin">
                <number>8</number>
               </property>
               <property name="rightMargin">
                <number>8</number>
               </property>
               <property name="bottomMargin">
                <number>8</number>
               </property>
               <item>
                <widget class="NewMarginWidget" name="bleedGroup" native="true"/>
               </item>
              </layout>
             </widget>
            </widget>
           </item>
           <item>
            <widget class="SectionContainer" name="sectionTextFrame">
             <property name="title" stdset="0">
              <string>Text Frame</string>
             </property>
             <property name="isCollapsed">
              <bool>false</bool>
             </property>
             <widget class="QWidget" name="page_4">
              <layout class="QVBoxLayout" name="verticalLayout_10">
               <property name="spacing">
                <number>4</number>
               </property>
               <property name="leftMargin">
                <number>8</number>
               </property>
               <property name="topMargin">
                <number>8</number>
               </property>
               <property name="rightMargin">
                <number>8</number>
               </property>
               <property name="bottomMargin">
                <number>8</number>
               </property>
               <item>
                <widget class="QCheckBox" name="autoTextFrame">
                 <property name="text">
                  <string>&amp;Automatic Text Frame</string>
                 </property>
                </widget>
               </item>
               <item>
                <layout class="QHBoxLayout" name="horizontalLayout_3">
                 <item>
                  <widget class="FormWidget" name="labelColumns">
                   <property name="sizePolicy">
                    <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
                     <horstretch>0</horstretch>
                     <verstretch>0</verstretch>
                    </sizepolicy>
                   </property>
                   <property name="label" stdset="0">
                    <string>Columns</string>
                   </property>
                   <layout class="QHBoxLayout" name="horizontalLayout_5">
                    <property name="leftMargin">
                     <number>0</number>
                    </property>
                    <property name="topMargin">
                     <number>0</number>
                    </property>
                    <property name="rightMargin">
                     <number>0</number>
                    </property>
                    <property name="bottomMargin">
                     <number>0</number>
                    </property>
                    <item>
                     <widget class="QSpinBox" name="numberOfCols"/>
                    </item>
                   </layout>
                  </widget>
                 </item>
                 <item>
                  <widget class="FormWidget" name="labelGap">
                   <property name="sizePolicy">
                    <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
                     <horstretch>0</horstretch>
                     <verstretch>0</verstretch>
                    </sizepolicy>
                   </property>
                   <property name="label" stdset="0">
                    <string>Gap</string>
                   </property>
                   <layout class="QHBoxLayout" name="horizontalLayout_6">
                    <property name="leftMargin">
                     <number>0</number>
                    </property>
                    <property name="topMargin">
                     <number>0</number>
                    </property>
                    <property name="rightMargin">
                     <number>0</number>
                    </property>
                    <property name="bottomMargin">
                     <number>0</number>
                    </property>
                    <item>
                     <widget class="ScrSpinBox" name="Distance"/>
                    </item>
                   </layout>
                  </widget>
                 </item>
                 <item>
                  <spacer name="horizontalSpacer">
                   <property name="orientation">
                    <enum>Qt::Orientation::Horizontal</enum>
                   </property>
                   <property name="sizeHint" stdset="0">
                    <size>
                     <width>0</width>
                     <height>0</height>
                    </size>
                   </property>
                  </spacer>
                 </item>
                </layout>
               </item>
              </layout>
             </widget>
            </widget>
           </item>
           <item>
            <spacer name="verticalSpacer_2">
             <property name="orientation">
              <enum>Qt::Orientation::Vertical</enum>
             </property>
             <property name="sizeType">
              <enum>QSizePolicy::Policy::Fixed</enum>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>0</width>
               <height>16</height>
              </size>
             </property>
            </spacer>
           </item>
           <item>
            <layout class="QHBoxLayout" name="horizontalLayout_15">
             <property name="leftMargin">
              <number>8</number>
             </property>
             <property name="rightMargin">
              <number>8</number>
             </property>
             <item>
              <widget class="QCheckBox" name="startDocSetup">
               <property name="text">
                <string>Show Document Settings After Creation</string>
               </property>
              </widget>
             </item>
            </layout>
           </item>
           <item>
            <spacer name="spacerBottom">
             <property name="orientation">
              <enum>Qt::Orientation::Vertical</enum>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>0</width>
               <height>0</height>
              </size>
             </property>
            </spacer>
           </item>
          </layout>
         </widget>
        </widget>
       </item>
      </layout>
     </widget>
     <widget class="QWidget" name="tab_2">
      <attribute name="title">
       <string>New from Template</string>
      </attribute>
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <property name="spacing">
        <number>4</number>
       </property>
       <property name="leftMargin">
        <number>8</number>
       </property>
       <property name="topMargin">
        <number>8</number>
       </property>
       <property name="rightMargin">
        <number>8</number>
       </property>
       <property name="bottomMargin">
        <number>8</number>
       </property>
       <item>
        <widget class="nftwidget" name="nftGui" native="true"/>
       </item>
      </layout>
     </widget>
     <widget class="QWidget" name="tab_3">
      <attribute name="title">
       <string>Open Existing Document</string>
      </attribute>
     </widget>
     <widget class="QWidget" name="tab_4">
      <attribute name="title">
       <string>Open Recent Document</string>
      </attribute>
      <layout class="QVBoxLayout" name="verticalLayout_3">
       <property name="spacing">
        <number>4</number>
       </property>
       <property name="leftMargin">
        <number>8</number>
       </property>
       <property name="topMargin">
        <number>8</number>
       </property>
       <property name="rightMargin">
        <number>8</number>
       </property>
       <property name="bottomMargin">
        <number>8</number>
       </property>
       <item>
        <widget class="QListWidget" name="recentDocListBox"/>
       </item>
      </layout>
     </widget>
    </widget>
   </item>
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <property name="spacing">
      <number>4</number>
     </property>
     <property name="leftMargin">
      <number>8</number>
     </property>
     <item>
      <widget class="QCheckBox" name="startUpDialog">
       <property name="text">
        <string>Do not show this dialog again</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QDialogButtonBox" name="buttonBox">
       <property name="orientation">
        <enum>Qt::Orientation::Horizontal</enum>
       </property>
       <property name="standardButtons">
        <set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
       </property>
      </widget>
     </item>
    </layout>
   </item>
  </layout>
 </widget>
 <customwidgets>
  <customwidget>
   <class>FormWidget</class>
   <extends>QWidget</extends>
   <header>ui/widgets/form_widget.h</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>SectionContainer</class>
   <extends>QWidget</extends>
   <header>ui/widgets/section_container.h</header>
   <addpagemethod>setWidget</addpagemethod>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>ScrSpinBox</class>
   <extends>QDoubleSpinBox</extends>
   <header location="global">ui/scrspinbox.h</header>
  </customwidget>
  <customwidget>
   <class>NewMarginWidget</class>
   <extends>QWidget</extends>
   <header>ui/newmarginwidget.h</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>PageLayouts</class>
   <extends>QWidget</extends>
   <header location="global">ui/widgets/pagelayout.h</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>PageSizeList</class>
   <extends>QListWidget</extends>
   <header>ui/widgets/pagesizelist.h</header>
  </customwidget>
  <customwidget>
   <class>nftwidget</class>
   <extends>QWidget</extends>
   <header>ui/nftwidget.h</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>PageSizePreview</class>
   <extends>QWidget</extends>
   <header>ui/widgets/pagesizepreview.h</header>
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>PageSizeSelector</class>
   <extends>QWidget</extends>
   <header>ui/widgets/pagesizeselector.h</header>
   <container>1</container>
  </customwidget>
 </customwidgets>
 <tabstops>
  <tabstop>tabWidget</tabstop>
  <tabstop>comboSortSizes</tabstop>
  <tabstop>listPageFormats</tabstop>
  <tabstop>scrollArea</tabstop>
  <tabstop>widthSpinBox</tabstop>
  <tabstop>unitOfMeasureComboBox</tabstop>
  <tabstop>heightSpinBox</tabstop>
  <tabstop>pageCountSpinBox</tabstop>
  <tabstop>buttonVertical</tabstop>
  <tabstop>buttonHorizontal</tabstop>
  <tabstop>autoTextFrame</tabstop>
  <tabstop>numberOfCols</tabstop>
  <tabstop>Distance</tabstop>
  <tabstop>startDocSetup</tabstop>
  <tabstop>startUpDialog</tabstop>
  <tabstop>recentDocListBox</tabstop>
 </tabstops>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>newDocDialog</receiver>
   <slot>accept()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>248</x>
     <y>254</y>
    </hint>
    <hint type="destinationlabel">
     <x>157</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>buttonBox</sender>
   <signal>rejected()</signal>
   <receiver>newDocDialog</receiver>
   <slot>reject()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>316</x>
     <y>260</y>
    </hint>
    <hint type="destinationlabel">
     <x>286</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>
newdocdialog.ui (29,700 bytes)   
new_doc_dialog.png (88,173 bytes)   
new_doc_dialog.png (88,173 bytes)   

nitramr

2024-11-20 19:43

developer   ~0051612

>> while its default size is fine, the dialog should resizable and the new size be stored in the settings.

I missed that.
Now, the new document dialog based on ScDialog class, that handle the geometry saving and restoring and checks if the dialog fit in the screen. Because of that, I removed my custom implementation for resizing.

Please use this patch + the ui file from previous post.
newdocdialog_2024-11-20_02.patch (5,358 bytes)   
Index: scribus/ui/newdocdialog.cpp
===================================================================
--- scribus/ui/newdocdialog.cpp	(Revision 26436)
+++ scribus/ui/newdocdialog.cpp	(Arbeitskopie)
@@ -47,27 +47,23 @@
 #include "ui/widgets/pagesizelist.h"
 
 
-NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : QDialog(parent),
+NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : ScDialog(parent, "NewDocumentWindow"),
 	prefsManager(PrefsManager::instance()),
 	m_onStartup(startUp)
 {
 	setupUi(this);
 
-	windowFitInScreen();
+	IconManager &iconManager = IconManager::instance();
 
-	setObjectName(QString::fromLocal8Bit("NewDocumentWindow"));
 	setModal(true);
+	setWindowTitle( tr( "New Document" ) );
 
-	IconManager &iconManager = IconManager::instance();
-
+	m_labelVisibity = !prefsManager.appPrefs.uiPrefs.hideLabels;
 	m_unitIndex = prefsManager.appPrefs.docSetupPrefs.docUnitIndex;
 	m_unitRatio = unitGetRatioFromIndex(m_unitIndex);
 	m_unitSuffix = unitGetSuffixFromIndex(m_unitIndex);
 	m_orientation = prefsManager.appPrefs.docSetupPrefs.pageOrientation;
 
-	setWindowTitle( tr( "New Document" ) );
-	setWindowIcon(iconManager.loadIcon("AppIcon.png"));
-
 	buttonVertical->setIcon(iconManager.loadIcon("page-orientation-vertical"));
 	buttonHorizontal->setIcon(iconManager.loadIcon("page-orientation-horizontal"));
 	labelColumns->setPixmap(iconManager.loadPixmap("paragraph-columns"));
@@ -191,6 +187,9 @@
 	pageCountSpinBox->setMaximum( 10000 );
 	pageCountSpinBox->setMinimum( 1 );
 
+	IconManager &iconManager = IconManager::instance();
+	pageCountLabel->setPixmap(iconManager.loadPixmap("panel-page"));
+
 	pageLayouts->updateSchemeSelector(prefsManager.appPrefs.pageSets, prefsManager.appPrefs.pageSets[pagePositioning].FirstPage);
 
 	setDocLayout(pagePositioning);
@@ -234,12 +233,16 @@
 	sectionTextFrame->setCanSaveState(true);
 	sectionTextFrame->restorePreferences();
 
-	// We have to calculate the width of the properties panel manually,
-	// because QSizePolicy::Minimum doesn't work as expected
+	labelColumns->setLabelVisibility(m_labelVisibity);
+	labelGap->setLabelVisibility(m_labelVisibity);
+	pageCountLabel->setLabelVisibility(m_labelVisibity);
+	orientationLabel->setLabelVisibility(m_labelVisibity);
+	pageLayouts->toggleLabelVisibility(m_labelVisibity);
+
+	// We have to install an event filter to resize the scroll container width based on the content width.
+	// The content width can change after we calculated the initial ui layout.
+	scrollAreaWidgetContents->installEventFilter(this);
 	scrollAreaWidgetContents->adjustSize();
-	//scrollAreaWidgetContents->setFixedWidth(scrollAreaWidgetContents->width());
-	scrollArea->setWidgetResizable(true);
-	scrollArea->setFixedWidth(scrollAreaWidgetContents->width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent));
 
 }
 
@@ -330,6 +333,7 @@
 		QSignalBlocker sigFormats(listPageFormats);
 		listPageFormats->setOrientation(m_orientation);
 	}
+
 }
 
 void NewDocDialog::setHeight(double)
@@ -384,25 +388,15 @@
 	listPageFormats->setSortMode(static_cast<PageSizeList::SortMode>(comboSortSizes->currentData().toInt()));
 }
 
-void NewDocDialog::windowFitInScreen()
+bool NewDocDialog::eventFilter(QObject *object, QEvent *event)
 {
-	QScreen* activeScreen = nullptr;
-	QWidget* widget = this;
-
-	while (widget)
+	if (object->objectName() == "scrollAreaWidgetContents" && event->type() == QEvent::Resize)
 	{
-		activeScreen = widget->screen();
-		if (activeScreen != nullptr)
-			break;
-		widget = widget->parentWidget();
+		int currentWidth = scrollArea->minimumWidth();
+		scrollArea->setMinimumWidth(qMax(scrollAreaWidgetContents->sizeHint().width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent), currentWidth));
+		return true;
 	}
-
-	if (activeScreen)
-	{
-		int w = qMin(width(), activeScreen->availableSize().width());
-		int h = qMin(height(), activeScreen->availableSize().height());
-		resize(w, h);
-	}
+	return false;
 }
 
 void NewDocDialog::handleAutoFrame()
@@ -439,6 +433,8 @@
 	bleedGroup->setPageWidth(m_pageWidth);
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double)));
+
+
 }
 
 void NewDocDialog::ExitOK()
@@ -523,6 +519,7 @@
 
 	marginGroup->setPageSize(size);
 	bleedGroup->setPageSize(size);
+
 }
 
 void NewDocDialog::setSize(const QString& gr)
Index: scribus/ui/newdocdialog.h
===================================================================
--- scribus/ui/newdocdialog.h	(Revision 26436)
+++ scribus/ui/newdocdialog.h	(Arbeitskopie)
@@ -29,6 +29,7 @@
 class QPushButton;
 class QSpinBox;
 
+#include "scdialog.h"
 #include "scribusapi.h"
 #include "scribusstructs.h"
 #include "ui/customfdialog.h"
@@ -40,7 +41,7 @@
 class PrefsManager;
 class ScrSpinBox;
 
-class SCRIBUS_API NewDocDialog : public QDialog, public Ui::newDocDialog
+class SCRIBUS_API NewDocDialog : public ScDialog, public Ui::newDocDialog
 {
 	Q_OBJECT
 
@@ -137,8 +138,9 @@
 	double m_bleedTop { 0.0 };
 	double m_bleedLeft { 0.0 };
 	double m_bleedRight { 0.0 };
+	bool m_labelVisibity {true};
 
-	void windowFitInScreen();
+	bool eventFilter(QObject *object, QEvent *event);
 };
 
 #endif // NEWDOC_H

cbradney

2024-11-20 20:40

administrator   ~0051614

Committed these changes. Does this resolve the bug now?

nitramr

2024-11-20 21:11

developer   ~0051616

You mean the horizontal scrollbar? Yes.

cbradney

2024-11-20 21:39

administrator   ~0051617

Last edited: 2024-11-20 21:40

When the dialog opens, I get a resize action occurring within it between the two sides that's visible. Can that be avoided?

nitramr

2024-11-20 22:13

developer   ~0051618

I can't see any resize action when opening the dialog, neither on Linux nor on Mac. See screencast.

cbradney

2024-11-21 06:06

administrator   ~0051620

I see it only when opening Scribus for the first time. Subsequent opening of the new doc dialog does not do it.

nitramr

2024-11-21 11:47

developer   ~0051622

Last edited: 2024-11-21 11:49

I tried the following things but I can't reproduce it on Mac* (Qt 6.7.0) and Linux (Qt 6.8.0).
- Build clean up
- Fresh start without prefs file
- Fresh start with prefs file

*) 16" screen, MacOS 15.1

Issue History

Date Modified Username Field Change
2024-11-07 15:21 ale New Issue
2024-11-07 15:21 ale File Added: new-document.png
2024-11-07 15:52 ale Note Added: 0051537
2024-11-07 15:53 ale Note Added: 0051538
2024-11-07 15:53 ale File Added: new-document-compact.png
2024-11-07 15:54 ale Note Edited: 0051538
2024-11-07 15:55 ale Note Edited: 0051538
2024-11-20 19:09 nitramr Note Added: 0051609
2024-11-20 19:09 nitramr File Added: newdocdialog_2024-11-20_01.patch
2024-11-20 19:09 nitramr File Added: newdocdialog.ui
2024-11-20 19:09 nitramr File Added: new_doc_dialog.png
2024-11-20 19:09 nitramr Patch No => Yes
2024-11-20 19:10 nitramr Note Edited: 0051609
2024-11-20 19:12 nitramr Assigned To => nitramr
2024-11-20 19:12 nitramr Status new => assigned
2024-11-20 19:12 nitramr Target Version => 1.7.0
2024-11-20 19:43 nitramr Note Added: 0051612
2024-11-20 19:43 nitramr File Added: newdocdialog_2024-11-20_02.patch
2024-11-20 20:40 cbradney Note Added: 0051614
2024-11-20 21:11 nitramr Note Added: 0051616
2024-11-20 21:39 cbradney Note Added: 0051617
2024-11-20 21:40 cbradney Note Edited: 0051617
2024-11-20 22:13 nitramr Note Added: 0051618
2024-11-20 22:13 nitramr File Added: 2024-11-20 23-06-53.mov
2024-11-21 06:06 cbradney Note Added: 0051620
2024-11-21 11:47 nitramr Note Added: 0051622
2024-11-21 11:49 nitramr Note Edited: 0051622