Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Dark theme

Dark theme

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • lincolnL Offline
    lincolnL Offline
    lincoln
    wrote on last edited by
    #1

    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

    Solitary wolf

    Chris KawaC 1 Reply Last reply
    0
    • lincolnL lincoln

      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

      Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      2
      • lincolnL Offline
        lincolnL Offline
        lincoln
        wrote on last edited by
        #3

        ok, I understand, thank you.

        Solitary wolf

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved