A widget is hidden by default. Tabs created in constructor are shown together with their parent. You must make tabs added dynamically at runtime visible by yourself. Try adding:
A widget is hidden by default. Tabs created in constructor are shown together with their parent. You must make tabs added dynamically at runtime visible by yourself. Try adding:
J-P Nurmi
ok I put the line tab->show(); after the connect and so work fine.....now I have a problem with the layout.....the alarm1 widget is printed outside the tab too and not all in the tab, why?
Hard to say, it seems to be a custom widget we know nothing about. Since it's properly added to a layout (is it?), it presumably does something that breaks the layout.
J-P Nurmi
mhmmm...it's strange because I have the same problem if I add in the tab a simble button instead the widget alarm1![]()
You can see it in your system folder undo folder.
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
And just to comment: I've read in the docs that widget. which will be used, must be previously created WITHOUT parent.
Qt 5.3 Opensource & Creator 3.1.2
ok I've resolved the problem...it was releated to tab->show() that doesn't work well.
I use instead twAlarms->showPage(...) and now the layout is fine.![]()
another problem.... in my QTabWidget I have several tabs that may be of two kinds: tab with inside Alarm1 Widget and tab with inside Alarm2 Widget....Alarm1 and Alarm2 have both a QLabel like an unique identifier of the alarm type.
Now I want to search in the whole QTabWidget which tab containe the Alarm with a particular "identifier"....any idea how to do this?
Use a QHash with either your QLabel or a QString as a lookup index for your alarm widget. There are many examples of similar lookups in QtDemo.
Qt Code:
To copy to clipboard, switch view to plain text mode
Bookmarks