Added Config::setDisabledPaintEvents()

Makes our internal widgets not override QWidget::paintEvent(),
which gives full power to the user to stylesheets.

Was already possible, but required the user to override the
internal widgets via the widget factory

For issue #146
This commit is contained in:
Sergio Martins
2021-01-24 10:51:58 +00:00
parent 81927b088b
commit cbc5fec119
4 changed files with 31 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
#include "Separator_qwidget.h"
#include "Widget_qwidget.h"
#include "Logging_p.h"
#include "Config.h"
#include <QPainter>
#include <QStyleOption>
@@ -28,8 +29,13 @@ SeparatorWidget::SeparatorWidget(Layouting::Widget *parent)
setMouseTracking(true);
}
void SeparatorWidget::paintEvent(QPaintEvent *)
void SeparatorWidget::paintEvent(QPaintEvent *ev)
{
if (KDDockWidgets::Config::self().disabledPaintEvents() & KDDockWidgets::Config::CustomizableWidget_Separator) {
QWidget::paintEvent(ev);
return;
}
QPainter p(this);
QStyleOption opt;