[PyKDE] Whats wrong with QHeader.setLabel() ??

Phil Thompson phil at river-bank.demon.co.uk
Tue May 7 18:59:01 BST 2002


"Anatoly V. Rudnev" wrote:
> 
> I'm beginner 8-((( with Python and PythonQT, but by some reasons I have to
> write Network Management Suite for KDE
> 
> I'd like to use pixmap in rows/columns headers in a Table widget. It's
> possible? How?  Test module will fail 8-((
> 
> === Please find python module attached to this message ( built by pyuic from
> ui file created in QT Designer)
> 
> === Error message
> Traceback (most recent call last):
>   File "sql_demo", line 169, in ?
>     w = MyDialog1()
>   File "sql_demo", line 124, in __init__
>     self.Table1.verticalHeader().setLabel(self.Table1.numRows() -
> 1,image0,self.trUtf8("1"))
> TypeError: Argument 2 of QHeader.setLabel() has an invalid type
> Mutex destroy failure: Device or resource busy
> ==== End of Error message

It's a pyuic bug. The attached patch should fix it.

If it doesn't then send me the .ui file.

Phil
-------------- next part --------------
--- uic.cpp.orig	Tue May  7 17:38:26 2002
+++ uic.cpp	Tue May  7 17:42:08 2002
@@ -619,8 +619,8 @@
 	    s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1,"
 		 + trcall( txt, com ) + ")\n";
 	else
-	    s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1,"
-		 + pix + "," + trcall( txt, com ) + ")\n";
+	    s += indent + parent + ".verticalHeader().setLabel(" + parent + ".numRows() - 1,QIconSet("
+		 + pix + ")," + trcall( txt, com ) + ")\n";
     } else {
 	if ( objClass == "QTable" ) {
 	    s = indent + parent + ".setNumCols(" + parent + ".numCols() + 1)\n";
@@ -628,14 +628,14 @@
 		s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1,"
 		     + trcall( txt, com ) + ")\n";
 	    else
-		s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1,"
-		     + pix + "," + trcall( txt, com ) + ")\n";
+		s += indent + parent + ".horizontalHeader().setLabel(" + parent + ".numCols() - 1,QIconSet("
+		     + pix + ")," + trcall( txt, com ) + ")\n";
 	} else if ( objClass == "QDataTable" ) {
 	    if ( !txt.isEmpty() && !field.isEmpty() ) {
 		if ( pix.isEmpty() )
 		    out << indent << parent << ".addColumn(" << fixString( field ) << "," << trcall( txt, com ) << ")" << endl;
 		else
-		    out << indent << parent << ".addColumn(" << fixString( field ) << "," << trcall( txt, com ) << "," << pix << ")" << endl;
+		    out << indent << parent << ".addColumn(" << fixString( field ) << "," << trcall( txt, com ) << ",QIconSet(" << pix << "))" << endl;
 	    }
 	}
     }



More information about the PyQt mailing list