[Interest] QTabWidget activity
Murphy, Sean
smurphy at walbro.com
Fri Jan 8 15:49:07 CET 2016
> I would probably prefer something like an overlay message popping up for a
> few seconds or (a bit nineties style) a status bar message. Another would be
> to have a subtle small icon overlay float from the button up to the tab.
Overlay message probably is a little more intrusive than we want, but might be
an option. Status bar message I can (and probably will do), but that's probably
not very noticeable given where the user's eyes are most likely to be. I do like
the idea of doing an animation, that definitely would be eye-catching, positive
feedback that something happened, and also give the user the notion of
where it the snapshot went.
> I was trying to think if there were ways to hack around a QStyle proxy to do
> the flashy bit, but I'm not sure without spending a fair amount of time. The
> trick in this case is always the same idea:
>
> 1) Override only exactly what you need, in this case the drawing of a single
> tab.
> 2) Find a way to realize that you're currently painting the thing you want to
> change.
> 3) Override the painting of that single item, call the base class painter for all
> others.
>
> This is a generic QStyle trick that can be used for many evil purposes.
> The problem with it is that it's quite hard to debug for anyone that doesn't
> know you have done it - imagine the poor developer going "where the
> f!#ยค%& does that come from"? Hurting maintainability is usually a bad idea.
>
> The trick has much more of an appeal if you already have a lot of QStyle stuff
> in your code.
I'm fairly certain I've never explicitly typed:
#include <QStyle>
in my career, so that probably gives you some indication of how much QStyle
stuff is in my code! If I can't get any of the above stuff working, I might try to
come up to speed on using QStyle stuff to help out.
On a related note if I do decide to play around with QStyle stuff, the original
effect I'm trying to do was supposed to be a subtle change of color to the
native QTabBar's tab. Are there any resources that help me start from how
Qt was naturally going to draw the tab? As I was playing around with the
stylesheet option I'm realizing it's very difficult to use a stylesheet to
replicate most of the native widget's looks and feel, but then just tint the
color a little. But because of the way stylesheets are all or none, you can't
simply do:
QTabBar::tab:middle{
background: #00ff00;
}
Because then you just end up with the middle tab(s) that while they are
green, they are very flat, undecorated. So I spent a lot of time yesterday
playing around, trying to get something that looks close to natural. I don't think
I'm quite there yet!
Sean
More information about the Interest
mailing list