Hi all
Please tell me can we use both concept of Subclass and connections (Signals and Slots ) together . If yes then How ? Explain with an example.
Thanx and Regards
merry
Printable View
Hi all
Please tell me can we use both concept of Subclass and connections (Signals and Slots ) together . If yes then How ? Explain with an example.
Thanx and Regards
merry
What do you mean :confused:Quote:
Please tell me can we use both concept of Subclass and connections (Signals and Slots ) together.
We are not giving any test ;)Quote:
If yes then How ? Explain with an example.
Mr Sunil
I Know U people are not giving anykind of test.;)
I just simply asked u people that can we use connections and Subclassing together becoz
I didnt know about this if u people know about this then tell me , dats it.:)
merry
I'm just like Sunil, I don't understand your request...
Explain with a little example :)
Hi
Exactly My Problem is that
I am having a treeStructure of Files and Folders and I had represented files and folders with different different images.
Foreg.
now when i pressed any File or Folder it can be replaced by another image likeQuote:
Files are represented by Fileunchecked.png
Folders are represented by Folderunchecked.png
For this I used the concept of Connections using Signals and SlotsQuote:
Fileunchecked.png is replaced by Filechecked.png
and
Folderunchecked.png is replaced by Folderchecked.png
By using this the images are changed.Quote:
connect(listView,SIGNAL(pressed(QListViewItem*)),t his,SLOT(reverse_images(QListViewItem*)));
But now I want when I again Click on any File or Folder (that are checked) can be replaced by File or Folder (that are unchecked)
That is
Actually i want to flip the image back to the one that was there before. For this I want to use the concept of Subclassing. But I dont know how to use. If you understand my Problem then Please tell me How can I use Subclassing for this.Hope You can understand what I want to say. :)Quote:
Filechecked.png is replaced by Fileunchecked.png
and
Folderchecked.png is replaced by Folderunchecked.png
Why do you want to use Subclassing for this. ? reverse_images can check the state of the item passes and toggle the images.
This thread is related to this one:
http://www.qtcentre.org/forum/f-qt-p...ages-5835.html
I really suggest to learn a little of C++ before starting with Qt...
Merry - in practice you can't use signal/slot connections without subclassing as all classes that use signals and slots inherit QObject class which implements signals and slots mechanism. So to answer your question - yes, it is possible to both subclass and use signals and slots. Still, I suggest to read a little about inheritance and polymorphism.
yaa
WySota I know little about C++ and also know About inheritance but dont Know How to implement it in Qt.
Wysota I just want to make u request that please help me in learning Qt.
I m a beginner in Qt and know very little about Qt.
Thanx merry
You don't "implement" inheritance in Qt - inheritance is part of the C++ language - just use it.
Your problem is C++, not Qt. Did you take a look at Johan's Independent Qt Tutorial?Quote:
Wysota I just want to make u request that please help me in learning Qt.
I m a beginner in Qt and know very little about Qt.
Thanx
Now i ll try to first learn C++ and Then Qt
merry
Take a look at the tutorial I mentioned. Some things should become clear when you do.