[Qt-interest] How to get selected listitem index in Qt

Abhishek abhishekworld at gmail.com
Fri Apr 16 08:46:56 CEST 2010


assuming you will select item on mouse click if that's the case then use void
QAbstractItemView::clicked ( const QModelIndex & *index* )  here is the link
... http://doc.trolltech.com/4.6/qabstractitemview.html#clicked

enjoy,

On Fri, Apr 16, 2010 at 12:08 PM, Ramesh <ramesh.bs at robosoftin.com> wrote:

> Ya, I gone through the documentation I had fount this selectedIndexes (),
> but selected indexes will give the list, we need to iterate
>
> for getting the modelindex.
>
> But I wanted an API which gives the selected item modelindex in one shot..
> iterating the list is time consuming right..
>
>
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Rainer Wiesenfarth
> Sent: Friday, April 16, 2010 11:57 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] How to get selected listitem index in Qt
>
>
> From: Ramesh
> >   I am having a QListView which having some items. Now i want to get
> > the index of selected item. i.e. if i select 5th element i should get
> > 5. How i can get this?..
>
> QModelIndexList  QAbstractItemView::selectedIndexes () const
>
> ... should be a good starting point for browsing through the documentation.
>
> Best Regards / Mit freundlichen Grüßen
> Rainer Wiesenfarth
>
> --
> INPHO GmbH * Smaragdweg 1 * 70174 Stuttgart * Germany
> phone: +49 711 2288 10 * fax: +49 711 2288 111 * web: www.inpho.de place
> of
> business: Stuttgart * managing director: Johannes Saile commercial
> register:
> Stuttgart, HRB 9586 Leader in Photogrammetry and Digital Surface Modelling
>
> -----------------------------------------------
> Robosoft Technologies - Come home to Technology
>
> Disclaimer: This email may contain confidential material. If you were not
> an intended recipient, please notify the sender and delete all copies.
> Emails to and from our network may be logged and monitored. This email and
> its attachments are scanned for virus by our scanners and are believed to be
> safe. However, no warranty is given that this email is free of malicious
> content or virus.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
Abhishek Patil
URL: http://thezeroth.net
"Imagination is more important than knowledge..." -Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100416/2598cccd/attachment.html 


More information about the Qt-interest-old mailing list