D
D
devalone2017-01-23 21:46:33
Qt
devalone, 2017-01-23 21:46:33

Qt. How to make floating widgets inside tabs?

There is a QTabWidget with several tabs and it is necessary that each tab has its own widgets, which the user, if necessary, can move and attach to any side of the tab. Of the standard components, QToolBar and QDockWidget have such functionality, but they are attached only to QMainWindow, and pushing QMainWindow into a tab does not work (although it seems to me that it should not). What to do in such a situation? Is there a way to attach a QDockWidget to something other than the main window? Or maybe there are ready-made solutions for a user-changeable interface?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devalone, 2017-01-25
@devalone

In general, QMainWindow can be stuffed into a tab. It didn’t work in the designer, so I created two forms for each tab and wrote in the main form constructor:

tab0 = new Tab0(this);
tab1 = new Tab1(this);    
 
ui->tabWidget->addTab(tab0, "tab0");
ui->tabWidget->addTab(tab1, "tab1");

where Tab0 and Tab1 are classes inherited from QMainWindow.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question