[PyQt] QTableWidget - pyuic does not compile several attributes

Hans-Peter Jansen hpj at urpla.net
Fri Jul 29 10:02:05 BST 2011


On Thursday 28 July 2011, 19:45:40 Phil Thompson wrote:
> On Thu, 28 Jul 2011 01:58:38 +0100, "Protopia" <pyqt4 at protopia.co.uk>
>
> >
> > And then I ran the compiler and looked at the code (attached) and
> > found the following things missing:
> >
> >
> > QTableWidget:
> >
> > 1.     .font.Kerning not compiled.
>
> Fixed.
>
> > 2.     .font.Antialiasing not compiled
>
> Fixed.
>
> > 3.     .QTableView.sortingEnabled is placed in reTranslateUI -
> > however this does not seem to be concerned with
> > internationalisation and I feel should be in the main code (though
> > I could easily be wrong here)
>
> This is a side effect of the way i18n support is implemented.
>
> > 4.     .QTableWidget.rowCount & .columnCount - if these are
> > specified explicitly in QT Designer then they appear twice in the
> > .py file. (Of course this won't cause major problems, but is
> > nevertheless inappropriate.)
>
> Fixed.
>
> > QTableWidgetItem
> >
> > 1.     Horizontal and Vertical header tooltips, whatsthis, fonts,
> > textalign, background and foreground are not compiled at all.
>
> Fixed.
>
> > 2.     Cell tooltips, whatsthis, fonts and textalign are not
> > compiled at all.
>
> Fixed.
>
> > 3.     Cell background and foreground are compiled, however
> > sequence of statements is wrong - sets brush twice, then assigns
> > second definition to both background and foreground.
>
> Fixed.
>
> > Rgds, P
>
> I think QListWidgetItem and QTreeWidgetItem will have similar
> problems but I'll look at those tomorrow.

Awesome, Phil.

Comparing output from uic with current pyuic4, I noticed, that uic will 
only set the objectName, if not done already:

        if (WidgetName->objectName().isEmpty())
            WidgetName->setObjectName(QString::fromUtf8("WidgetName"));

That looks useful.

From a further cursory look, the IBeamCursor is set on the viewport:

        tableWidget->viewport()->setProperty("cursor", QVariant(QCursor(Qt::IBeamCursor)));

instead of:

        self.tableWidget.setProperty(_fromUtf8("cursor"), QtCore.Qt.IBeamCursor)

Also note, that properties aren't fed through fromUtf8.

Cheers,
Pete


More information about the PyQt mailing list