Setting Stylesheet for QDockWindow titlebar
Unsolved
General and Desktop
-
I've set a stylesheet on the title bar of a QDockWidget thus:
QDockWidget::title {background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(138, 185, 242, 0), stop:1 rgba(138, 185, 242, 255))}
When I float it (at least in Qt Designer preview) the title bar background reverts to boring plain blue.
Surely if I set a stylesheet, it should stick?
David
-
The answer might be to use QDockWindow::setTitleBarWidget?
Is there any sample code around for using that? Can I simply use a QLabel created thus:
QLabel* dockTitle{ new QLabel(this) }; QSize size{ 625, 25 }; dockTitle->setObjectName("dockTitle"); dockTitle->setMinimumSize(size); dockTitle->resize(size); dockTitle->setStyleSheet(QString::fromUtf8( "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, " "stop:0 rgba(138, 185, 242, 0), stop:1 rgba(138, 185, 242, 255))")); QString text{ tr("Light Frames: %1 - Dark Frames: %2 - Flat Frames: %3 - Dark Flat Frames: %4 - Offset/Bias Frames: %5", "IDS_LISTINFO") .arg(0) .arg(0) .arg(0) .arg(0) .arg(0) }; dockTitle->setText(text);
Thanks again, D.