Problem with QTabWidget
-
Hello,
I have to create a graphical interface with Qt but i have a problem with my QTabWdiget :
In main.cpp :
//Création de mes onglets
QWidget Commander;QTabWidget*onglets = new QTabWidget(&Commander); onglets->setGeometry(1,1,1366,768); QWidget *page1=new QWidget; QWidget *page2= new QWidget; QWidget *page3=new QWidget; QWidget *page4= new QWidget; QWidget *page5=new QWidget; QWidget *page6= new QWidget; QWidget *page7=new QWidget; QWidget *page8= new QWidget; onglets->addTab(page1, "EN CE MOMENT"); onglets->addTab(page2, "NOS MENUS"); onglets->addTab(page3, "NOS SANDWICHS"); onglets->addTab(page4, "PETITE FAIM"); onglets->addTab(page5, "NOS BOISSONS"); onglets->addTab(page6, "NOS DESSERTS"); onglets->addTab(page7, "HAPPY MEAL"); onglets->addTab(page8, "FRITES ET SAUCES"); Commander.showMaximized();
The first part of the code works, my tabs open correctly but it opens in another window next to it, as soon as my program is launched.
My problem is that I created a class "order.h", when we are on the main window there is then a button "order" and when you click on the button a secondary window opens and I would like that when this secondary window opens it displays my tabs (from the code above).
I tried to place my code directly in the "order.cpp" but nothing is displayed.
How to do ?
Thank's for you help. -
Hi and welcome to devnet,
You should take a look at Qt layouts.
However, from the looks of it you have an architecture issue. I would recommend drawing the various screens of your application. It will then be easier to build them and the business logique between them.