View Issue Details

IDProjectCategoryView StatusLast Update
0017295ScribusUser Interfacepublic2024-11-10 18:52
Reporterjghali Assigned Tonitramr  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.7.0.svn 
Fixed in Version1.7.0.svn 
Summary0017295: New Doc Dialog height is excessive on a 15" screen on Windows
DescriptionAs title mentions, the new doc dialog now appears to be too high on a 15" screen on Windows. The OK / Cancel buttons are hidden by the task bar. See attached screenshot.
TagsNo tags attached.
PatchNo

Activities

jghali

2024-10-18 18:29

administrator  

new_doc_dialog_too_high.png (192,833 bytes)   
new_doc_dialog_too_high.png (192,833 bytes)   

nitramr

2024-10-19 19:12

developer   ~0051461

Hi Jean, please can you check if the patch works for you?

I add a calculation that checks the available screen size and resizes the dialog if necessary. In general, I thought Qt resizes the dialog automatically if no fixed size is set.
In addition, I add a missing "columns" icon and made a few more changes to reduce the dialog height.

Reference:
https://doc.qt.io/qt-6/qscreen.html#availableSize-prop
newdocdialog_2024-10-19_01.patch (8,821 bytes)   
Index: scribus/ui/newdocdialog.cpp
===================================================================
--- scribus/ui/newdocdialog.cpp	(Revision 26349)
+++ scribus/ui/newdocdialog.cpp	(Arbeitskopie)
@@ -31,6 +31,7 @@
 #include <QTabWidget>
 #include <QToolTip>
 #include <QVBoxLayout>
+#include <QWindow>
 
 #include "commonstrings.h"
 #include "filedialogeventcatcher.h"
@@ -52,6 +53,8 @@
 {
 	setupUi(this);
 
+	windowFitInScreen();
+
 	setObjectName(QString::fromLocal8Bit("NewDocumentWindow"));
 	setModal(true);
 
@@ -67,6 +70,7 @@
 
 	buttonVertical->setIcon(iconManager.loadIcon("page-orientation-vertical"));
 	buttonHorizontal->setIcon(iconManager.loadIcon("page-orientation-horizontal"));
+	labelColumns->setPixmap(iconManager.loadPixmap("paragraph-columns"));
 
 	createNewDocPage();
 	if (startUp)
@@ -153,11 +157,13 @@
 	widthSpinBox->setMaximum(16777215);
 	widthSpinBox->setNewUnit(m_unitIndex);
 	widthSpinBox->setSuffix(m_unitSuffix);
+	widthSpinBox->setValue(pageWidth * m_unitRatio);
 
 	heightSpinBox->setMinimum(pts2value(1.0, m_unitIndex));
 	heightSpinBox->setMaximum(16777215);
 	heightSpinBox->setNewUnit(m_unitIndex);
 	heightSpinBox->setSuffix(m_unitSuffix);
+	heightSpinBox->setValue(pageHeight * m_unitRatio);
 
 	unitOfMeasureComboBox->addItems(unitGetTextUnitList());
 	unitOfMeasureComboBox->setCurrentIndex(m_unitIndex);
@@ -165,22 +171,20 @@
 
 	MarginStruct marg(prefsManager.appPrefs.docSetupPrefs.margins);
 	marginGroup->setup(marg, !(pagePositioning == singlePage), m_unitIndex, NewMarginWidget::MarginWidgetFlags);
+	marginGroup->toggleLabelVisibility(false);
 	marginGroup->setPageHeight(pageHeight);
 	marginGroup->setPageWidth(pageWidth);
 	marginGroup->setFacingPages(!(pagePositioning == singlePage));
+	marginGroup->setPageSize(pageSize);
+	marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
 	MarginStruct bleed;
 	bleed.resetToZero();
-
 	bleedGroup->setup(bleed, !(pagePositioning == singlePage), m_unitIndex, NewMarginWidget::BleedWidgetFlags);
+	bleedGroup->toggleLabelVisibility(false);
 	bleedGroup->setPageHeight(pageHeight);
 	bleedGroup->setPageWidth(pageWidth);
 	bleedGroup->setFacingPages(!(pagePositioning == singlePage));
-	widthSpinBox->setValue(pageWidth * m_unitRatio);
-	heightSpinBox->setValue(pageHeight * m_unitRatio);
-
-	marginGroup->setPageSize(pageSize);
-	marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 	bleedGroup->setPageSize(pageSize);
 	bleedGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset);
 
@@ -233,7 +237,7 @@
 	// We have to calculate the width of the properties panel manually,
 	// because QSizePolicy::Minimum doesn't work as expected
 	scrollAreaWidgetContents->adjustSize();
-	scrollAreaWidgetContents->setFixedWidth(scrollAreaWidgetContents->width());
+	//scrollAreaWidgetContents->setFixedWidth(scrollAreaWidgetContents->width());
 	scrollArea->setWidgetResizable(true);
 	scrollArea->setFixedWidth(scrollAreaWidgetContents->width() + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent));
 
@@ -380,6 +384,31 @@
 	listPageFormats->setSortMode(static_cast<PageSizeList::SortMode>(comboSortSizes->currentData().toInt()));
 }
 
