How to add a widget to QMainwindow in qt creator
-
Hi All,
I am trying to implement a QMainWindow Ui need to add the widgets during run time because if i click any buttons in Qmainwindow need to open my widgets connected with data base need to attach with Qmainwindow as similar as tabs is it possible to implement if possible please give me some suggestions along with examples.Thanks in advance
Veera -
like this type of gui need to develop not all the controls just open button on the mainwindow need to open separate widget attached with mainwindow ,that widget is connected with MS SQL server which is running in Ubuntu 16.10 .I am trying to implement minimal sample gui as similar above gui' screen shot you can see .......
-
@veera
Hi
Even when I read the post a few times, im not really sure what you ask about.Do you ask how to make tabs dynamic ?
Or just widgets at runtime?Do you ask how to connect on to MS SQL server
which is running in Ubuntu 16.10 ( i though it only runs on windows)
or what do you ask about ?for database , you can start here
http://doc.qt.io/qt-5/qtsql-index.html -
leave the data base part ....i want implement mainwindow with some ribbon panel controls on it if i am try to click it has to open the another window which has to open attached with mainwindow not separately thats it ...this much i need to achieve initially.
-
Ok
So tasks are
1: Create ribbon like widget.
Try to use http://doc.qt.io/qt-5/qtabwidget.html#details
When it works, you can style it ( with stylesheets) to make it look more like an ribbon.
stylesheets from here http://developers-club.com/posts/48963/2:
- click it has to open the another window which has to open attached with mainwindow
What do you mean by attached here?
if you open a dialog with the mainwindows as parent, its both blocks the mainwindow and is
very attached to it.
void mainwindow::somebuttonpress() {
MyDialog dialog(this);
dialog.exec();
}
- click it has to open the another window which has to open attached with mainwindow
-
Thanks for your valuable reply.......if add any dialog designer class without button to my qt project if there is a pushbutton in mainwindow.ui after that dialog window is opening it separately...i don't want to open it has a seperate window .....that has to attached to mainwindow as a tab.......in screen sheet you can see it.......
-
Ok but it has function for that.
http://doc.qt.io/qt-5/qtabwidget.html#addTab
so you can also do it run time.