Problem with Styling in Qt5



  • Hi,

    One month back I ported my application from Qt4 to Qt5.1. Now it is almost settled down but my application's styling is affected a lot. For ex. QMenu is surround with white border, icon and text in QMenu is separated by white line. Buttons become very white.
    In Qt4 I was using QWindowsstyle and Qpalette to get the desired color. In Qt 5 I tried with QProxyStyle, QStylefactory and QCommonStyle but could not get the same look n feel as before. Here is my code for reference.

    @ QCommonStyle *style = CMS_NEW_AUTODEL (QCommonStyle ());
    //QStyleFactory *style = CMS_NEW_AUTODEL (QStyleFactory ());
    //QStyle *windowsStyle = style->create ("fusion");
    //style->create
    QApplication::setStyle (style);

     QPalette palette;
    

    palette.setColor (QPalette::Active, QPalette::Base, QColor(160, 166, 180));
    palette.setColor (QPalette::Active, QPalette::Background, QColor (58, 69, 91));
    ......
    .......
    .......
    palette.setColor (QPalette::Disabled, QPalette::Base, QColor (58, 69, 91));
    palette.setColor (QPalette::Disabled, QPalette::Background, QCOlor (58, 69, 91));

    QApplication::setPalette (palette);@

    Do any one is having idea what is going wrong and how could I get the same look n feel as before ?



  • This issue is solved by using QStyleFactory instead of QProxyStyle.
    QStyleFactory :: create ("Windows");



  • [quote author="Maahi" date="1392205895"]This issue is solved by using QStyleFactory instead of QProxyStyle.
    QStyleFactory :: create ("Windows");

    [/quote]


Log in to reply
 

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