Unsolved Qt QWidget, setStyleSheet and filter
-
I am developing a Qt engine that will create an application from a set of configuration files, the difference between what I am developing and QML is that I am developing an engine in C++ and the configuration can be modified and applied to the engine without any compilation required.
In my configuration I can style the widgets using CSS, one of the styles I would like to offer is a drop shadow, I've seen this done with the filter style.
However, the filter style does not appear to be supported, is there any way of providing a drop shadow effect with CSS that is supported?
The nice thing about the filter is it gives a much nicer effect than just a solid fill.
-
Hi
As far as i know, nothing of that sort is supported in the subset of CSS that Qt stylesheets support.I was wondering if your config file could invent a tag that would turn on the use of
https://doc.qt.io/qt-5/qgraphicsdropshadoweffect.html
for that widget but not sure it fits in your goal. -
@mrjj said in Qt QWidget, setStyleSheet and filter:
Thank you, I can certainly incorporate that into the engine and enable. If anyone is interested in learning more about this application I would happy to go into detail.
Currently I can create any widgets supported by the engine, which will include as much as I can get in, the position, size and styling are all specified in the configuration. I've also implemented a subscription system where any attribute of a widget can be connected to any supported signal using the signal / slot connection system.
-
@SPlatten
Hi
It sounds cool. Like an App builder for Widgets.
Feel free to post examples in
https://forum.qt.io/category/8/showcase
as I will surely check it out being a UX person. -
I originally wrote the first version of this engine for a defence contractor. They design and build battle ship guns, I was contracted to develop a Qt application providing the GUI interface to operators.
I knew from the start the the company was developing a number of different guns and with this engine they could use the same application for each variant with only the XML configuration differing between applications.
This was hugely successful and meant that once all the effort had gone into developing the custom widgets they could change the location, position and styling with no code changes. They could also connect everything up with subscribers to signals, I expanded on this subscription system to include all external interfaces such as gyro's, GPS etc.
The other benefit of this system is that to make this system portable to other devices only the engine has to be recompiled for the target operating system. The configuration requires absolutely no changes.
I am not taking full credit for the entire application as much of the internal interfacing was developed by another, my input was into the design and implementation of the XML system, design of the widgets and subscription system.
-
Hi
Oh that sounds way cool!
Im sure you are not allowed to show any of the "battle ship guns" :)So your app generates a design and interface to control/monitor such a gun ?
Overall sounds like a really good idea and also sounds it worked great in the real world.
-
The engine just provides the developer with a set of tools to build a GUI. The engine generates nothing, the XML is created in your favourite text editor then loaded into the engine.
I've since used the same design and implementation on other military projects, one of which was an armoured vehicle, again using Qt and multiple cameras. The engine was expanded to deal with multiple displays.
Now I'm developing the engine to be even more generic and flexible. I'm currently on contract for a non military company that spends a lot of time re-developing C++ applications and QML.
For me the alternative approach to this which offers much more flexibility and shortens development time considerably is to adopt this engine.
-
@SPlatten
Sounds like a super plan. If you get more clients to use it and the engine can handle all those use cases and at same time be generic enough to be expanded for the next client /use case, i think you stroke gold :) -
I designed it form the ground up to support multi-threading. Creating a thread is simple and because of the way signals and slots work the engine is very simple to make thread safe.
In my experimental test application I create three threads, each thread has an initialisation node which determines what actions to perform when the thread is created such as creating a window.
Each thread is assigned a unique id a human readable description and a delay in milliseconds which is optional and used in thread loops to limit cpu usage.
Each GUI widget/control can have one or more signal nodes, each signal has a specific name that is defined by the engine and identifies the signal type e.g. pbtnPressed is the name assigned to a QPushButton widget when it is pressed.
Each signal node can have 1 to many subscriber nodes that specify the id of the widget and attribute that is interested in receiving the signal.
Another big part of the design is the support for modules that provide additional support. If you require support for text file I/O then I've written a module that you can include in the XML along with any others you require, communication between your running in the engine and the modules is also via signals and slots.
-
Hi
So all can be specified in the XMl, even the use of "custom" module for special needed and user simply give the xml file to the engine and then he has an app ?Sounds wonderful. Do you have any images of an app ?
-
Yes, thats exactly it!
By images do you me pictures of the GUI? If yes, sadly no, but then it uses standard Qt widgets and can have custom widgets created.
For example for the Battle Ship guns I created a widget that had a 3d artificial horizon with a compass rose around it, bit like you see in an aeroplane. This could also be set-up and placed on any display at any size and the gyro, pitch and roll came in from signals again subscribed to in the xml.