r24283 by craig - Remove calls to deprecated screen and globalstrut calls. globalStrut is

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 24 21:06:02 UTC 2020


Author: craig
Date: Tue Nov 24 21:06:02 2020
New Revision: 24283

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24283
Log:
Remove calls to deprecated screen and globalstrut calls. globalStrut is
simply QSize(0,0) these days so remove/replace by 0

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/sclistboxpixmap.h
    trunk/Scribus/scribus/ui/scdockpalette.cpp
    trunk/Scribus/scribus/ui/scrpalettebase.cpp
    trunk/Scribus/scribus/ui/storyeditor.cpp

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24283&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Tue Nov 24 21:06:02 2020
@@ -2292,7 +2292,6 @@
 			appPrefs.uiPrefs.mainWinSettings.height = dc.attribute("Height", "480").toInt();
 			appPrefs.uiPrefs.mainWinSettings.maximized = static_cast<bool>(dc.attribute("Maximized", "0").toInt());
 			appPrefs.uiPrefs.mainWinSettings.screenNumber = dc.attribute("ScreenNumber", "0").toInt();
-			QSize gStrut = QApplication::globalStrut();
 			int minX = 0;
 			int minY = 0;
 #ifdef Q_OS_MAC
@@ -2306,8 +2305,8 @@
 				if (appPrefs.uiPrefs.mainWinSettings.yPosition <  minY)
 					appPrefs.uiPrefs.mainWinSettings.yPosition = minY;
 			}
-			int minWidth = 5*gStrut.width();
-			int minHeight = 5*gStrut.width();
+			int minWidth = 0;
+			int minHeight = 0;
 			QScreen* s=QGuiApplication::screens().at(qMin(appPrefs.uiPrefs.mainWinSettings.screenNumber, QGuiApplication::screens().count()-1));
 			int maxWidth = s->availableSize().width();
 			int maxHeight = s->availableSize().height();

Modified: trunk/Scribus/scribus/sclistboxpixmap.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24283&path=/trunk/Scribus/scribus/sclistboxpixmap.h
==============================================================================
--- trunk/Scribus/scribus/sclistboxpixmap.h	(original)
+++ trunk/Scribus/scribus/sclistboxpixmap.h	Tue Nov 24 21:06:02 2020
@@ -70,8 +70,7 @@
 		w = pmap->width() + metrics.horizontalAdvance(textData) + 6;
 	}
 
-	QSize globalStrut = QApplication::globalStrut();
-	return QSize(qMax(w, globalStrut.width()), qMax(h, globalStrut.height()));
+	return QSize(qMax(w, 0), qMax(h, 0));
 }
 
 template<unsigned int pixWidth, unsigned int pixHeight>

