1 Attachment(s)
Error in adding QTabWidget to QDialog
Hi,
I am trying to create UI like..
Attachment 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 ..
Code:
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,
Re: Error in adding QTabWidget to QDialog
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.
Re: Error in adding QTabWidget to QDialog
I have initialized vertical layout before using it 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
Code:
VerticalLayout->addWidget(TabWidget);
line.
any help ?
Re: Error in adding QTabWidget to QDialog
You haven't bothered with the advice already given.
Quote:
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.
Re: Error in adding QTabWidget to QDialog
Got it ... It was my mistake that, not calling a method which initialising the TabWidget object. Thanks Chris.