Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine type of widget in a qtable cell?

Tags:

c++

qt4

I have created a QTable with lots of gui elements like comboBoxes and checkBoxes in various cells. I am able to access these elements by creating pointers to them. What I want to know is, is there any way to know what type of widget(comboBox or checkBox) a cell is having?

like image 237
rwik Avatar asked Jun 01 '11 18:06

rwik


1 Answers

Check out the answers to this question. The accepted answer gets the class name (as a const char*) from the widget's meta-object like so:

widget->metaObject()->className();

There's another answer that suggests using C++'s type management, but that sounds a lot less wieldly (more unwieldy?).

like image 180
Xavier Holt Avatar answered Sep 25 '22 03:09

Xavier Holt