Modified: trunk/Scribus/scribus/ui/scdockpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24283&path=/trunk/Scribus/scribus/ui/scdockpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scdockpalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/scdockpalette.cpp	Tue Nov 24 21:06:02 2020
@@ -154,27 +154,26 @@
 	if (m_palettePrefs && !showEvent->spontaneous() && isFloating())
 	{
 		QDesktopWidget *d = QApplication::desktop();
-		QSize gStrut = QApplication::globalStrut();
 		if (m_palettePrefs->contains("left"))
 		{
 			QRect scr = QApplication::desktop()->availableGeometry(this);
 			// all palettes should have enough room for 3x3 min widgets
-			int vwidth  = qMin(qMax(3 * gStrut.width(), m_palettePrefs->getInt("width")),
+			int vwidth  = qMin(qMax(0, m_palettePrefs->getInt("width")),
 			                   d->width());
-			int vheight = qMin(qMax(3 * gStrut.height(), m_palettePrefs->getInt("height")),
+			int vheight = qMin(qMax(0, m_palettePrefs->getInt("height")),
 			                   d->height());
 			// palettes should not use too much screen space
 			if (vwidth > d->width() / 3 && vheight > d->height()/3)
 				vwidth = d->width() / 3;
 			// and should be partly visible
-			int vleft   = qMin(qMax(scr.left() - vwidth + gStrut.width(), m_palettePrefs->getInt("left")),
-			                   scr.right() - gStrut.width());
-			int vtop = qMin(m_palettePrefs->getInt("top"), d->height() - gStrut.height());
+			int vleft   = qMin(qMax(scr.left() - vwidth, m_palettePrefs->getInt("left")),
+							   scr.right());
+			int vtop = qMin(m_palettePrefs->getInt("top"), d->height());
 #if defined(Q_OS_MAC) || defined(_WIN32)
 			// on Mac and Windows you're dead if the titlebar is not on screen
 			vtop    = qMax(64, vtop);
 #else
-			vtop    = qMax(-vheight + gStrut.height(), vtop);
+			vtop    = qMax(-vheight, vtop);
 #endif
 			// Check values against current screen size
 			if (vleft <= scr.left())
@@ -186,9 +185,9 @@
 			if (vtop <= scr.top())
 				vtop = scr.top();
 			if (vwidth >= scr.width())
-				vwidth = qMax(gStrut.width(), scr.width() - vleft);
+				vwidth = qMax(0, scr.width() - vleft);
 			if ( vheight >= scr.height() )
-				vheight = qMax(gStrut.height(), scr.height() - vtop);
+				vheight = qMax(0, scr.height() - vtop);
 //			qDebug() << QString("root %1x%2 %7 palette %3x%4 @ (%5,%6)").arg(d->width()).arg(d->height())
 //				.arg(vwidth).arg(vheight).arg(vleft).arg(vtop).arg(name());
 //			setGeometry(vleft, vtop, vwidth, vheight);

Modified: trunk/Scribus/scribus/ui/scrpalettebase.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24283&path=/trunk/Scribus/scribus/ui/scrpalettebase.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrpalettebase.cpp	(original)
+++ trunk/Scribus/scribus/ui/scrpalettebase.cpp	Tue Nov 24 21:06:02 2020
@@ -158,27 +158,26 @@
 	if (m_palettePrefs && !showEvent->spontaneous())
 	{
 		QDesktopWidget *d = QApplication::desktop();
-		QSize gStrut = QApplication::globalStrut();
 		if (m_palettePrefs->contains("left"))
 		{
 			QRect scr = QApplication::desktop()->availableGeometry(this);
 			// all palettes should have enough room for 3x3 min widgets
-			int vwidth  = qMin(qMax(3*gStrut.width(), m_palettePrefs->getInt("width")),
+			int vwidth  = qMin(qMax(0, m_palettePrefs->getInt("width")),
 			                   d->width());
-			int vheight = qMin(qMax(3*gStrut.height(), m_palettePrefs->getInt("height")),
+			int vheight = qMin(qMax(0, m_palettePrefs->getInt("height")),
 			                   d->height());
 			// palettes should not use too much screen space
 			if (vwidth > d->width()/3 && vheight > d->height()/3)
 				vwidth = d->width()/3;
 			// and should be partly visible
-			int vleft   = qMin(qMax(scr.left() - vwidth + gStrut.width(), m_palettePrefs->getInt("left")),
-			                   scr.right() - gStrut.width());
-			int vtop = qMin(m_palettePrefs->getInt("top"), d->height() - gStrut.height());
+			int vleft   = qMin(qMax(scr.left() - vwidth, m_palettePrefs->getInt("left")),
+							   scr.right());
+			int vtop = qMin(m_palettePrefs->getInt("top"), d->height());
 #if defined(Q_OS_MAC) || defined(_WIN32)
 			// on Mac and Windows you're dead if the titlebar is not on screen
 			vtop    = qMax(64, vtop);
 #else
-			vtop    = qMax(-vheight + gStrut.height(), vtop);
+			vtop    = qMax(-vheight, vtop);
 #endif
 			// Check values against current screen size
 			if ( vleft <= scr.left() )
@@ -190,9 +189,9 @@
 			if ( vtop <= scr.top() )
 				vtop = scr.top();
 			if ( vwidth >= scr.width() )
-				vwidth = qMax( gStrut.width(), scr.width() - vleft );
+				vwidth = qMax( 0, scr.width() - vleft );
 			if ( vheight >= scr.height() )
-				vheight = qMax( gStrut.height(), scr.height() - vtop );
+				vheight = qMax( 0, scr.height() - vtop );
 //			qDebug() << QString("root %1x%2 %7 palette %3x%4 @ (%5,%6)").arg(d->width()).arg(d->height())
 //				.arg(vwidth).arg(vheight).arg(vleft).arg(vtop).arg(name());
 //			setGeometry(vleft, vtop, vwidth, vheight);

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24283&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp	Tue Nov 24 21:06:02 2020
@@ -48,6 +48,7 @@
 #include <QSignalBlocker>
 #include <QScopedPointer>
 #include <QScopedValueRollback>
+#include <QScreen>
 #include <QScrollBar>
 #include <QTextBlock>
 #include <QTextCodec>
@@ -1644,16 +1645,15 @@
 	int vwidth  = qMax(600, prefs->getInt("width", 600));
 	int vheight = qMax(400, prefs->getInt("height", 400));
 	// Check values against current screen size
-	QRect scr = QApplication::desktop()->screen()->geometry();
-	QSize gStrut = QApplication::globalStrut();
+	QRect scr = ScCore->primaryMainWindow()->getScreen()->geometry();
 	if ( vleft >= scr.width() )
 		vleft = 0;
 	if ( vtop >= scr.height() )
 		vtop = 64;
 	if ( vwidth >= scr.width() )
-		vwidth = qMax( gStrut.width(), scr.width() - vleft );
+		vwidth = qMax( 0, scr.width() - vleft );
 	if ( vheight >= scr.height() )
-		vheight = qMax( gStrut.height(), scr.height() - vtop );
+		vheight = qMax( 0, scr.height() - vtop );
 	setGeometry(vleft, vtop, vwidth, vheight);
 	QByteArray state = "";
 	state = prefs->get("winstate","").toLatin1();




More information about the scribus-commit mailing list