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 change QToolBar background to native style?
Qt 6.11 is out! See what's new in the release blog

How to change QToolBar background to native style?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 7.4k Views 1 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.
  • L Offline
    L Offline
    Loaden
    wrote on last edited by
    #1

    Hi, All!
    In Windows 7, I found the QToolBar's backgroud is very ugly!
    It's is not the Windows 7's Native Style.
    !http://loaden.googlecode.com/files/qtoolbar.png(QToolBar)!
    Could you tell me how to change the background style?
    Thank you very much!

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      You can set QStyle or QWindowsStyle or what ever you want.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Or you can use stylesheets to change the style (refer to "here":http://doc.qt.nokia.com/4.7/stylesheet.html)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          [quote author="VCsala" date="1293351962"]Or you can use stylesheets to change the style (refer to "here":http://doc.qt.nokia.com/4.7/stylesheet.html)[/quote]

          I dont think it is possible to change the style to platforms native style using stylesheet.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            [quote author="Immii" date="1293351716"]You can set QStyle or QWindowsStyle or what ever you want.[/quote]

            No, QStyle can't do it! In Windows 7, The Toolbar can not show the native style.
            And looks there not have any style named: QWindows7Style, that's right?

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              [quote author="niby" date="1293356956"][quote author="Immii" date="1293351716"]You can set QStyle or QWindowsStyle or what ever you want.[/quote]

              No, QStyle can't do it! In Windows 7, The Toolbar can not show the native style.
              And looks there not have any style named: QWindows7Style, that's right?[/quote]

              As I know there is no Windows 7 style yet, however you can use QWindowsVistaStyle which (I had no chance to check) calls the Windows 7 theme API.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                Ah.. If there is no Window7Style then we should create a bug or feature request, But Style Sheet can not do the native style painting.

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  [quote author="Immii" date="1293382318"]Style Sheet can not do the native style painting.[/quote]

                  No one said it can, but it can be used to emulate similar effects.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Loaden
                    wrote on last edited by
                    #9

                    [quote author="VCsala" date="1293380975"]
                    As I know there is no Windows 7 style yet, however you can use QWindowsVistaStyle which (I had no chance to check) calls the Windows 7 theme API.[/quote]
                    Thanks for reply!
                    I am try, but it has no effect.
                    @int main(int argc, char *argv[])
                    {
                    QApplication app(argc, argv);
                    app.setStyle(new QWindowsVistaStyle);

                    MainWindow mainWin;
                    mainWin.show();
                    return app.exec();
                    

                    }@

                    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