r24941 by jghali - Fix "Insert Shape" menu not reacting on icon set change

scribus-commit scribus-commit at lists.scribus.net
Wed Feb 16 22:09:55 UTC 2022


Author: jghali
Date: Wed Feb 16 22:09:55 2022
New Revision: 24941

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24941
Log:
Fix "Insert Shape" menu not reacting on icon set change

Modified:
    branches/Version15x/Scribus/scribus/ui/autoform.cpp
    branches/Version15x/Scribus/scribus/ui/autoform.h
    branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.cpp
    branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.h
    branches/Version15x/Scribus/scribus/ui/modetoolbar.cpp
    branches/Version15x/Scribus/scribus/ui/modetoolbar.h

Modified: branches/Version15x/Scribus/scribus/ui/autoform.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24941&path=/branches/Version15x/Scribus/scribus/ui/autoform.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/autoform.cpp	(original)
+++ branches/Version15x/Scribus/scribus/ui/autoform.cpp	Wed Feb 16 22:09:55 2022
@@ -7,6 +7,7 @@
 
 #include "autoform.h"
 #include "autoformbuttongroup.h"
+#include "scribusapp.h"
 
 Autoforms::Autoforms( QWidget* parent ) : QToolButton( parent )
 {
@@ -14,7 +15,14 @@
 	setMenu(buttonGroup1);
 	setPopupMode(QToolButton::InstantPopup);
 	setIcon(QIcon(buttonGroup1->getIconPixmap(0)));
+
+	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 	connect(buttonGroup1, SIGNAL(buttonClicked(int)), this, SLOT(selForm(int)));
+}
+
+void Autoforms::iconSetChange()
+{
+	setIcon(QIcon(buttonGroup1->getIconPixmap(0)));
 }
 
 void Autoforms::selForm(int a)

Modified: branches/Version15x/Scribus/scribus/ui/autoform.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24941&path=/branches/Version15x/Scribus/scribus/ui/autoform.h
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/autoform.h	(original)
+++ branches/Version15x/Scribus/scribus/ui/autoform.h	Wed Feb 16 22:09:55 2022
@@ -27,12 +27,13 @@
 
 public slots:
 	void selForm(int a);
+	void iconSetChange();
 
 signals:
 	void FormSel(int, int, qreal *);
 
 protected:
-	AutoformButtonGroup* buttonGroup1;
+	AutoformButtonGroup* buttonGroup1 { nullptr };
 };
 
 #endif

Modified: branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24941&path=/branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.cpp	(original)
+++ branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.cpp	Wed Feb 16 22:09:55 2022
@@ -12,8 +12,9 @@
 
 #include "autoformbuttongroup.h"
 #include "fpointarray.h"
+#include "iconmanager.h"
 #include "scpainter.h"
-#include "iconmanager.h"
+#include "scribusapp.h"
 
 AutoformButtonGroup::AutoformButtonGroup( QWidget* parent ) : QMenu( parent )
 {
@@ -73,6 +74,8 @@
 	addMenu(menu3);
 	addMenu(menu4);
 	addMenu(menu5);
+
+	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 	connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(selForm(int)));
 }
 
@@ -769,6 +772,21 @@
 		QMenu::changeEvent(e);
 }
 
+void AutoformButtonGroup::iconSetChange()
+{
+	for (int i = 0; i <= 44; ++i)
+	{
+		QObject* mappedObject = signalMapper->mapping(i);
+		if (!mappedObject)
+			continue;
+
+		QAction* action = qobject_cast<QAction*>(mappedObject);
+		if (!action)
+			continue;
+		action->setIcon(QIcon(getIconPixmap(i, 16)));
+	}
+}
+
 void AutoformButtonGroup::languageChange()
 {
 	menu1->setTitle( tr("Default Shapes"));

Modified: branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24941&path=/branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.h
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.h	(original)
+++ branches/Version15x/Scribus/scribus/ui/autoformbuttongroup.h	Wed Feb 16 22:09:55 2022
@@ -29,6 +29,7 @@
 
 public slots:
 	void selForm(int a);
+	void iconSetChange();
 	void languageChange();
 
 signals:
@@ -36,12 +37,12 @@
 	void buttonClicked(int);
 
 protected:
-	QSignalMapper *signalMapper;
-	QMenu *menu1;
-	QMenu *menu2;
-	QMenu *menu3;
-	QMenu *menu4;
-	QMenu *menu5;
+	QSignalMapper *signalMapper { nullptr };
+	QMenu *menu1 { nullptr };
+	QMenu *menu2 { nullptr };
+	QMenu *menu3 { nullptr };
+	QMenu *menu4 { nullptr };
+	QMenu *menu5 { nullptr };
 
 	void changeEvent(QEvent *e) override;
 };

