From kjsembed Mon Dec 06 14:32:34 2004 From: Ian Reinhart Geiser Date: Mon, 06 Dec 2004 14:32:34 +0000 To: kjsembed Subject: Re: [kjsembed] QListView confusion Message-Id: <200412060932.35098.ian () geiseri ! com> X-MARC-Message: https://marc.info/?l=kjsembed&m=110234356812250 On Monday 06 December 2004 07:05 am, Håvard Dahle wrote: > This is my first post, so let me start off by saying hi: HI LIST! > hi! > Right. I have little experience with the QT api, and I've run into some > problems with QListView that for the life of me I cannot solve on my > own. Thus this message. > > 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 to get the list items whipped into shape, as 3.3 had a few "issues". I think in 3.3. the most reliable way to get data back was attaching to the signal highlighted(const QString &). Example: function manipulateStaticObject( item ) { alert( item + " was selected." ); } StaticObjectList = new QListView(this); StaticObjectList.connect( StaticObjectList, 'highlighted(const QString&)', this, 'manipulateStaticObject' ); 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. > 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. > - 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. Cheers -ian reinhart geiser -- =======++=++=== Report for Philadelphia, Northeast Philadelphia Airport on Monday 06 December 2004 07:54 am 3.3°C with winds at 16 km/h ENE and 16km of visibility. ===============================++======= _______________________________________________ kjsembed mailing list kjsembed@kde.org https://mail.kde.org/mailman/listinfo/kjsembed