r19269 by craig - Fix QComboBox events not triggering in ScTableWidget

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 23 08:56:27 UTC 2014


Author: craig
Date: Mon Jun 23 08:56:27 2014
New Revision: 19269

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19269
Log:
Fix QComboBox events not triggering in ScTableWidget

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

Modified: trunk/Scribus/scribus/ui/sctablewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19269&path=/trunk/Scribus/scribus/ui/sctablewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/sctablewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/sctablewidget.cpp Mon Jun 23 08:56:27 2014
@@ -6,6 +6,7 @@
 */
 #include "sctablewidget.h"
 
+#include <QDebug>
 //Widgets supported
 #include <QComboBox>
 #include <QCheckBox>
@@ -68,8 +69,30 @@
 	return QTableWidget::eventFilter(obj, event);
 }
 
+void ScTableWidget::comboBoxReceiver(int i)
+{
+	if (sender()!=0)
+	{
+		QComboBox* comboBox = qobject_cast<QComboBox*>(sender());
+		if (comboBox)
+		{
+			int r=-1, c=-1;
+			if (widgetPositions.contains(comboBox))
+			{
+				r=widgetPositions.value(comboBox).first;
+				c=widgetPositions.value(comboBox).second;
+			}
+			if (r!=-1 && c!=-1)
+				emit cellChanged(r,c);
+		}
+	}
+}
+
 void ScTableWidget::setCellWidget(int row, int column, QWidget * widget)
 {
+	QComboBox* combobox = qobject_cast<QComboBox*>(widget);
+	if (combobox)
+		connect(combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBoxReceiver(int)));
 	widget->installEventFilter(this);
 	QTableWidget::setCellWidget(row, column, widget);
 	widgetPositions.insert(widget, QPair<int, int>(row, column));

Modified: trunk/Scribus/scribus/ui/sctablewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19269&path=/trunk/Scribus/scribus/ui/sctablewidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/sctablewidget.h (original)
+++ trunk/Scribus/scribus/ui/sctablewidget.h Mon Jun 23 08:56:27 2014
@@ -28,6 +28,9 @@
 
 	private:
 		QHash<QWidget*, QPair<int, int> > widgetPositions;
+
+	protected slots:
+		void comboBoxReceiver(int i);
 };
 
 #endif




More information about the scribus-commit mailing list