Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Dark theme



  • Hi guys I have the following question, I have applied a dark style to my application, so good until then, my question is why the style is not applied to the title bar of my application, and the rest of the forms that open in me application, as you can see, it stays white and looks very bad, any suggestions would be appreciated.

    #include "mainwindow.h"
    
    #include <QApplication>
    #include <QFile>
    #include <QTextStream>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        QFile f(":/qdarkstyle/style.qss");
        f.open(QIODevice::ReadOnly|QIODevice::Text);
        QTextStream ts(&f);
        a.setStyleSheet(ts.readAll());
    
        MainWindow w;
        w.show();
        return a.exec();
    }
    
    

    313aab31-bbad-4427-8517-27bded6228a2-image.png

    I got the subject from here.
    https://github.com/ColinDuquesnoy/QDarkStyleSheet


  • Moderators

    This style only applies to the widgets i.e the client area of the window. The title bar and window frame (the 1pixel border and shadow) are managed by the system window manager. Windows 10 introduces a dark mode and you can query for the colors, but in a true Microsoft fashion changing the frame theme is not officially exposed to the applications.

    There are a few hacks available to enable it if you feel adventurous, but you need to write some platform specific WinAPI spells. Here's one example: win32-darkmode.

    Keep in mind that, since it's unofficial, it can break with any Windows update without notice.


  • Moderators

    This style only applies to the widgets i.e the client area of the window. The title bar and window frame (the 1pixel border and shadow) are managed by the system window manager. Windows 10 introduces a dark mode and you can query for the colors, but in a true Microsoft fashion changing the frame theme is not officially exposed to the applications.

    There are a few hacks available to enable it if you feel adventurous, but you need to write some platform specific WinAPI spells. Here's one example: win32-darkmode.

    Keep in mind that, since it's unofficial, it can break with any Windows update without notice.



  • ok, I understand, thank you.


Log in to reply