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. How to set background of QToolBar's Dockarea in QMainWindow Mac OS?
Forum Updated to NodeBB v4.3 + New Features

How to set background of QToolBar's Dockarea in QMainWindow Mac OS?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 2.1k 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.
  • joeQJ Offline
    joeQJ Offline
    joeQ
    wrote on last edited by joeQ
    #1

    I used below QSS to my app.

    QWidget {
        background:white;
    }
    
    QToolBar {
        spacing: 0px;
    }
    
    QToolBar::handle {
        background: white;
    }
    
    QDockWidget {
        background: white;
    }
    

    I want to set the whole toolbar's background white. But, has failed. like :

    0_1514451865720_QQ20171228-154247.png

    Thank u.

    Just do it!

    joeQJ 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi
      image is not showing :)
      alt text

      joeQJ 1 Reply Last reply
      0
      • mrjjM mrjj

        hi
        image is not showing :)
        alt text

        joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by joeQ
        #3

        @mrjj

        i upload my image again.

        Just do it!

        1 Reply Last reply
        1
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          Do you have other stylesheets active ?
          Seems to color all of it on default gui project

          alt text

          joeQJ 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Do you have other stylesheets active ?
            Seems to color all of it on default gui project

            alt text

            joeQJ Offline
            joeQJ Offline
            joeQ
            wrote on last edited by joeQ
            #5

            @mrjj

            This QToolBar in Mac OS. I also test it in Win, it is Ok.

            But, It has failed, In Mac. In Mac, The gray area is toolbar dock area in mainwindow.

            All the QSS at here

            QWidget {
                background:white;
            }
            
            QToolBar {
                spacing: 0px;
            }
            
            QToolBar::handle {
                background: white;
            }
            
            QDockWidget {
                background: white;
            }
            

            Just do it!

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Ah
              so it does so on mac only.
              You are using the normal toolbar and not QMacToolBar ?
              sorry have no mac to test with. Its a bit odd its not affected by "Qwidget"

              joeQJ 1 Reply Last reply
              1
              • mrjjM mrjj

                Ah
                so it does so on mac only.
                You are using the normal toolbar and not QMacToolBar ?
                sorry have no mac to test with. Its a bit odd its not affected by "Qwidget"

                joeQJ Offline
                joeQJ Offline
                joeQ
                wrote on last edited by joeQ
                #7

                @mrjj oh, QMacToolBar ? Ok, I know where i wrong. Thank u.

                I will modify my code to use QMacToolBar.

                Just do it!

                1 Reply Last reply
                1
                • joeQJ joeQ

                  I used below QSS to my app.

                  QWidget {
                      background:white;
                  }
                  
                  QToolBar {
                      spacing: 0px;
                  }
                  
                  QToolBar::handle {
                      background: white;
                  }
                  
                  QDockWidget {
                      background: white;
                  }
                  

                  I want to set the whole toolbar's background white. But, has failed. like :

                  0_1514451865720_QQ20171228-154247.png

                  Thank u.

                  joeQJ Offline
                  joeQJ Offline
                  joeQ
                  wrote on last edited by
                  #8

                  @joeQ

                  About this question. Because I used QToolBar in Mac. It was not good way.

                  In Mac, should using QMacToolBar. But, In Windows, you need to use QToolBar.

                  So,In the one Qt project, You should use Q_OS_Mac and Q_OS_Win macro to write code in different OS. I think it's not one good way.

                  It just one ToolBar, include some ToolButtons. That's all. So, The best way is to using QWidget as ToolBar, add some ToolButtons in QWidget. and do not forget to remove mainToolBar from QMainWindow.

                  Just do it!

                  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