[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kjsembed
Subject:    Re: [kjsembed] QListView confusion
From:       Håvard Dahle <havardda-dev () orakel ! ntnu ! no>
Date:       2004-12-10 16:23:49
Message-ID: 20041210162349.GA13823 () orakel ! ntnu ! no
[Download RAW message or body]

Sorry for the delay. I wrote this some days ago, but it got stuck in
mailman pending approval, since I sent it from a not-subscribed
address.

Ian Reinhart Geiser <ian@geiseri.com>, man 2004-12-06; 
> On Monday 06 December 2004 07:05 am, Håvard Dahle wrote:
> > I have a QListView (mode == "extended") made with QT Designer, and
> > loaded with Factory.loadui(). It is populated with items from a
> > database, using QListView.insertItem() as in the example qlistview.js.
> > This is all working fine.
> >
> > However, I want to retrieve the selected row(s) later on. And I really
> > can't figure out how to do that. I was hoping selectedIndex would tell
> > me something, but it doesn't.. And also, I don't understand how to
> > iterate the list. The c++ docs mention firstChild() and nextSibling()
> > but neither are implemented(?)
> >
> Are you using the version from CVS, and if so how recent.  I have been trying 

Yeah, I forgot: this is 0.3/3.3 from debian sid:
havard@rasha:~$ kjscmd -v
Qt: 3.3.3
KDE: 3.3.1
KJSCmd: 0.3

[...]
> 
> For iteration you could try: 
> QListView lv = new QListView(this);
> lvi = new QListViewItem(lv);
> lvi.setText(0,"Blah");
> for( var idx = 0; idx < lv.childCount; ++idx)
> 	println( lv.???) //nuts your right we dont have a way to get this :(

:)

> 
> I guess the best guide as to what is present is to use the documentation 
> viewer docs/examples/qdocviewer.  The one in head has a few more features but
> the main function of this tool is to introspect every type available to the 
> system, and to show you what methods it exports.  If something is there but
> it doesn't work, then its a bug, and if you report it we will try VERY hard to 
> fix it.

Thanks :)

> 
> > Here are my observations:
> >
> >  - QListView.child(i) doesn't behave like QGroupBox.child(i)
> I think both are reporting the first child widget inside of the object.  This 
> may be an incorrect side effect of the bindings we add to all QObject types 
> to allow for better manipulation under javascript.  I would have to look into 
> this one in more detail.
> 
> >  - typeof(QListView.childCount) == "number", whereas
> >    typeof(QGroupBox.childCount) == "function"
> i think this might be the same as with Qt, but it makes sense to me that they 
> are not equal since group box items are QWidgets, and list view items are 
> not.

Ok, but for c++ childCount can be both a function and a property, no?
(remember that I'm not really into c++, but I get the impression that it
can) From docviewer.js:
"""
int QListView::childCount () const 

Returns the number of parentless (top-level) QListViewItem objects in
this QListView. See the "childCount" property for details. 
"""

Wouldn't it make sense to be consistent in kjs, so that it's not a
property in one context and a function in another?

> >  - typeof(QListView.firstChild) == "undefined"
> Yeah this is not cool.  I will see about getting this resolved.
> >
> > Are these bugs, or am I totally off? Can someone please guide me in the
> > right direction?
> Some are, some are not ;)  This is all still very much a work in progress, but 
> we are now at the point where bugs take minutes to fix, vs months to fix.  So 
> keep using and reporting issues and we will see that we can get to the 3.4 
> release in style.

Cool! I have since I wrote this read your cvs logs, and you seem to have
remedied my problems. Thanks! Maybe I will even leave the debs and try
out head...

kjsembed hasn't seen much usage yet, but I guess it will pick up if/when
kdevelop gets its wizards/whatever and more scripts start to pop up
around. And maybe kjsembed should have its own category at kde-apps.

Also, since I've resigned to do my stuff in pyqt for the time being, it
is really striking how much easier than pyqt (imagine that) kjsembed
is...

Take care,
-- 
Håvard Dahle
orakel.ntnu.no/~havardda
_______________________________________________
kjsembed mailing list
kjsembed@kde.org
https://mail.kde.org/mailman/listinfo/kjsembed

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic