PDA

View Full Version : QTabWidget clicking problems after addTab()



DonSam
14th October 2008, 09:28
Hi!
I'm experiencing a strange problem: i have a QTabWidget, with one fixed tab, with the tab text "First tab page". The QTabWidget and the first tab are created via the Qt Designer.

Now I'm adding some tabs in the C++ code, by calling .addTab().

When the program starts, and I want to navigate between the tabs, the following problem occurs: I can only activate the first tab, when I click on the rightmost part of the tabname. So only if the mouse curser is over the last characters of the tab title "First tab page" ("age") the click is recognized.

I think this may be kind of a redraw problem.

Can anyone give me a hint, where to start getting this fixed?

Note: I'm using Qt 4.2.1 (and have to stick with that version)

Edit: I tried to locate the problem, by inserting some dummy tabs. I now know, that the problem isn't related to the first tab, but to a region where no clicks are recognized. I.e. if i add some dummy tabs before the first, which didn't work, I cant activate them at all. So there seems to be a region of pixels in the GUI, where the mouse clicks aren't captured

Edit2: I found the problem myself: I implemented a class for updating the QTabView: "class MyTabDelegate : public QWidget {...}"

When instanciating the class, I set it's parent to my QTabWidget. Obviously this messed things up. I changed the parent to "centralwidget" (the main widget of my menu based application). After that, the problem disappeared.