How can I provide multiple complications with the same widget family using the new WidgetKit API for watchOS like in the screenshot?
I found a lot of old explanations, but none for the new way to create complications.
Related
I have experience building GUIs in Java, C#, and C++ using the WinAPI. I'm attempting my first GUI in C++ using Qt and I have a bit of a transition problem. In any of the other three GUI paradigms, I could create my own GUI components, extend existing JPanels, etc. and end up with a custom-made GUI element that I could add to other GUI windows. C# is particularly good at this as anything I create automatically shows up in the Toolbox after it compiles.
From what I can see there are only two options in Qt and I'm hoping there is something I'm missing. The options are:
Create a custom Widget which may then be imported using a widget container promoted to the right widget.
Build what I like and drag it to scratchpad, from where I can replicate it to my heart's content.
The problem is that I want dynamically add/remove GUI elements at run time. For example, I have a Model-View-Control pattern. The view and control are two different panels in the GUI. When I switch to a different view in one panel, I want to remove the control from the other panel and replace it with the right control for the new view.
From what I can tell, I could do this using custom widgets, but it seems extremely heavy handed to do this for tons of minor widgets in composition to a greater capability. And although I can do the kind of composition I want in scratchpad, I can't figure out how to dynamically add something I have saved in scratchpad.
It is also possible that there is a Qt way of doing things which I have not found. For instance, I have some friends that have successfully created the effects above using different tabs. That seems like a cheap answer, which I could use, but I'd like to believe that Qt has sufficient flexibility to let me build any kind of GUI.
Any suggestions would be helpful
---------------------Improved example--------------------
Let me use the example code that #m7913d gave. (http://doc.qt.io/qt-5/qtwidgets-layouts-basiclayouts-example.html) Suppose that I want to make this portion of the gui into a reusable component which i can add to any GUI I want. How do I do that?
If this was C# I would create a new user control, add the GUI elements, set up the code that makes the unit work as a whole and possibly set up event listeners or properties of the user control as a whole. then I can instantiate, add, and remove them at will from the rest of the GUI. That is what I want.
I have searched a lot on internet about how to build a ListView with grouped items in it(header and subitems) but i did not manage to find a good documentation.
Found something here or here but something goes wrong...So the question is: is there a best practice for building that kind of ListView? Any official guidelines? I see, Windows 10 makes use of that control. Any thoughts of providing it with the SDK?
You can also choose to use some third-party libraries. E.g, How to Use Expandable List Items in Windows Store Apps
You will see its source code on GitHub as described in that blog.
we're maintaining some Qt applications which are running on Linux and Windows desktops. Now, we want to make the applications more attractive by adding customized forms and reports for each customer or at least groups of customers. There may be 10 or more different versions needed.
As we come from Qt, we are wondering how to manage so many configurations and if there already is a framework/development system that would help us here. We were looking at QML/Qt Quick, WT Toolkit or even NC Reports for the reporting part.
Managing configurations and deriving different versions from a base is not a feature which is discussed or promoted.
There should be a clean distinction between Display and Application Logic (Model/View)
Nice would be a textual GUI description, which enables us to release changes in forms or reports without the need to reinstall the whole applications (like QML seems to have that)
Also nice would be a kind of report generator, that helps to create forms and reports for new customers without the need to code them (and so releases our core developers from boring work)
Has somebody experience with such kind of customer based configurations? It would be nice to have a hint what's the best way to do this in the Qt surrounding.
I know comparisons like http://qt-project.org/doc/qt-5.1/qtdoc/topics-ui.html#comparison, but the specific questions that I have are not mentioned.
best regards
I guess you need to differentiate applications in three aspects:
1. appearance - if the application only differs in button color, icon image and background themes, qt's style sheet is light and convenient, you can choose to deploy different qss file and load different ones without recoding. if the variance among customers concerns layouts or available widgets (some has buttons, some use combo boxes, .etc), style sheet cannot meet the requirement, QML seems promising in such case.
business logic - i'm not sure how "generating reports" differs for different customers, if the reports need to be printed, or saved as document, i don't think qt provides good toolkit (QXXXDocument is not suitable to generate / display large amount of document), html? maybe. And i agree with #hyde that loading different plugins or dynamic libraries can solve this.
What I learnt from 8 month qt:
Model/View Architecture is there, for example a tree view that we fill with voyage data. the data is gatheres from several db tables, so we have a good logical distinction.
We hadn't the time to work us into qml, so we stuck with qt designer. It's quite easy, so we're fine with that. Delivering changes in customer forms without recompile will be a feature for a bigger future rework.
Same with report generators...
Have a look at this figure below, which is a Quick Book Enterprise Solution 2014
Judging by its interface (not its DLL), I don't think you can easily guess with what platform/language does the above application was created. Qt? .NET? Java? It has its own border, custom menu, ... etc. In a simple wording, "it has totally customized UI that make it stand from the rest".
What do we need to be able to create this kind of application with fully customized UI? And what if I add cross platform aspect in this application? Different customized widgets in different OSes... but maintaining the same level of UI appearance...
I have previous experience with Qt, .. but I am not sure Qt can do this.. or is it?
For instance, you can write your own plugin similar to the existing qt style plugins.
Here, you can find an example how to write widget based style plugins with Qt 5:
QtWidgets 5.0: Style Plugin Example
You would work with the QStylePlugin plugin interface.
If you are looking into a bit more modern solution, you may find this qml style and theme support documentation useful.
Does anybody have experience with custom styled, custom widgets in Qt?
(I am using Qt 4.5)
The problems looks like this:
I want to develop some custom controls that are not based entirely on existing drawing primitives and sub-controls. Since the entire application should be skinnable, I want to rely on custom styles, possible on style sheets as well.
What I need to configure for those new controls are the following:
additional metrics
additional palette entries
additional style options
Digging on internet and documentation, I found out that I need to derive a new style class from one the QStyle sub-classes, and override polish method for adding new palette entries, and drawControl (and the other draw methods) for painting logic for custom control and custom parts.
I have two issues that bother me:
Currently, there are different style classes for different styles, already implemented in Qt. (e.g. QMotifStyle, QWindowsStyle), each with different settings. Through inheritance, I would need to re-implement the painting and additional setup logic for each style, in order to properly integrate in all these styles. Do I have another alternative?
I am still confused about how can style sheets be used with these custom styles. Can anybody point to a place where I can find more information than the one provided by Qt documentation? (The samples in Qt don't help me too much).
The style sheet problem will not be solved, as it will not on custom classes.
The extra goodies added to a custom style will not be understood and taken care by already existing classes. This is because C++ is a static language and there is no (clean and sane) way to monkey-patch the run-time classes. A potential solution is to use a proxy style which wraps a certain instance of standard QStyle subclasses. Depending on how much you want to achieve with it, you can refer to two articles: Cross-platform code and styles and Look 'n' Feel Q & A.
If I were you, I would not go with the QStyle approach. Afterall, you create custom widgets (e.g. FooSomething) so you can as well add create completely different custom styles (e.g. FooStyle), it does not even need to mimic QStyle. Of course then you still need to replicate similar functionalities, e.g. to support style sheet.
An alternative could be to use QPalette to get the correct colours and QStyle to get the correct spacing.
QStyle's documentation for Qt 4.5:
Warning: Qt style sheets are currently
not supported for custom QStyle subclasses.
We plan to address this in some future release.