[Kde-bindings] puic QListView code generation problem

Germain Garand germain at ebooksfrance.org
Mon Sep 1 10:58:28 UTC 2003


Le Lundi 01 Septembre 2003 10:15, Richard Dale a écrit :
> I've just been updating the rbuic for the Qt 3.2 style of uic code
> generation - it generates a 'languageChanged()' slot where all the text
> items of the widgets are set up.

Richard, you are a machine!
It took me monthes before I found the motivation to do it...

> When the puic is updated, it might help to

In fact, I did that some weeks ago, at last

> do a patch of rbuic before and after to see what's changed. It was really
> fiddly using Kate with the split view going through the uic and rbuic
> sources visually inspecting what had changed.
>

I know _exactly_ what you mean

> While I was doing that, I noticed a subtle problem in the puic code
> generation for the QListView in the widgetsbase.ui example used in the Qt
> demo.

Yes, I had a BR about that. I fixed it during the last part of the merge as 
well.

> Each time it creates a new ListViewItem under ListView3, it adds it after
> '$item'. This is the C++ version, which looks pretty similar, so I assume
> the problem is related to declaring 'my $item' several times.
>

It was a problem of registration of unique object names.
See the diff for createListViewItemImpl in uic.cpp -r1.7 vs. 1.8

it now looks like this:

QString Uic::createListViewItemImpl( const QDomElement &e, const QString 
&parent,
                                     const QString &parentItem )
{
    QString s;

    QDomElement n = e.firstChild().toElement();

    bool hasChildren = e.elementsByTagName( "item" ).count() > 0;
    QString item;

    if ( hasChildren ) {
        item = "$" + registerObject( "item" );
        s = indent + "my " + item + " = ";
    } else {
        item = "$item";
        if ( item_used )
            s = indent + item + " = ";
        else
            s = indent + "my " + item + " = ";
        item_used = TRUE;
    }

    if ( !parentItem.isEmpty() )

> PS: Apologies for incoherent drunk Saturday night postings on the kde-perl
> list, and perl cluelessness - I've banned myself now! No ruby on kde-perl,
> only here on kdebindings, as it confuses everyone (and even when I'm sober
> maybe :) ).

Oh, please, on the contrary!
Your post about Perl vs. Ruby was simply wonderful...
I was there, giving the manly nudge and call for emulation (which is 
absolutely not like me :), and you answered with gorgeous humor and poetry!

[plus, your intuition is very well founded... though we say "une perle" 
(pearl),  Perl is still strongly masculine in french, as if accounting for 
the strong "macho" tendancy of its programmers :-) ]

Germain


More information about the Kde-bindings mailing list