helloSystem / QtPlugin

Qt platform plugin and style, required for Qt applications to export their menus over D-Bus in the required format
5 stars 4 forks source link

Implement Candy style buttons #1

Open probonopd opened 3 years ago

probonopd commented 3 years ago

https://www.informit.com/articles/article.aspx?p=1405556

image

antonpat commented 3 years ago

The easiest way (IMHO of course) is to use QSvgStyle or Kvantum. Here is my desktop with a theme I quickly hacked together and Kvantum from source (centered tabs required changes, they are upstream now). styled_kv It i possible to exclude built-in themes and theme manager, so that a user won't be able to mess with the theme. Using SVG for widgets, it would be easier to have things like glows and shadows. What do you think?

probonopd commented 3 years ago

Hello @antonpat I like this a lot. Using SVG is definitely the way to go, because it allows for customization of the look without having to recompile every time.

Especially great that you apparently managed to keep the global menu operational.

Right now https://github.com/helloSystem/QtPlugin contains much, much more "stuff" than I think we really need (we want three things only: global menu functionality, the possibility to do styling using stylesheet.qss at runtime, and SVG for widgets). Everything else could be removed as far as I am concerned. I imagine Kvantum contains even more code that we do not need - do you think it can be slimmed down significantly?

antonpat commented 3 years ago

Yay!

Yes, the theme doesn't interfere with the platformthemeplugin part, so the menu works (if you noticed, I attempted to restyle it a bit - there is an icon for the system menu, but this is another story). I'm also in the middle of refactoring of the qt plugin - you're right, there is a lot of irrelevant PandaOs stuff we can get rid of. Unfortunately, Kvantum interferes with stylesheets, so the effect of a stylesheet combined with a Kvantum theme can be unpredictable at times. On the other hand, almost anything that stylesheets can do, Kvantum themes can do as well. The only thing that Kvantum is lacking is widget animation - there is some animation implemented around hover (and focus?) events and transient scrollbars. SVG as a format supports some (attribute change) animation, so I wonder if Kvantum is ok with animated SVG's - I haven't tried them yet.

As for Kvantum itself - it is a (relatively) compact project. There are few things we could get rid of - theme manager and preview, built-in themes and potentially some KDE-specific code (which is not a lot). Also, @tsujan is doing a great job and the project is very active, thus I'd like to avoid forking it. May be we can introduce a cmake argument instead that builds a 'standalone' version (it the very worst case, we could patch/replace original cmake files with customized ones and build it the way we want).

antonpat commented 3 years ago

And just for laughs, I resurrected dfilemanager's style project and made it compile again. styled As you can see, it looks quite decent (although the app menu part is lacking and something went wrong with app icons detection), but to change the way it looks is A LOT of work.

antonpat commented 3 years ago

I played with Kvantum a little bit more, and there are few things I don't quite like:

I'm going to keep trying for a little bit longer, but it could be that Kvantum is not quite what I was looking for.

tsujan commented 3 years ago

I received a few email notifications from here because of the string "@tsujan".

It's hard to make widgets drop shadow or have glow…

Making themes for Kvantum isn't an easy job, in general. It needs patience and practice. That's because of the nature of Kvantum (→ last sentence of this comment).

Qt SVG ignores svg effects…

True.

Some widgets are GIGANTIC…

Not true. Read Theme-Making.pdfMaximum Corner Roundness (Frame Expansion) and check various themes that come with Kvantum and have rounded buttons/line-edits, like KvCurvesLight, KvRoughGlass,…

The theme is a plain svg file (svgz is not supported) that can be meddled with

Yes, Kvantum allows any kind of theme editing.

All in all, if you want a fixed look and feel for your DE, I wouldn't recommend Kvantum because it's made not to be limited to a specific look.

antonpat commented 3 years ago

Making themes for Kvantum isn't an easy job, in general. It needs patience and practice. That's because of the nature of Kvantum (→ last sentence of this comment).

