Problem with QTableView and "connect"
-
Hi people,
i have a problem...
I'm using QTableView to have a a table where i'm going to display a columnList like this:@
QTableView* itemView;
QList<QStandardItem*> columnList;
@some of the items of the list are "Checkable".
I have associated an action to these time in this manner:
@
connect(itemView->model(), SIGNAL(itemChanged(QStandardItem*)), this, SLOT(selectedItemsChanged(QStandardItem*)))
@but, i need to understand which is the Item checked by the user, because i have a lots of items in the itemView.
How can i do??
Thanks[EDIT: fixed code formatting, Moved to general forum, Volker]
-
Thanks mod...
Sorry my slot is:
@ void MobilePhoneWidget::selectedItemsChanged(QStandardItem*){
@ system ("echo inside");}Can you add the code to use the item changed????
I'm a newbie of this language and i'm sorry if the question if really easy for you.
Thanks
-
This does not make much sense.
The signals that QTableView supports are "documented":http://developer.qt.nokia.com/doc/qt-4.7/qabstractitemview.html#signalSection here. As you see, there is no signal that sends pointers to QStandardItems around. The signal you try to connect to tells you something about the data of the item being changed. However, it's selection status is not part of its data[1].[1] I am working on a design for a new item view framework where it actually_would_ be part of the items' data, but I not sure it will ever see the light of day.
-
I'm going to show you a screen shot.
In this screenshot,when i check one QStandardItem, i need to open a browser page with the url associated with that item....!http://imageshack.us/photo/my-images/204/editedj.png(screenshot)!
-
[quote author="Sinapse" date="1323347957"]Thanks mod...
Sorry my slot is:
@ void MobilePhoneWidget::selectedItemsChanged(QStandardItem*){
@ system ("echo inside");}Can you add the code to use the item changed????
I'm a newbie of this language and i'm sorry if the question if really easy for you.
Thanks
[/quote]This is less than basic C++ "magic": Give the argument a name and use it. It's an ordinary C++ method.
I suggest you make yourself familiar with the basics of C++ first, e.g. by studying one of the many tutorials out in the net. It won't bring you anywhere without this, Qt C++ cannot be used without that basic C++ skills, sorry...
-
You're welcome. Don't feel offended by the comment. It's just common experience, that the learning curve is too steep to start with learning C++ and Qt at the same time. Just play around a bit with plain C++ and add the Qt later on. You can continue using Qt Creator for your exercises, just create a plain C++ project that doesn't use Qt. The new project wizard has this option.
-
Thanks.
I need to use QtCreator because the legacy system was written in QtCreator. But i don't need to to a lot of tasks... So sometimes i'm asking help here. I hope don't waste your time. When you or everyone can't give me an answer just put the references please....Really thanks.
I'm sorry...
Luca