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. Setting the background-color of separators only works when separators are draggable
Forum Updated to NodeBB v4.3 + New Features

Setting the background-color of separators only works when separators are draggable

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 2.3k Views 2 Watching
  • 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.
  • K Offline
    K Offline
    Kerndog73
    wrote on last edited by Kerndog73
    #1

    I have three QDockWidgets on my QMainWindow. I would like to change the color of the separators. I'd also like to make the separators 2 pixels thick so I tried setting the stylesheet of the window to this:

    QMainWindow::separator {
      width: 2px;
      height: 2px;
      background-color: #B8CDD7;
    }
    

    The dock on the bottom of the screen is resizable and the separator has the color correctly applied. The docks on the left and right are not resizable and the separator doesn't have the color applied. The width of the side docks is being set but the background color is the default window background. Maybe the separators are invisible when they aren't draggable? Or perhaps I need to use a selector for non-draggable separators?

    As a quick test, I removed a call to setFixedWidth from one of the side docks and the separator color was correctly applied. This definitely has something to do with the draggability of the separators.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should also mention:

      • Qt version
      • OS running

      Can you provide a minimal compilable example that shows your situation ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You should also mention:

        • Qt version
        • OS running

        Can you provide a minimal compilable example that shows your situation ?

        K Offline
        K Offline
        Kerndog73
        wrote on last edited by
        #3

        @SGaist Here's an MCVE of the problem:

        #include <QtWidgets/qdockwidget.h>
        #include <QtWidgets/qmainwindow.h>
        #include <QtWidgets/qapplication.h>
        
        void addDock(QMainWindow *window, Qt::DockWidgetArea area, QWidget *widget) {
          QDockWidget *dock = new QDockWidget{window};
          dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
          dock->setAllowedAreas(area);
          dock->setWidget(widget);
          dock->setTitleBarWidget(new QWidget{dock});
          window->addDockWidget(area, dock);
        }
        
        int main(int argc, char **argv) {
          QApplication app{argc, argv};
          QMainWindow window;
          
          window.setStyleSheet(R"(
            QMainWindow::separator {
              width: 10px;
              height: 10px;
              background-color: #F00;
            }
          )");
          
          QWidget bottom{&window};
          bottom.setMinimumHeight(100);
          bottom.setStyleSheet("background-color: #0F0");
          addDock(&window, Qt::BottomDockWidgetArea, &bottom);
          
          QWidget left{&window};
          left.setFixedWidth(100);
          left.setStyleSheet("background-color: #00F");
          addDock(&window, Qt::LeftDockWidgetArea, &left);
          
          QWidget center{&window};
          center.setMinimumSize(300, 300);
          center.setStyleSheet("background-color: #0FF");
          window.setCentralWidget(&center);
          
          window.show();
          
          return app.exec();
        }
        

        This is what I'm seeing:

        Screenshot

        Notice that the separator between the left widget and the central widget is the default window background color (not red).

        I'm using Qt 5.12.3 on macOS 10.14.4

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kerndog73
          wrote on last edited by
          #4

          Could this be a bug? Maybe I'm just doing something wrong?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            I think you have found a bug. Did you already check the bug report system ? If not, please do so and if you find nothing, consider opening a new report providing your example. If there's already a report, update it with the information you currently have.

            I can also confirm this happens on Linux with the current dev branch of qtbase.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            K 3 Replies Last reply
            1
            • SGaistS SGaist

              I think you have found a bug. Did you already check the bug report system ? If not, please do so and if you find nothing, consider opening a new report providing your example. If there's already a report, update it with the information you currently have.

              I can also confirm this happens on Linux with the current dev branch of qtbase.

              K Offline
              K Offline
              Kerndog73
              wrote on last edited by
              #6

              @SGaist I had a look at the bug tracker and couldn't anything. I'll open a new bug report and post a link here.

              1 Reply Last reply
              0
              • SGaistS SGaist

                I think you have found a bug. Did you already check the bug report system ? If not, please do so and if you find nothing, consider opening a new report providing your example. If there's already a report, update it with the information you currently have.

                I can also confirm this happens on Linux with the current dev branch of qtbase.

                K Offline
                K Offline
                Kerndog73
                wrote on last edited by
                #7

                @SGaist I have reported the bug.

                1 Reply Last reply
                3
                • SGaistS SGaist

                  I think you have found a bug. Did you already check the bug report system ? If not, please do so and if you find nothing, consider opening a new report providing your example. If there's already a report, update it with the information you currently have.

                  I can also confirm this happens on Linux with the current dev branch of qtbase.

                  K Offline
                  K Offline
                  Kerndog73
                  wrote on last edited by
                  #8

                  @SGaist I don't mean to sound impatient but does it usually take this long to get a response on a bug report? I mean, it's been a month and there's been no response. The bug can be reproduced with a 44 line C++ program. I even included screenshots of the expected and actual results.

                  Although, this isn't a critical bug. I just have to include an annoying workaround in my application.

                  J.HilkJ 1 Reply Last reply
                  0
                  • K Kerndog73

                    @SGaist I don't mean to sound impatient but does it usually take this long to get a response on a bug report? I mean, it's been a month and there's been no response. The bug can be reproduced with a 44 line C++ program. I even included screenshots of the expected and actual results.

                    Although, this isn't a critical bug. I just have to include an annoying workaround in my application.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @Kerndog73
                    sadly not uncommon. If it's not a critical bug.

                    Take a look at this bugreport

                    https://bugreports.qt.io/browse/QTBUG-63157

                    created Sep. 2017. The issue is, that no virtual keyboard is shown on iOS if you use QQuickWidget and any Input item.

                    One would think this would have somewhat high priority...


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    1

                    • Login

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