Results 1 to 4 of 4

Thread: Customise QPushButton shape

  1. #1
    Join Date
    Mar 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Customise QPushButton shape

    Hi,

    I'm trying to make my own QPushButton with customized shape (circle, triangle etc of various dimension and color).
    I started by writing a class inheriting from QPushButton and rewriting the paintEvent, but I'm not managing to getting it to work properly. It doesn't look like a button anymore, cannot be clicked etc...

    Could anyone send some advice on how to do this.

    Cheers
    Anyes

  2. #2
    Join Date
    Jun 2006
    Location
    Vietnam
    Posts
    59
    Thanks
    17
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Customise QPushButton shape

    Please see examples in Qt Demo, direct to Widgets->Style. This is a example about a customized style, it helps you how to create a customized push button & more ...
    Last edited by vql; 21st March 2008 at 13:37.

  3. #3
    Join Date
    Mar 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Customise QPushButton shape

    Hi,

    This example change the whole style of the application and reimplement a different PE_PanelButtonCommand.
    I don't see how I can make coexist buttons of different shapes within the same window application using this.

  4. #4
    Join Date
    Sep 2007
    Location
    Rome, GA
    Posts
    199
    Thanks
    14
    Thanked 41 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Customise QPushButton shape

    Recently I subclassed a QPushButton and re-implemented its paint event to draw my own Vista-style glass button. The code is on the wiki, here:

    http://wiki.qtcentre.org/index.php?title=AeroButton

    Its not exactly what you need I know, but maybe you can see by my example how you can draw your own buttons.

  5. The following user says thank you to JimDaniel for this useful post:

    hiro (4th July 2010)

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.