Trying to make Toolbar Corners curved, and make it semi-tranparent.
Unsolved
General and Desktop
-
So I've got a toolbar that I'm adding to a widget.
I create the toolbar thus:
QApplication a(argc, argv); QPixmap p("C:\\Users\\amonra\\Documents\\Astrophotography\\NGC 7789 Caroline's Rose or Herschel's Spiral Cluster\\NGC7789 Edited large.png"); DSSImageWidget w(p); DEditStars editor; QObject::connect(&w, &DSSImageWidget::Image_mousePressEvent, &editor, &DEditStars::mousePressEvent); QToolBar t(&w); QIcon dragRect("C:/Users/amonra/Documents/GitHub/DSS/DeepSkyStacker/Buttons/ButtonSelect_Up.bmp"); t.setOrientation(Qt::Vertical); t.addAction(dragRect, "", &editor, &DEditStars::dragButtonPressed); //t.setFixedSize(50, 50); t.setIconSize(QSize(48, 48)); t.adjustSize(); // Work around bug with initial size of toolbar t.setWindowOpacity(0.5); // Make it semi-transparent int radius = t.size().width() / 2; // Add curvey-corners QString styleSheet(QString("border-radius: %1").arg(radius)); t.setStyleSheet(styleSheet); w.setToolBar(&t); w.show(); return a.exec();
Trouble is the toolbar remains stubbornly rectangular, and 100% opaque :(
David
-
@Perdrix said in Trying to make Toolbar Corners curved, and make it semi-tranparent.:
QString styleSheet(QString("border-radius: %1").arg(radius));
Maybe
QString styleSheet(QString("border-radius: %1px").arg(radius));