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. Window top edge, unable to control it
Forum Updated to NodeBB v4.3 + New Features

Window top edge, unable to control it

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 395 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.
  • Xena_oX Offline
    Xena_oX Offline
    Xena_o
    wrote on last edited by
    #1

    Hello,

    Im trying to customize a QMainWindow, so i want a customized title bar, so far i figured out it is controled by the os.

    So i disabled it using :

    w.setWindowFlags( Qt::CustomizeWindowHint  );
    

    Then i created my custom title bar beside i had the issue that the menu bar is on top of it, so i created my own menu and placed it under the custom title bar. so far the result looks good the way i want it.

    I also use a style sheet from github to turn the entire window into dark mode.

    Still remainds a small detail, the top edge of the window, stays white or os color, it is not affected by the dark theme, and i dont know what is that and how to control it, just when the mouse goes over it, i can resize the windows (witch is a behavior i want to keep)

    but i want to be able to hide it or change it color and thickness to make it match the window theme, how can i do that ? here is a screenshot :
    alt text

    so area 1 is the issue, the line i want to control.
    area 2 is my customized title bar
    area 3 is my customized menu

    thanks.

    C 1 Reply Last reply
    0
    • Xena_oX Xena_o

      Hello,

      Im trying to customize a QMainWindow, so i want a customized title bar, so far i figured out it is controled by the os.

      So i disabled it using :

      w.setWindowFlags( Qt::CustomizeWindowHint  );
      

      Then i created my custom title bar beside i had the issue that the menu bar is on top of it, so i created my own menu and placed it under the custom title bar. so far the result looks good the way i want it.

      I also use a style sheet from github to turn the entire window into dark mode.

      Still remainds a small detail, the top edge of the window, stays white or os color, it is not affected by the dark theme, and i dont know what is that and how to control it, just when the mouse goes over it, i can resize the windows (witch is a behavior i want to keep)

      but i want to be able to hide it or change it color and thickness to make it match the window theme, how can i do that ? here is a screenshot :
      alt text

      so area 1 is the issue, the line i want to control.
      area 2 is my customized title bar
      area 3 is my customized menu

      thanks.

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @Xena_o said in Window top edge, unable to control it:

      w.setWindowFlags( Qt::CustomizeWindowHint );

      What flags did you set/unset after this?
      What environment is your application running in? Windows, Linux (what window manager), Mac
      What stylesheet?

      Xena_oX 1 Reply Last reply
      0
      • C ChrisW67

        @Xena_o said in Window top edge, unable to control it:

        w.setWindowFlags( Qt::CustomizeWindowHint );

        What flags did you set/unset after this?
        What environment is your application running in? Windows, Linux (what window manager), Mac
        What stylesheet?

        Xena_oX Offline
        Xena_oX Offline
        Xena_o
        wrote on last edited by Xena_o
        #3

        @ChrisW67 i am just using this flag i mentionned wicth removes the titel bar only, nothing else.

        w.setWindowFlags( Qt::CustomizeWindowHint );
        

        Im under Windows 11, Qt 6.5.1, C++, but i need it portable to MacOs and Linux.

        Stylesheet on github click here

        the stylesheet is not involved into the issue, because without using it, the top bar stays white in all cases.

        code to load the stylesheet in main.cpp :

        QFile sf(":qdarkstyle/dark/darkstyle.qss");
        
            if (!sf.exists())   {
                qDebug() << "Unable to set stylesheet, file not found";
            }
            else   {
                sf.open(QFile::ReadOnly | QFile::Text);
                QTextStream ts(&sf);
                qApp->setStyleSheet(ts.readAll());
            }
        
        Xena_oX 1 Reply Last reply
        0
        • Xena_oX Xena_o

          @ChrisW67 i am just using this flag i mentionned wicth removes the titel bar only, nothing else.

          w.setWindowFlags( Qt::CustomizeWindowHint );
          

          Im under Windows 11, Qt 6.5.1, C++, but i need it portable to MacOs and Linux.

          Stylesheet on github click here

          the stylesheet is not involved into the issue, because without using it, the top bar stays white in all cases.

          code to load the stylesheet in main.cpp :

          QFile sf(":qdarkstyle/dark/darkstyle.qss");
          
              if (!sf.exists())   {
                  qDebug() << "Unable to set stylesheet, file not found";
              }
              else   {
                  sf.open(QFile::ReadOnly | QFile::Text);
                  QTextStream ts(&sf);
                  qApp->setStyleSheet(ts.readAll());
              }
          
          Xena_oX Offline
          Xena_oX Offline
          Xena_o
          wrote on last edited by
          #4

          there probably a solution on this code

          however this code works only with Qt5 so it needs to be adjusted for Qt6.

          Also its kinda gas station for such simple thing.

          if i can avoid to do this all, that would great.

          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