Is it possible to make a QToolBar
widget background transparent?
Behind it I have a QOpenGLWidget
and I'd like to only see the toolbar's icons.
Is it possible to make a QToolBar
widget background transparent?
Behind it I have a QOpenGLWidget
and I'd like to only see the toolbar's icons.
This works for me with a QGroupBox in front of a QOpenGLWidget:
this->viewButtonBox = new QGroupBox(tr("View"));
QPalette pal;
pal.setColor(QPalette::Background, Qt::transparent);
viewButtonBox->setPalette(pal);
//adding groupbox in front of openglwidget
QVBoxLayout* centralLayout = new QVBoxLayout;
centralLayout->addWidget(viewButtonBox);
this->setLayout(centralLayout);
The QGroupBox is part of the QOpenGLWidgets layout.
Isn't it enough to declare QToolBar
as child of QOpenGLWidget
?
Something like:
QMainWindow qW;
QOpenGLWidget *pOG = new QOpenGLWidget;
QToolBar *pTB = new QToolBar(pOG);
qW.setCentralWidget(pOG);
I tested with a QFrame
instead of QOpenGLWidget
and it works.