Can not control the position of a QToolbar within a QTabWidget
-
Hi,
Except that you are currently adding that toolbar under your QTabWidget and not at the bottom of the widget inside the tab.
Since you want different tabs to have different tool bars, you should consider making a base "tab widget" class that contains what you need and that you can configure.
-
I try to place a QToolbar within a QTabWidget
// Add toolbar to Cloud Viewer tab widget ui->tabCloudViewer->layout()->addWidget(cloudViewerToolbar);I take these statements to indicate that
ui->tabCloudVieweris theQTabWidget. Are you saying it is a page-widget on theQTabWidget? What type is it? -
OK, thanks for the clarification.
In that case, you can use insertWidget so you can prepend the toolbar.
-
Hi,
Except that you are currently adding that toolbar under your QTabWidget and not at the bottom of the widget inside the tab.
Since you want different tabs to have different tool bars, you should consider making a base "tab widget" class that contains what you need and that you can configure.
Hi,
my problem ist, that I'm not able to configure the tab widget in a way, that the toolbar appears at the top of the tab page... So to create a new class wouldnt change anything, because I would also in such a case not be able to configure the tab page in the way I want...Or am I completely wrong?
-
Hi,
my problem ist, that I'm not able to configure the tab widget in a way, that the toolbar appears at the top of the tab page... So to create a new class wouldnt change anything, because I would also in such a case not be able to configure the tab page in the way I want...Or am I completely wrong?
-
The widget you should have as tab should basically be:
- A QWidget with
- A QVBoxLayout and
- Your VTK widget inside that layout.
And in that case you can insert the QToolBar as proposed.
Or you can make a custom widget with the same content plus a method that would handle adding/setting a QToolBar in that tab.
-
-
QBoxLayout::insertWidget. QBoxLayout is the base class of QVBoxLayout and QHBoxLayout.
-
QBoxLayout::insertWidget. QBoxLayout is the base class of QVBoxLayout and QHBoxLayout.
@SGaist
I tried to create a new widget class based on MainWindow, where I can configure all things I need very easy in QtDesigner, and I can easily insert this widget withcloudViewer *cv = new cloudViewer; ui->tabWidget->addTab(cv, "3D Viewer");... I think, this is the simplest way for my needs, or is there somthing wrong with this solution in you opinion?
-
I don't see anything particularly wrong here.