KConfigDialogManager ruby patch

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Jan 25 10:17:58 GMT 2005


The code in KConfigDialogManager looks for widgets with names 'kcfg_*' which 
are certain specific Qt/KDE classes such as QWidget. However, in the ruby 
bindings a ruby QWidget is actually a subclass Qt::Widget and so it doesn't 
get found. The following patch searches for the immediate superclass of a 
kcfg_ widget if the actual class isn't found in the changedMap of monitored 
widget names.

Index: kconfigdialogmanager.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kconfigdialogmanager.cpp,v
retrieving revision 1.13
diff -u -r1.13 kconfigdialogmanager.cpp
--- kconfigdialogmanager.cpp	20 Sep 2004 16:40:41 -0000	1.13
+++ kconfigdialogmanager.cpp	25 Jan 2005 11:10:10 -0000
@@ -179,6 +179,12 @@
         setupWidget(childWidget, item);
 
         QMap<QString, QCString>::const_iterator changedIt = 
changedMap.find(childWidget->className());
+
+        if (changedIt == changedMap.end())
+        {
+          changedIt = 
changedMap.find(childWidget->metaObject()->superClassName());
+        }
+
         if (changedIt == changedMap.end())
         {
           kdWarning(178) << "Don't know how to monitor widget '" << 
childWidget->className() << "' for changes!" << endl;

The disadvantage is that it tests twice for equality against 'changedIt', but 
I assume that is an effecient operation, and it doesn't end up traversing the 
map or anything. I could work round the problem by calling the ruby classes 
QWidget instead of Qt::Widget, but I'd rather not as it's a useful way to 
tell the difference between a widget allocated from C++, and one allocated 
from ruby.

Is it ok to commit this?

-- Richard




More information about the kde-core-devel mailing list