How do I add new tab to QTabWidget
Sorry if this has been asked already. I just haven't found a related enough thread to point me in the right direction. I have a program that I have coded in C# .NET 3.5 thus far and want to port it to the best of my ability to C++ with Qt 4.4.0. I want to develop a tabbed text editor so that I don't have to deal with MDI windows. It's the start of an IDE for an E-Blah Forum template editor. I have the GUI setup in C# .NET currently. I have the GUI mimicked in Qt Designer and have a QTabWidget already setup there. I'm just trying to figure out how to add a tab to a QTabWidget. I just need to know the correct syntax and class structure.
I understand that I must have a QTabWidget object to place tabs into, which I have, but how do I add new tabs? Do I need to create a class for each kind of tab to add to the main QTabWidget?
Here is the code that I have to add a new tab right now:
Code:
tabDocument->addTab(tab, tr("General"));
tab is defined here:
Code:
// defaulttab.h
// Default Tab for tab interface
{
Q_OBJECT
public:
};
The name tab is just a test. I was trying to get a tab to show up and make it easy for me to do so with a short name.
With the above code, I don't get a compile error. It seems to all be ok. However, I get a SIGSEGV error when running the event to trigger the addtab method.
Re: How do I add new tab to QTabWidget
Hi,
Code:
myTabWidget->addTab(newTab, tr("name"));
Re: How do I add new tab to QTabWidget
Thanks. I appreciate your help.