Modified: branches/Version15x/Scribus/scribus/ui/modetoolbar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24941&path=/branches/Version15x/Scribus/scribus/ui/modetoolbar.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/modetoolbar.cpp	(original)
+++ branches/Version15x/Scribus/scribus/ui/modetoolbar.cpp	Wed Feb 16 22:09:55 2022
@@ -33,6 +33,7 @@
 #include "polyprops.h"
 #include "scraction.h"
 #include "scribus.h"
+#include "scribusapp.h"
 #include "scribusdoc.h"
 #include "scrspinbox.h"
 
@@ -44,7 +45,7 @@
 									100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 100.0, 0.0, 100.0,
 									0.0, 100.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0};
 	ShapeVals = AutoShapes0;
-	m_ScMW=parent;
+	m_ScMW = parent;
 	this->addAction(m_ScMW->scrActions["toolsSelect"]);
 	this->addAction(m_ScMW->scrActions["toolsInsertTextFrame"]);
 	this->addAction(m_ScMW->scrActions["toolsInsertImageFrame"]);
@@ -106,9 +107,11 @@
 	this->addAction(m_ScMW->scrActions["toolsEyeDropper"]);
 
 	languageChange();
+
 	connect(autoFormButtonGroup, SIGNAL(FormSel(int, int, qreal *)), this, SLOT(SelShape(int, int, qreal *)));
 	connect(Angle, SIGNAL(valueChanged(double)), this, SLOT(newCalValues()));
 	connect(PWidth, SIGNAL(valueChanged(double)), this, SLOT(newCalValues()));
+	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 }
 
 ModeToolBar::~ModeToolBar()
@@ -136,7 +139,7 @@
 
 void ModeToolBar::SelShape(int s, int c, qreal *vals)
 {
-	m_ScMW->scrActions["toolsInsertShape"]->setIcon(QIcon(autoFormButtonGroup->getIconPixmap(s,16)));
+	m_ScMW->scrActions["toolsInsertShape"]->setIcon(QIcon(autoFormButtonGroup->getIconPixmap(s, 16)));
 	SubMode = s;
 	ValCount = c;
 	ShapeVals = vals;
@@ -160,6 +163,11 @@
 	PWidth->setValue(doc->itemToolPrefs().calligraphicPenWidth);
 }
 
+void ModeToolBar::iconSetChange()
+{
+	m_ScMW->scrActions["toolsInsertShape"]->setIcon(QIcon(autoFormButtonGroup->getIconPixmap(0, 16)));
+}
+
 void ModeToolBar::languageChange()
 {
 	AngleTxt->setText(tr("Angle:"));

Modified: branches/Version15x/Scribus/scribus/ui/modetoolbar.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24941&path=/branches/Version15x/Scribus/scribus/ui/modetoolbar.h
==============================================================================
--- branches/Version15x/Scribus/scribus/ui/modetoolbar.h	(original)
+++ branches/Version15x/Scribus/scribus/ui/modetoolbar.h	Wed Feb 16 22:09:55 2022
@@ -57,31 +57,31 @@
 
 	void changeEvent(QEvent *e) override;
 	void setDoc(ScribusDoc* doc);
-	int SubMode;
-	int ValCount;
-	double *ShapeVals;
+
+	int SubMode { 0 };
+	int ValCount { 0 };
+	double *ShapeVals { nullptr };
 
 public slots:
 	void newCalValues();
 	void GetPolyProps();
 	void SelShape(int s, int c, qreal *vals);
-//	void getShapeValues(int& mode, double* values, int& count);
+	void iconSetChange();
 	void languageChange();
 		
 protected:
-	AutoformButtonGroup* autoFormButtonGroup;
-	QMenu* insertPolygonButtonMenu;
-	QAction* idInsertPolygonButtonMenu;
-	ScribusMainWindow* m_ScMW;
-	QWidget *propWidget;
-	QGridLayout* group1Layout;
-	QMenu* calPop;
-	QWidgetAction* calValAct;
-	QLabel *AngleTxt;
-	QLabel *PWidthTxt;
-	ScrSpinBox *Angle;
-	ScrSpinBox *PWidth;
-
+	AutoformButtonGroup* autoFormButtonGroup { nullptr };
+	QMenu* insertPolygonButtonMenu { nullptr };
+	QAction* idInsertPolygonButtonMenu { nullptr };
+	ScribusMainWindow* m_ScMW { nullptr };
+	QWidget *propWidget { nullptr };
+	QGridLayout* group1Layout { nullptr };
+	QMenu* calPop { nullptr };
+	QWidgetAction* calValAct { nullptr };
+	QLabel *AngleTxt { nullptr };
+	QLabel *PWidthTxt { nullptr };
+	ScrSpinBox *Angle { nullptr };
+	ScrSpinBox *PWidth { nullptr };
 };
 
 #endif




More information about the scribus-commit mailing list