How to change style of window?



  • Hello

    Is it possible to change style of windows application in Qt? I want some styles like Delphi 6 styles.
    For example program should be able to change style its style from Windows XP default to a Vista-like, or Mac style (Window control buttons, widgets and background changes...)


  • Moderators

    Do you want this to happen on a windows system only?

    Qt follows the style of the OS it is on, but you can change the style yourself. You can even test some of them using Qt Creator using the form preview.
    Some of the styles are dependant of the OS. On Windows for instance it is not possible to have the Mac style because the mac api's are needed for that.

    You can use code to set the style and you can make your own style if you want.
    there is a good introduction in the "the official -QT- Qt book.":http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip



  • bq. Do you want this to happen on a windows system only?

    Yes, my app is a windows application.

    I can set style of widgets with style sheets, but also want to change style of the window. I mean title bar, close button, maximize and minimize button.



  • With the styles, you can change the inner part of the application, but not the top level window borders, or the window headers with the app name, min/max/close button etc.

    Changing this must be done in an OS dependant way by overwriting some messages...



  • bq. Changing this must be done in an OS dependant way by overwriting some messages…

    So, how should I do that?



  • [quote author="Eddy" date="1313307714"]
    "the official -QT- Qt book.":http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip
    [/quote]
    Eddy you did it again :-D


  • Moderators

    @rokemoon
    Thanks for being my personal Qt spellchecker.

    I'll have a look at some settings to avoid this automatic uppercase while i'm mobile.



  • [quote author="Eddy" date="1313331476"]@rokemoon
    Thanks for being my personal Qt spellchecker.
    [/quote]
    Eddy, I'm just kidding, nothing personal :-)



  • [quote author="soroush" date="1313309286"]bq. Changing this must be done in an OS dependant way by overwriting some messages…

    So, how should I do that?[/quote]

    As I told you, it's OS dependant. I don't know how to do it on Linux / mac, but on windows, you have to overwrite winEvent and handle WM_NCXXX messages. there are couple of descriptions around on the internet about that, so I suggest you search with google. It's not trivial, and it's on my list to write a wiki for windows on that, but that's currently far away, it's much code you need for that currently...


Log in to reply
 

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