PDA

View Full Version : Error in adding QTabWidget to QDialog



prady
20th June 2012, 06:16
Hi,

I am trying to create UI like..

7874
for this created a subclass from QDialog and trying to add Menubar and Tabwidget via QVBoxLayout, I am able to add MenuBar successfully, but when I add Tabwidget ..



TabWidget = new QTabWidget();
TabWidget->addTab(new QWidget(),tr("Tab 1"));
VerticalLayout->addWidget(TabWidget);


Getting a runtime error as "Microsoft Visual C++ Runtime Library This application has requested the Runtime to terminate it in an unusual way. Please contact the application support team for more information" with OK button.

and when I Use debugger it gives the error "Signal Received, The inferior stopped because it received a signal from Operating system"

could someone help me out to fix this problem ?

I am using Qt 4.8.1 in Qt Creator 2.4.1 in win 7

Thanks,

ChrisW67
20th June 2012, 07:18
I would guess that VerticalLayout is null or not initialised. You could find out for sure by running the program in your debugger. When it stops look at the back trace to see which line of your code is the culprit.

prady
20th June 2012, 07:53
I have initialized vertical layout before using it
QVBoxLayout* VerticalLayout = new QVBoxLayout; in the same way I am adding a menu bar to the layout, and it works as I said in my post, but only the problem with adding the tab widget to the layout, the debugger exactly showing the "Signal received" error in
VerticalLayout->addWidget(TabWidget); line.

any help ?

ChrisW67
20th June 2012, 08:13
You haven't bothered with the advice already given.

You could find out for sure by running the program in your debugger. When it stops look at the back trace to see which line of your code is the culprit.

If that is the line it dies on the one or both of the pointers is probably null or invalid.

prady
20th June 2012, 09:49
Got it ... It was my mistake that, not calling a method which initialising the TabWidget object. Thanks Chris.