QlistView is empty or not?
-
Hi,
Is there a method that check if a QlistView is empty or not? -
Hope it's ok to reply to this thread, even it's been created in the jura ära already? ;)
I have exactly the same question, even have the same solution, but the point is, how can find someone find out, if not the MODEL is empty, but the QListView is empty, means, it does not have a model yet attached? In my case I have a certain use case where there were no items found yet to add (on purpose), so even the model wasn't created and added to the QListView item. So view->model()->rowCount() produces a segmentation fault - which is perfectly ok, but how can I check before this request, if the model does exist already? view->model() == 0 or something? My trials were rejected by the compiler so far.
Cheers,
Stephan -
Hope it's ok to reply to this thread, even it's been created in the jura ära already? ;)
I have exactly the same question, even have the same solution, but the point is, how can find someone find out, if not the MODEL is empty, but the QListView is empty, means, it does not have a model yet attached? In my case I have a certain use case where there were no items found yet to add (on purpose), so even the model wasn't created and added to the QListView item. So view->model()->rowCount() produces a segmentation fault - which is perfectly ok, but how can I check before this request, if the model does exist already? view->model() == 0 or something? My trials were rejected by the compiler so far.
Cheers,
Stephan -
Ok, that works, why did I not get to that idea??? ;)
Would you use "0" or rather "NULL"?
Stephan
-
Ok, that works, why did I not get to that idea??? ;)
Would you use "0" or rather "NULL"?
Stephan
-
Great, thanks!
Stephan
-
Great, thanks!
Stephan