Results 1 to 11 of 11

Thread: Transparent widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Transparent widgets

    Quote Originally Posted by incapacitant
    This won't work.
    How does "this won't work"?

    Quote Originally Posted by incapacitant
    What am I doing wrong ?
    Well... I didn't say that it will, but you should start from the simplest solutions

  2. The following user says thank you to jacek for this useful post:

    incapacitant (20th March 2006)

  3. #2
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    106

    Default Re: Transparent widgets

    It shows my pushbutton + pushbutton text value + button shaPe.
    It shows nothing of the background.

    I agree we should try simplest things first.
    Last edited by incapacitant; 20th March 2006 at 21:33. Reason: spelling mistake

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Transparent widgets

    Either this is a wrong approach or it's the QPalette bug. Try to subclass QAbstractButton and draw only text in paintEvent.

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

    incapacitant (21st March 2006)

  6. #4
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    106

    Default Re: Transparent widgets

    Actually I would like to see nothing from my button, not even the text : 100% transparent.
    But subclassing as you propose and using paintEvent is beyond my knowledge. But thank you for helping out. I hope I can find some information about this subclassing in the QT3 book.

  7. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Transparent widgets

    Quote Originally Posted by incapacitant
    I hope I can find some information about this subclassing in the QT3 book.
    You should rather look for a book about programming in C++.

    http://www.qtcentre.org/forum/showthread.php?t=29
    http://www.qtcentre.org/index.php?op...catid=14&id=27

    Qt Code:
    1. class Button : public QAbstractButton
    2. {
    3. public:
    4. Button( QWidget *parent = 0 ) : QAbstractButton( parent ) {}
    5. protected:
    6. void paintEvent( QPaintEvent * ) {}
    7. };
    To copy to clipboard, switch view to plain text mode 

  8. The following user says thank you to jacek for this useful post:

    incapacitant (21st March 2006)

  9. #6
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    106

    Default Re: Transparent widgets

    I am more impressed by your skills than by my lack of knowledge (which is huge!!).
    Of course the piece of code you gave me works 100%.

    Thank you very much.

Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  3. Replies: 0
    Last Post: 11th November 2008, 15:36
  4. Mac OS X Top-Level Transparent Widgets
    By tinsuke in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 16:01
  5. Transparent widgets on top of QGLWidget
    By tseval in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2007, 21:03

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
  •  
Qt is a trademark of The Qt Company.