Unsolved Problems with a control subclassed from QTabWidget
-
I have downloaded a QT Ribbon Tab from gut hub, that looks very good for me. But after playing around with this control, I get unexpected issues with it. I tried to debug this but currently Iam lost.
I have attached a minimal Sample to reproduce the issue. I use QT 5.13.2 on macOS
My problem is: The app is a mdi App with a custom ribbon control, that is subclassed from QTabWidget. To reproduce the problem, start the app:
- Open first SubWindow by click on "Open"
- list itemOpen second SubWindow by click on "Open"
- Window2 is layered on top of window1
- Click "New" ToolButton (has no action)
- )Now click on Tab "View"
You can see now, that the window1 was get activated. This is a wrong behaviour.
Because I do not use any Events in this minimal sample I think that the used control will fire somewhere an Event that cause the mdiArea to activate another window. But I was not able to figure this out.
I hope someone else had a similar problem in the past and can five me a hint.
-
Hi,
This is not an official Qt module, you should contact its author.
-
Did you really took a look to the sample app? In my eyes the sample show very clear that this is a QT problem.
-
Hi
Since you bother to make a runnable example, i did debug it.Its a focus problem, it seems.
When you switch to the empty View tab, Qt tried to focus
a widget. And for some reason , i dont understand yet that makes MdiArea switch to first window.Anyway, after BIG time fiddling around. I could not reproduce with a plain TabWidget
so i went looking in the support classes of the ribbon class.The cure seems to be to remove a focus policy on the scrollarea in
RibbonTabContent class. (in the UI file)If i set that to NoFocus. I can no longer reproduce it.
Please see if you get the same result.
make sure to do a clean all first so it's surely recompiled. -
Yes, you are right, I cannot reproduce it after change it to noFocus. Can I change this really to NoFocus or will this cause problems? TabFocus also work with me. So it is a behaviour of strongFocus. Wow, this is the setting I never think about. My respect to you. Many thanks!
-
@pixbyte
Hi
Super it also worked for you.
It should not cause any issues setting it to nofocus as its just the actual scrollarea and it dont need focus.Yes its pretty odd. Took quite a while to find it. Im still not sure why it happens but
we take focus from mdi area when we click and i assume when it tries to set focus back it will focus the window 1. But why i dont really know.