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. Problem with Styling in Qt5
Qt 6.11 is out! See what's new in the release blog

Problem with Styling in Qt5

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.5k 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.
  • M Offline
    M Offline
    Mahima
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mahima
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mahima
        wrote on last edited by
        #3

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

        [/quote]

        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