[PyKDE] Error when overloading QTable.paintCell

Frederick Polgardy Jr polgardy at bodacion.com
Fri Jun 13 18:19:00 BST 2003


Weird, if you add the QColorGroup arg to both (the other overloaded version 
of the method), you then get the opposite exception!:

...
    def paintCell(self, painter, row, col, rect, selected, cg):
        QTable.paintCell(self, painter, row, col, rect, selected, cg)
...

TypeError: paintCell() takes exactly 7 arguments (6 given)

Could SIP be mixing up which version is getting mapped to which C++ method?  
I built the exact app in C++ and it works fine:

#include <qapplication.h>
#include <qmainwindow.h>
#include <qtable.h>
#include <qstring.h>

class RC: public QTable
{
  public:
   RC(QWidget* parent):
      QTable(2, 2, parent)
      {}

   virtual void paintCell(QPainter* p,
                          int r,
                          int c,
                          const QRect& rc,
                          bool s)
   {
      QTable::paintCell(p, r, c, rc, s);
   }
};

int main(int argc, char** argv)
{
   QApplication app(argc, argv);
   QMainWindow* w = new QMainWindow;
   w->setGeometry(0, 0, 400, 400);
   app.setMainWidget(w);

   RC* rc = new RC(w);

   rc->show();
   w->show();
   return app.exec();
}

On Friday 13 June 2003 10:49 am, marvelan L wrote:
> Hi all,
>
> Could somebody explain why my effort to overload the paintCell method of
> the QTable fails?
> I get the following error message:
>
>        TypeError: paintCell() takes exactly 6 arguments (7 given)
>
> when I run the code below:

-- 
F R E D E R I C K   P O L G A R D Y   J R.
Bodacion Technologies
18-3 E Dundee Road - Suite 300 - Barrington, IL 60010
Phone: 847/842.9008 - Fax: 847/842-1731
Web: http://www.bodacion.com




More information about the PyQt mailing list