r24274 by jghali - Fix Qt runtime warning: "QPixmap::scaled: Pixmap is a null pixmap"

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 22 02:32:56 UTC 2020


Author: jghali
Date: Sun Nov 22 02:32:56 2020
New Revision: 24274

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24274
Log:
Fix Qt runtime warning: "QPixmap::scaled: Pixmap is a null pixmap"

Modified:
    trunk/Scribus/scribus/undogui.cpp

Modified: trunk/Scribus/scribus/undogui.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24274&path=/trunk/Scribus/scribus/undogui.cpp
==============================================================================
--- trunk/Scribus/scribus/undogui.cpp	(original)
+++ trunk/Scribus/scribus/undogui.cpp	Sun Nov 22 02:32:56 2020
@@ -438,22 +438,24 @@
 {
 	/*TODO: 16x16 is hardcoded, because images automatically scaled by QIcon are no longer recognizable 
 	would be better to have the icons designed for 16x16*/
-	if (!targetPixmap)
-	{
-		if (actionPixmap)
-			setIcon(actionPixmap->scaled(16,16));
-	}
-	else
-	{
-		QPixmap pixmap(targetPixmap->scaled(16,16));
-		if (actionPixmap)
+	if (targetPixmap)
+	{
+		QPixmap pixmap;
+		if (!targetPixmap->isNull())
+			pixmap = targetPixmap->scaled(16, 16);
+		if (actionPixmap && !actionPixmap->isNull())
 		{
 			QPainter p;
 			p.begin(&pixmap);
-			p.drawPixmap(0,0, actionPixmap->scaled(16,16));
+			p.drawPixmap(0,0, actionPixmap->scaled(16, 16));
 			p.end();
 		}
 		setIcon(pixmap);
+	}
+	else
+	{
+		if (actionPixmap && !actionPixmap->isNull())
+			setIcon(actionPixmap->scaled(16, 16));
 	}
 	setText(tr("%1 - %2\n%3").arg(targetName, actionName, actionDescription));
 }




More information about the scribus-commit mailing list