Newb stylesheet question: How to remove gradients on qt5 apps.

  • Not really a development question sorry, and definately a newb one, but I don't know of a better place to ask. (perhaps there should be a Qt User forum category?)

    I want to disable the gradient on the background of qt5 windows (mainly for KDE kate & dolphin). (Or better yet, disable all gradients everywhere).
    I do this via a stylesheet, right?
    Since use XFCE (Mint 18) I have installed qt5ct, which is working - changes affect kate & dolphin when applied.
    I have tried copying and pasting some stylesheet examples into an enabled "sheet.qss" on qt5ct's stylesheet editor, but nothing seems to have any effect except occasionally making widgets disappear.

    Should this work? If so, can someone tell me what I need to enter into the stylesheet?

    (I'm using Oxygen as the qt5 style)

  • Qt Champions 2017

    @xaxazak said:
    Hi and welcome
    I cant say if qt5ct works with XFCE but you say some changes work?

    Well the hard part is finding out for the applications
    how they use the gradient. Meaning what tag/element they assign it to.
    You can try with

    QWidget {background-color: rgb(0, 85, 255)}

    and see if it does anything.

  • @mrjj

    Yes that worked, thanks. Lots of blue.
    I guess there's no "widget picker" type tool (like a color picker), or something that will produce a snapshot of all the widgets of a tree.

    Edit: Still here:

    Ok, replacing QWidget with QMainWindow did work - must've messed up before.
    So I can now manually set a solid main-window color, thanks - although if there's a way to just disable the gradient it might be a better solution.

    Unfortunately, the pretty (and useful) tree structure lines in dolphin's tree view disappear when I do.
    I had to install "kde-style-oxygen-qt5" mainly so I could get those lines - could it be partially reverting back to the old style somehow when it's affected by stylesheets?
    If I use a blank stylesheet, the lines are still there, so it's not just switching the style because custom stylesheets are used (unless it ignores blank ones).

  • Qt Champions 2017

    You might need to tweak additional style sheet settings to make it look right.
    Applying a stylesheet is sort of a all-or-nothing so it might alter look.
    Also they are cascading so might have side effects if u apply to parent.

    Unless qt5ct offer way to disable all gradients, im not sure there any global way to do it.

  • @mrjj

    Well, I just stumbled on something very useful (and quite surprising) - it seems there's an Oxygen Settings app, and it has a "draw background gradient" tickbox.
    Never heard of an app dedicated to altering a specific style before, but it's a very nice idea.

    Thanks for the help, I did learn some stuff.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.