Exactly. I was hoping for an easier way to create a theme that would look better than just a custom qss. The question is now if the effort required to do so is any lower than implementing a custom QStyle.

Not true. Read Theme-Making.pdfMaximum Corner Roundness (Frame Expansion) and check various themes that come with Kvantum and have rounded buttons/line-edits, like KvCurvesLight, KvRoughGlass,…

Oh, I did. Actually, I have less problems with expanded elements - I could make a decent looking rounded buttons that are not huge. The elements that are not extended and have normal frame and interior are sometimes taller than I'd want them to be, especially if I want their frame to have a shadow/glow.

All in all, if you want a fixed look and feel for your DE, I wouldn't recommend Kvantum because it's made not to be limited to a specific look.

Yes, I think you're right. Kvantum is a fantastic tool for folks who would want to change themes easily, while this project's goal is to provide users with a perfect looking GUI with very limited customization capabilities. Another issue is that I want some weird things (e.g. to be able to add a menu to a menu bar with an icon of arbitrary size, while Kvantum sets it to be PM_SmallIconSize, and so on) that a normal user would never need, thus implementing them in Kvantum would make very little sense and, as I said before, I wouldn't want to fork it and make it into its opposite.

tsujan commented 3 years ago

The question is now if the effort required to do so is any lower than implementing a custom QStyle.

QSS has many shortcomings. It may be enough for a Panel, for example, but not for a whole DE. I think a widget style plugin would be the best option for a Qt DE that needs a specific look and feel. You could even add some customization options, as KDE does.

Just a suggestion: QtCurve's code may be a good start point for forking. It might need heavy changes for your purpose but lots of problems have already been solved in it.

Another issue is that I want some weird things (...) that a normal user would never need...

QStyle has so many parameters and Kvantum makes a big part of them available to its users. But you're right: many of them are redundant for what you may want here.

alphamodh0 commented 2 years ago

And just for laughs, I resurrected dfilemanager's style project and made it compile again. styled As you can see, it looks quite decent (although the app menu part is lacking and something went wrong with app icons detection), but to change the way it looks is A LOT of work.

This is a beautiful work, is a perfect theme for me. Why no implement it on 1.0 @probonopd ?

louies0623 commented 1 year ago

And just for laughs, I resurrected dfilemanager's style project and made it compile again. styled As you can see, it looks quite decent (although the app menu part is lacking and something went wrong with app icons detection), but to change the way it looks is A LOT of work.

This is a beautiful work, is a perfect theme for me. Why no implement it on 1.0 @probonopd ?

@probonopd I would also like to see this theme in the next version of the system, the current version is ugly.

probonopd commented 1 year ago

You can set different styles using, e.g., QT_STYLE_OVERRIDE=Kvantum. This is a Qt feature; I did not have to implement anything specific in QtPlugin for this.

probonopd commented 1 year ago

E.g., sudo apt install Kvantum-qt5. Using kvantummanager one can select a theme or install a new one. With QT_STYLE_OVERRIDE=Kvantum it will be used. For example, KvMojaveLight seems to be a good starting point for a custom theme. A lot of stuff can be configured (e.g., remove transparency, remove icons on buttons, etc.).

As for the DFileManager theme, I need to find it...

probonopd commented 1 year ago

Or we can use QtCurve, e.g., like this:

# Needed for global menus to work
export QT_QPA_PLATFORMTHEME=panda

# Use QtCurve
export QT_STYLE_OVERRIDE=QtCurve

# Set a QtCurve theme
export QTCURVE_CONFIG_FILE=/home/user/Downloads/QPlatinum/QPlatinum2.qtcurve

Details are at https://github.com/orgs/helloSystem/discussions/513

louies0623 commented 1 year ago

https://store.kde.org/p/1000734/ This makes me feel a strong expectation, if the system uses the theme of qtlion.

probonopd commented 1 year ago

Also https://store.kde.org/p/1005425/. It is the theme needed for that screenshot.

louies0623 commented 1 year ago

Do we want to make it temporarily preset as the theme, and see how it looks on the system?