r23330 by craig - Minor fixes

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 4 23:26:15 UTC 2019


Author: craig
Date: Mon Nov  4 23:26:15 2019
New Revision: 23330

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23330
Log:
Minor fixes

Modified:
    trunk/Scribus/scribus/sclistboxpixmap.h
    trunk/Scribus/scribus/ui/charselect.cpp

Modified: trunk/Scribus/scribus/sclistboxpixmap.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23330&path=/trunk/Scribus/scribus/sclistboxpixmap.h
==============================================================================
--- trunk/Scribus/scribus/sclistboxpixmap.h	(original)
+++ trunk/Scribus/scribus/sclistboxpixmap.h	Mon Nov  4 23:26:15 2019
@@ -41,15 +41,12 @@
 template<unsigned int pixWidth, unsigned int pixHeight> 
 QScopedPointer<QPixmap> ScListBoxPixmap<pixWidth, pixHeight>::pmap;
 
-
 template<unsigned int pixWidth, unsigned int pixHeight>
 ScListBoxPixmap<pixWidth, pixHeight>::ScListBoxPixmap(void) : QAbstractItemDelegate()
 {
 	if (pmap.isNull())
-	{
-		pmap.reset( new QPixmap(pixWidth, pixHeight) );
-	}
-};
+		pmap.reset(new QPixmap(pixWidth, pixHeight));
+}
 
 
 template<unsigned int pixWidth, unsigned int pixHeight>
@@ -66,17 +63,16 @@
 	else
 	{
 		h = qMax( pmap->height(), metrics.lineSpacing() + 2 );
+		//FIXME: metrics.width replacement by horizontalAdvance requires Qt 5.11+
 		w = pmap->width() + metrics.width(text(data)) + 6;
 	}
 	return QSize(qMax(w, QApplication::globalStrut().width()), qMax( h, QApplication::globalStrut().height()));
-};
+}
 
 
 template<unsigned int pixWidth, unsigned int pixHeight>
 void ScListBoxPixmap<pixWidth, pixHeight>::paint(QPainter * qpainter, const QStyleOptionViewItem & option, const QModelIndex & index) const
 {
-	int yPos;
-	
 	const QVariant data(index.data(Qt::UserRole));
 	redraw(data);
 	
@@ -89,8 +85,9 @@
 	qpainter->setRenderHint(QPainter::Antialiasing, true);
 	qpainter->setPen(Qt::NoPen);
 
-	if ( !pmap->isNull() ) {
-		yPos = ( itemHeight - pmap->height() ) / 2;
+	if ( !pmap->isNull() )
+	{
+		int yPos = ( itemHeight - pmap->height() ) / 2;
 		qpainter->drawPixmap( option.rect.x() + 3, option.rect.y() + yPos, *pmap);
 	}
 	if (option.state & QStyle::State_Selected)
@@ -99,14 +96,15 @@
 		qpainter->setBrush(QBrush(Qt::black));
 	qpainter->setPen(Qt::black);
 	
-	QString txt = index.data(Qt::DisplayRole).toString();
+	QString txt(index.data(Qt::DisplayRole).toString());
 
-	if ( !txt.isEmpty() ) {
+	if ( !txt.isEmpty() )
+	{
 		QFontMetrics fm = qpainter->fontMetrics();
-		yPos = ( ( itemHeight - fm.height() ) / 2 ) + fm.ascent();
+		int yPos = ( ( itemHeight - fm.height() ) / 2 ) + fm.ascent();
 		qpainter->drawText( option.rect.x() + pmap->width() + 5, option.rect.y() + yPos, txt );
 	}
 	qpainter->restore();
-};
+}
 
 #endif

Modified: trunk/Scribus/scribus/ui/charselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23330&path=/trunk/Scribus/scribus/ui/charselect.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.cpp	(original)
+++ trunk/Scribus/scribus/ui/charselect.cpp	Mon Nov  4 23:26:15 2019
@@ -288,7 +288,7 @@
 		else
 		{
 			ScMessageBox::warning(this, tr("Error"),
-				                    "<qt>" + tr("Error reading file %1 - file is corrupted propably.").arg(f) + "</qt>",
+				                    "<qt>" + tr("Error reading file %1 - file is probably corrupted.").arg(f) + "</qt>",
 				                    QMessageBox::Ok, QMessageBox::NoButton);
 			break;
 		}




More information about the scribus-commit mailing list