r25116 by jghali - Code style fixes for symbol palette

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 30 23:46:06 UTC 2022


Author: jghali
Date: Thu Jun 30 23:46:05 2022
New Revision: 25116

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25116
Log:
Code style fixes for symbol palette

Modified:
    trunk/Scribus/scribus/ui/symbolpalette.cpp
    trunk/Scribus/scribus/ui/symbolpalette.h

Modified: trunk/Scribus/scribus/ui/symbolpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25116&path=/trunk/Scribus/scribus/ui/symbolpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/symbolpalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/symbolpalette.cpp	Thu Jun 30 23:46:05 2022
@@ -42,8 +42,8 @@
 	setResizeMode(QListView::Adjust);
 	setSelectionMode(QAbstractItemView::SingleSelection);
 	setContextMenuPolicy(Qt::CustomContextMenu);
-	delegate = new ScListWidgetDelegate(this, this);
-	setItemDelegate(delegate);
+	m_delegate = new ScListWidgetDelegate(this, this);
+	setItemDelegate(m_delegate);
 	setIconSize(QSize(48, 48));
 	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(handleContextMenu(QPoint)));
 }
@@ -58,16 +58,16 @@
 	QAction* viewAct;
 	viewAct = pmenu->addAction( tr("Display Icons only"));
 	viewAct->setCheckable(true);
-	viewAct->setChecked(delegate->iconOnly());
+	viewAct->setChecked(m_delegate->iconOnly());
 	connect(viewAct, SIGNAL(triggered()), this, SLOT(changeDisplay()));
 	pmenu->exec(QCursor::pos());
-	delete pmenu;
+	pmenu->deleteLater();
 }
 
 void SymbolView::changeDisplay()
 {
 	reset();
-	delegate->setIconOnly(!delegate->iconOnly());
+	m_delegate->setIconOnly(!m_delegate->iconOnly());
 	repaint();
 }
 
@@ -190,7 +190,7 @@
 	connect(delAct, SIGNAL(triggered()), this, SLOT(handleDeleteItem()));
 
 	pmenu->exec(QCursor::pos());
-	delete pmenu;
+	pmenu->deleteLater();
 }
 
 void SymbolPalette::handleDoubleClick(QListWidgetItem *item)
@@ -291,9 +291,10 @@
 
 	QStringList patK = m_doc->docPatterns.keys();
 	patK.sort();
-	for (int a = 0; a < patK.count(); a++)
-	{
-		ScPattern sp = m_doc->docPatterns.value(patK[a]);
+	for (int i = 0; i < patK.count(); ++i)
+	{
+		const QString& patternName = patK.at(i);
+		ScPattern sp = m_doc->docPatterns.value(patternName);
 		QPixmap pm;
 		if (sp.getPattern()->width() >= sp.getPattern()->height())
 			pm = QPixmap::fromImage(sp.getPattern()->scaledToWidth(48, Qt::SmoothTransformation));
@@ -305,8 +306,8 @@
 		p.begin(&pm2);
 		p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm);
 		p.end();
-		QListWidgetItem *item = new QListWidgetItem(pm2, patK[a], SymbolViewWidget);
-		if (editItemNames.contains(patK[a]))
+		QListWidgetItem *item = new QListWidgetItem(pm2, patternName, SymbolViewWidget);
+		if (editItemNames.contains(patternName))
 			item->setFlags(Qt::NoItemFlags);
 		else
 			item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);

Modified: trunk/Scribus/scribus/ui/symbolpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25116&path=/trunk/Scribus/scribus/ui/symbolpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/symbolpalette.h	(original)
+++ trunk/Scribus/scribus/ui/symbolpalette.h	Thu Jun 30 23:46:05 2022
@@ -67,7 +67,7 @@
 	void objectDropped();
 
 private:
-	ScListWidgetDelegate* delegate;
+	ScListWidgetDelegate* m_delegate { nullptr };
 };
 
 class SCRIBUS_API SymbolPalette : public ScDockPalette




More information about the scribus-commit mailing list