I'd like to add visual emphasis to a selected UI component by de-emphasizing everything around it, e.g. make everything around it blurry, or more transparent, or something similar.
Two questions, really:
spec: what effect would you use do build something like this? Do you know of any software that does this well?
implementation: what is the most obvious approach to apply a blur, or change alpha, to everything around a specific component?
thank you all!
If you display the component using the PopUpManager, everything else will 'blur' out on it's own. You won't be able to interact with it, though.
I you don't want to use PopUpManager, then manually disable everything but the component you want to highlight. This could be dead simple, or could be horribly complex depending on your architecture and how components are laid out in relation to the component you want to highlight.
If you don't want to disable a component, but do want the disabled 'look', then most Spark components have 'disabled' SkinState. You could copy the design to the active state, or create a new state for your "not de-activated even though it looks like' state.
Related
I am making a desktop app with Qt6.2 and C++ and I want to create a ColorPicker widget that is much like QColorPicker.
I want it to look like this:
This is Evernote's color picker. For some reason, Qt6.2 does not have QColorPicker and I don't know where to get it from. I am interested however in creating my own custom widget to look like the picture above.
My first intuition was to use a grid layout and place buttons in them. It seemed so tedious to set each button's stylesheet and connect every button. I did not get any intuition as to how I can reduce redundancy. I thought there has to be another way. This looks fundamentally like a ComboBox, though it has a different layout.
How can I implement this colorpicker? While some will suggest using QColorPicker (I don't know where to get it from as its not shipped in Qt), I am actually interested as to how a widget like this is implemented.
I have a few labels I want to sometimes look grayed-out, depending on some variable. Some of those labels have effects (such as changing those factors) when clicked. I'd like my program to look good regardless of what theme the user is using, so I can't hardcode the colors. How can I do this?
I can think of several solutions, but all of them have some annoying drawbacks:
Change the text color: Sounds like the easiest solution, but it's a bit harder since I want to support theming/palettes. Especially if the system theme is changed while the program is running, since then I'd have to update the palette again.
Call setDisabled() and override event: That just feels wrong, and also risks overriding platform behavior.
Make a custom text widget: Would be possible, of course, but it would require either a lot of code duplication and wasted time, or be a rather half-assed and limited implementation.
Wrap paintEvent with a pair of setDisabled() calls: No. Just no. Also, I don't know if that would work with concurrency.
You can just set the style sheet of this label, since it's a Widget. It works for me and when themes are changed because of OS switching or whatever, it keeps the same.
label.setStyleSheet("color: gray")
The style sheet have a CSS syntax. You can make wonderful things with it, just have a look on the reference properties and some examples for some distinct widgets.
Copy the brushes from the "Disabled" palette role to the "Active" role:
palette = mylabel.palette()
palette.setCurrentColorGroup(QtGui.QPalette.Disabled)
palette.setColorGroup(QtGui.QPalette.Normal, palette.windowText(),
palette.button(), palette.light(), palette.dark(), palette.mid(),
palette.text(), palette.brightText(), palette.base(), palette.window())
mylabel.setPalette(palette)
mylabel should now look like it's disabled, but it's actually not.
This should work for any widget, not just labels.
All:
I am pretty new to React. When a developer hands me a component to style, I always HAVE TO ask him to give me another html structure diagram of that component so that I can know what is going on inside it.
But when the component gets complicated(like multi level component nested, I may have to contact several diff developers to figure out the structure, expand the component and put them together to figure out the whole structure), I wonder if there is a better way to make this process a little easier(or if there is a standard guideline/spec for me to ask developers to fill out once they finish a component, so that I can get a quick picture which helps me to plan the style, esp the layout.)
Thanks
I wanted to consult with the sages here regarding Qt and skinning, get your opinion and chart a path for my development. My requirements are as follows:
My Qt/C++ application (cross platform with Mac, Windows and Linux versions) needs to have modular skins.
A skin is defined as a set of one or more elements: - Window background texture - Look/feel of UI controls such as edit boxes, drop down, radio buttons, buttons etc. - Look/feel of window "caption", resize grips etc.
Skins will be installed with the application installer, allowing the user to choose which one he/she wants to use. Users should be able to change skins on the fly.
Can I go the QML route? should this be custom and based on simple resources which are built into the application? Any design advice will be appreciated.
Thanks.
If I understood you correctly then stylesheet is the best way forward. You can create stylesheets similar to CSS and then pass them as command line option to your application or load on invocation to style your application at runtime. That way you can create multiple stylesheets each having a different look and feel and allow user to load them at will. Since its CSS it doesn't need any new learning and you can keep all your styling outside your source code.
Here are a list of resources that can get you up and running quickly:
http://blog.qt.io/blog/2007/11/27/theming-qt-for-fun-and-profit/
http://doc.qt.io/qt-5/stylesheet.html
I haven't played with QML yet, but you could also create a custom QStyle implementation that supports your resource format. Note that you'd lose style sheet support if you went this route.
Changing window captions is a little trickier if you want portability.
QML, if I understand correctly, doesn't really skin the widgets, it mainly deals with GUI layout etc etc.
QStyle is used to change the looks. It is a bit low-level though, and requires programming, so if you want to load different user-created skins (from an XML or so) it might be tricky to support extensive skinning. Chaining colors and a few items are easy enough though. (There might be someone else who've done something you could re-use.. not sure.)
For modifying widgets, use QStyle::polish(). You could use that to change the background picture (if it's a top-level window, or of a certain class). There are numerous repaint method to change almost every part of every widget.
Store/load the style using QSettings, by reading and setting the desired Style just after QApplication but before your main window is constructed.
I'm wondering what the best tool is for developing a mobile UI is. My requirements are that I retain full control over the look and movement of every UI component. I think Flex might be the best way to do this but I can't tell if I'll have that level of control using their UI components.
Any links would be appreciated. Thanks!
Edit: For example, looking at the documentation I see there's a an 'enabled' field which dims the color of a container and it's children if false. Am I able to change that so, maybe a repeated bitmap pattern appears if false?
Or, if there's a sliding menu can I edit the speed and change in speed as it closes?
You can create any component you like and make it look like anything you want. You don't have to use standard components. You can reskin any components just by specifying a new skin. It's really pretty easy.
You can create custom skins for Flex, for both Spark and Halo components. You also can create custom components, either based on other existing components, or based on the base component. You could even create custom objects which are just based on Sprites or similar (if you like to have control over everything :P).
edit
In response to your updated question. Regarding the enabled/disabled property, yes, it is possible to skin that. Spark components have states, for example a Button has a up, over and down state – and an disabled state. That state is exactly what is active when the enabled property is set to false. So yes, you can skin that.
Regarding the sliding menu animation, I'm not totally sure if that would be easily possible as I believe that this is coded into the component itself and not part of the skin to decide. However even if that is the case, you could instead create your own component that basically features exactly the same functionality but has a changed animation there.
I'm not sure if the Spark skinning wouldn't be able to do this though, because what you definitely can do is creating transitions between states. So if the slide is made with different states, you'll probably be able to change the transition as well.