Results 1 to 2 of 2

Thread: Widget highlight problem

  1. #1
    Join Date
    Jun 2009
    Posts
    21
    Qt products
    Platforms
    Unix/X11 Windows

    Default Widget highlight problem

    I've problem with making custom widget for context menu. I made custom widget by subclassing QWidget class. In paintEvent method I use brush with QPalette.Highlight color to draw active menu entry, and QPalette.Window color for unhighlited menu entry.
    But I can't obtain the same look with different QApplication style. Highlight color and Window color are different when using Linux and Windows.Additionaly cleanlooks highlighted menu entry have slightly rounded edges. How can I achieve the same look on both platform ?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Widget highlight problem

    You will probably have to use QStyle and draw a QStyle::CE_MenuItem.

Similar Threads

  1. problem in widget inheritance
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2008, 07:35
  2. Syntax highlight selection problem
    By s.toonen in forum Qt Programming
    Replies: 9
    Last Post: 4th June 2008, 12:15
  3. make a widget paint itself even thought it is not shown
    By momesana in forum Qt Programming
    Replies: 7
    Last Post: 28th April 2008, 11:57
  4. Problem applying setWindowOpacity to a custom Widget
    By yellowmat in forum Qt Programming
    Replies: 8
    Last Post: 1st November 2006, 10:05
  5. Replies: 7
    Last Post: 3rd February 2006, 10:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.