I have a custom class called Window that extends QWidget.
#include "window.h"
// This is the base that all (MDI) sub-windows extend off
Window::Window()
{
// Add fake icon to remove icon in all
setWindowIcon
(QIcon("."));
}
{
opt.init(this);
style
()->drawPrimitive
(QStyle::PE_Widget,
&opt,
&p,
this);
}
#include "window.h"
// This is the base that all (MDI) sub-windows extend off
Window::Window()
{
// Add fake icon to remove icon in all
setWindowIcon(QIcon("."));
}
void Window::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
To copy to clipboard, switch view to plain text mode
css:
{
background
-color
: QLinearGradient( x1
: 0, y1
: 0, x2
: 0, y2
: 1, stop
: 0 #ffa02f, stop: 1 #ca0619);}
QWidget:title
{
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #ca0619);
}
To copy to clipboard, switch view to plain text mode
When I do this the buttons (minimize, maximize and close) disappear (as seen in the picture below).
C3egU.jpg
So my question, how do I properly style my Window titlebar?
Bookmarks