How to change QToolBar background to native style?



  • 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!



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



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



  • [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.



  • [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 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.



  • 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.



  • [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.



  • [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();
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.