How to add a widget to QMainwindow in qt creator
-
wrote on 6 Oct 2017, 06:12 last edited by
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 -
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
Veerawrote on 6 Oct 2017, 07:50 last edited by@veera said in How to add a widget to QMainwindow in qt creator:
if i click any buttons in Qmainwindow need to open my widgets connected with data base
What is the connection with the base?
Can you explain more about this? -
wrote on 6 Oct 2017, 08:23 last edited by
-
wrote on 6 Oct 2017, 08:27 last edited by
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 .......
-
wrote on 7 Oct 2017, 05:10 last edited by
I want to implement a sample ui please suggest me how we can achieve ?
-
Lifetime Qt Championwrote on 7 Oct 2017, 05:39 last edited by mrjj 10 Jul 2017, 05:40
@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 -
wrote on 7 Oct 2017, 05:57 last edited by
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.
-
wrote on 7 Oct 2017, 06:01 last edited by
MS Sql also runs in Linux now ....that part already implemented now i need to implement ui as similar as ribbon control need to open multiple windows or widgets attached with mainwindow....
-
wrote on 7 Oct 2017, 06:04 last edited by
How about the Qt Cascaded style sheets ,by using we can achieve ?
-
Lifetime Qt Championwrote on 7 Oct 2017, 06:16 last edited by mrjj 10 Jul 2017, 06:18
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
-
wrote on 7 Oct 2017, 06:53 last edited by
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.......
-
wrote on 7 Oct 2017, 07:29 last edited by veera 10 Jul 2017, 07:31
How to display a widgets inside a main window as a tabs?
-
Lifetime Qt Championwrote on 7 Oct 2017, 10:11 last edited by mrjj 10 Jul 2017, 10:14
@veera
Just place it on the form, right click and choose Insert Page
You can then add widgets to it.
-
wrote on 7 Oct 2017, 10:33 last edited by veera 10 Jul 2017, 10:34
-
Lifetime Qt Championwrote on 7 Oct 2017, 10:34 last edited by mrjj 10 Jul 2017, 10:37
Ok but it has function for that.
http://doc.qt.io/qt-5/qtabwidget.html#addTab
so you can also do it run time. -
wrote on 9 Oct 2017, 10:59 last edited by
okay ....how to open the qtabs widget after pressing pushbutton from the mainwindow during the run time?
-
okay ....how to open the qtabs widget after pressing pushbutton from the mainwindow during the run time?
you mean after you called addTab to add it ?
-
wrote on 9 Oct 2017, 11:07 last edited by
No it has to call Qtabwidget with single tab...
-
wrote on 9 Oct 2017, 11:14 last edited by
is it possible to implement ??
-
Lifetime Qt Championwrote on 9 Oct 2017, 11:14 last edited by mrjj 10 Sept 2017, 11:16
Hi
Who has to call ?
You can use addTab to add a tab
and u show() to show itDo you have the tabwidget in UI file?
You from button you just add tab.
Tab can be any widget you like.
4/43