Add FocusScope behaviour to TitleBar

Github issue #56 is not a KDDW bug, it's how Qt works. QtWidgets don't
have focus scope. But let's workaround and handroll our own FocusScope.

Now the title bar can be colored differently if the dock widget it controls
contains any focused children.

This just implements half of the story. You have to focus a child
for the title bar to change color. Clicking the title bar directly
isn't done yet. Needs to be figured out. What do we focus when clicking it?
TitleBars usually don't care about keyboard focus. Probably we
just use the user's widget as a focus proxy.
This commit is contained in:
Sergio Martins
2020-08-08 12:23:01 +01:00
parent 0a6f760100
commit 10026ba191
12 changed files with 199 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ public:
{
QPainter p(this);
QPen pen(Qt::black);
//QBrush brush(isFocused() ? QColor(0xff, 0x80, 0) : Qt::yellow); // Uncomment to color differently if dock widget is focused
QBrush brush(Qt::yellow);
pen.setWidth(4);
p.setPen(pen);