r23805 by jghali - Avoid issue with Qt 5.15 rc2 where new doc dialog would be displayed too large on startup

scribus-commit scribus-commit at lists.scribus.net
Wed May 13 17:37:33 UTC 2020


Author: jghali
Date: Wed May 13 17:37:33 2020
New Revision: 23805

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23805
Log:
Avoid issue with Qt 5.15 rc2 where new doc dialog would be displayed too large on startup

Modified:
    trunk/Scribus/scribus/ui/newdocdialog.cpp

Modified: trunk/Scribus/scribus/ui/newdocdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23805&path=/trunk/Scribus/scribus/ui/newdocdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/newdocdialog.cpp	Wed May 13 17:37:33 2020
@@ -116,7 +116,7 @@
 		tabWidget->addTab(newFromTempFrame, tr("New &from Template"));
 		createOpenDocPage();
 		tabWidget->addTab(openDocFrame, tr("Open &Existing Document"));
-		recentDocList=recentDocs;
+		recentDocList = recentDocs;
  		createRecentDocPage();
  		tabWidget->addTab(recentDocFrame, tr("Open Recent &Document"));
  		TabbedNewDocLayout->addWidget(tabWidget);
@@ -351,7 +351,7 @@
 {
 	PrefsContext* docContext = prefsManager.prefsFile->getContext("docdirs", false);
 	QString docDir = ".";
-	QString prefsDocDir=prefsManager.documentDir();
+	QString prefsDocDir = prefsManager.documentDir();
 	if (!prefsDocDir.isEmpty())
 		docDir = docContext->get("docsopen", prefsDocDir);
 	else
@@ -364,10 +364,17 @@
 	openDocLayout->setSpacing(5);
 	m_selectedFile = "";
 
-	fileDialog = new QFileDialog(openDocFrame, tr("Open"), docDir, formats);
+	// With Qt 5.15 we have to be in careful so that new document dialog doesn't display too large on startup.
+	// To avoid this we have to use QFileDialog(QWidget *parent, Qt::WindowFlags flags) constructor, then
+	// set the QFileDialog::DontUseNativeDialog option as early as possible, and nonetheless set again
+	// the Qt::Widget window flag before adding the widget to layout.
+	fileDialog = new QFileDialog(openDocFrame, Qt::Widget);
+	fileDialog->setOption(QFileDialog::DontUseNativeDialog);
+	fileDialog->setWindowTitle(tr("Open"));
+	fileDialog->setDirectory(docDir);
+	fileDialog->setNameFilter(formats);
 	fileDialog->setFileMode(QFileDialog::ExistingFile);
 	fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
-	fileDialog->setOption(QFileDialog::DontUseNativeDialog);
 	fileDialog->setIconProvider(new ImIconProvider());
 	fileDialog->setOption(QFileDialog::HideNameFilterDetails, true);
 	fileDialog->setReadOnly(true);




More information about the scribus-commit mailing list