+void NewDocDialog::windowFitInScreen()
+{
+	QScreen* activeScreen = nullptr;
+	QWidget* widget = this;
+
+	while (widget)
+	{
+		auto w = widget->windowHandle();
+		if (w != nullptr)
+		{
+			activeScreen = w->screen();
+			break;
+		}
+		else
+			widget = widget->parentWidget();
+	}
+
+	if (activeScreen)
+	{
+		int w = qMin(width(), activeScreen->availableSize().width());
+		int h = qMin(height(), activeScreen->availableSize().height());
+		resize(w, h);
+	}
+}
+
 void NewDocDialog::handleAutoFrame()
 {
 	if (autoTextFrame->isChecked())
Index: scribus/ui/newdocdialog.h
===================================================================
--- scribus/ui/newdocdialog.h	(Revision 26349)
+++ scribus/ui/newdocdialog.h	(Arbeitskopie)
@@ -137,6 +137,8 @@
 	double m_bleedTop { 0.0 };
 	double m_bleedLeft { 0.0 };
 	double m_bleedRight { 0.0 };
+
+	void windowFitInScreen();
 };
 
 #endif // NEWDOC_H
Index: scribus/ui/newdocdialog.ui
===================================================================
--- scribus/ui/newdocdialog.ui	(Revision 26349)
+++ scribus/ui/newdocdialog.ui	(Arbeitskopie)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>900</width>
-    <height>680</height>
+    <height>650</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -41,7 +41,7 @@
       <attribute name="title">
        <string>New Document</string>
       </attribute>
-      <layout class="QHBoxLayout" name="horizontalLayout_7">
+      <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="1,0">
        <property name="spacing">
         <number>4</number>
        </property>
@@ -95,12 +95,6 @@
        </item>
        <item>
         <widget class="QScrollArea" name="scrollArea">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
          <property name="frameShape">
           <enum>QFrame::Shape::NoFrame</enum>
          </property>
@@ -118,8 +112,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>304</width>
-            <height>624</height>
+            <width>320</width>
+            <height>626</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_7">
@@ -679,11 +673,21 @@
             </spacer>
            </item>
            <item>
-            <widget class="QCheckBox" name="startDocSetup">
-             <property name="text">
-              <string>Show Document Settings After Creation</string>
+            <layout class="QHBoxLayout" name="horizontalLayout_15">
+             <property name="leftMargin">
+              <number>8</number>
              </property>
-            </widget>
+             <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">
Index: scribus/ui/newmarginwidget.cpp
===================================================================
--- scribus/ui/newmarginwidget.cpp	(Revision 26349)
+++ scribus/ui/newmarginwidget.cpp	(Arbeitskopie)
@@ -74,11 +74,11 @@
 	{
 		topMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the top margin guide and the edge of the page" ) + "</qt>");
 		bottomMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the bottom margin guide and the edge of the page" ) + "</qt>");
-		leftMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the left margin guide and the edge of the page. If a double-sided, 3 or 4-fold layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
-		rightMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the right margin guide and the edge of the page. If a double-sided, 3 or 4-fold layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
+		leftMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the left margin guide and the edge of the page. If a double-sided layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
+		rightMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the right margin guide and the edge of the page. If a double-sided layout is selected, this margin space can be used to achieve the correct margins for binding.") + "</qt>");
 		marginLinkButton->setToolTip( "<qt>" + tr( "Ensure all margins have the same value" ) + "</qt>");
 	}
-	else if (m_flags & BleedWidgetFlags)
+	else if (m_flags & BleedWidgetFlags)
 	{
 		topMarginSpinBox->setToolTip( "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
 		bottomMarginSpinBox->setToolTip( "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
@@ -390,10 +390,11 @@
 {
 	m_facingPages = facing;
 	m_pageType = pageType;
-
-	leftMarginLabel->setText( m_facingPages ? tr("Inside") : tr("Left"));
-	rightMarginLabel->setText( m_facingPages ? tr("Outside") : tr("Right"));
-
+
+	leftMarginLabel->setText( m_facingPages ? tr("Inside") : tr("Left"));
+	rightMarginLabel->setText( m_facingPages ? tr("Outside") : tr("Right"));
+
+	iconSetChange();
 	setPreset();
 }
 

jghali

2024-10-24 22:37

administrator   ~0051485

Works :-)

Issue History

Date Modified Username Field Change
2024-10-18 18:29 jghali New Issue
2024-10-18 18:29 jghali Status new => assigned
2024-10-18 18:29 jghali Assigned To => nitramr
2024-10-18 18:29 jghali File Added: new_doc_dialog_too_high.png
2024-10-19 19:12 nitramr Note Added: 0051461
2024-10-19 19:12 nitramr File Added: newdocdialog_2024-10-19_01.patch
2024-10-24 22:37 jghali Status assigned => resolved
2024-10-24 22:37 jghali Resolution open => fixed
2024-10-24 22:37 jghali Fixed in Version => 1.7.0.svn
2024-10-24 22:37 jghali Note Added: 0051485
2024-11-10 18:52 cbradney Status resolved => closed