[Qt-interest] error in moc file

Ramesh ramesh.bs at robosoftin.com
Fri Mar 19 05:36:18 CET 2010


HI.. 
I have found solution to my problem.. thanks Oliver..


Bool val =
QObject::connect(mylistview->selectionModel(),SIGNAL(selectionChanged (const
QItemSelection &, const QItemSelection &)),this,SLOT(selchange(const
QItemSelection &, const QItemSelection &)));

I have got the selectionmodel object of my listview, with that I am calling
my own slot..




-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of
Oliver.Knoll at comit.ch
Sent: Thursday, March 18, 2010 8:31 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] error in moc file

Ramesh wrote on Thursday, March 18, 2010 10:34 AM:

> I am not getting exactly what you are telling, what is the use of
> overriding " selectionchange " method?

I wrote you should overwrite the 'setSelection' method, NOT
'selectionChanged' method (and be careful with your spelling, there is a 'd'
at the end - just in case...).

Anyway, I wasn't even aware that there is also a
http://doc.trolltech.com/4.6/qabstractitemview.html#selectionChanged method,
which is more convenient.

I understand you want to get a signal - say "signalSelectionChanged" -
whenever the selection in a QListView changes (in whatever way). QListView
itself does not provide such a signal (AFAIK, see
http://doc.trolltech.com/4.6/qlistview.html#signals), so simply:

1. Inherit from QAbstractItemView (or directly from QListView), say
"MyListView"

2. Overwrite selectionChanged (as you already did)

3. In your implementation, emit a signal "signalSelectionChanged"

4. Instantiate your custom "MyListView" instead of QListView and connect to
"signalSelectionChanged" as needed.
 
> I have done like this,
> 1)inherit the listview
> 2)override the "selectionchange" slot

So what does your implementation in "selectionChanged" look like? Do you
emit a custom signal, as suggested?

Again, this is 'selectionChanged'! Take care of your spelling, including
Capitalisation! Or you might not actually overwrite any method. (And yes, I
/do/ have my doubts that people write correct code if they do the same
spelling errors in emails ;)

> if I do this I am not getting the control only..

I don't understand this - what "control"? What does "not getting only" mean?
What is it exactly you want to "get"?


Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

-----------------------------------------------
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.



More information about the Qt-interest-old mailing list