Results 1 to 2 of 2

Thread: Implement transparent round corners of resizable Qdialog using stylesheets

  1. #1
    Join Date
    Jul 2010
    Posts
    20
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Implement transparent round corners of resizable Qdialog using stylesheets

    Hi

    I tried following code to implement round corners of Qdialog ,but the corners are not transparent , Their color is black.

    All corner of dialog.png is transparent.

    QDialog{
    border-image: url(qss/dialog.png);
    border-width: 5px;
    background-color:transparent;
    }

    and if i use border-radius:3px, It doesn't work. dialog will have a black border.

    This methed works for QPushbutton, but doesn't work for QDialog, I think it's because the QDialog is in toplevel

    Thx in advance,and sry for my bad english

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Implement transparent round corners of resizable Qdialog using stylesheets

    It works for the button since the button is on a widget, so the transparent parts show the parent widget under it.
    A QDialog is a top level widget, which has the desktop under it, and you application knows nothing about it, so the transparent parts become black.
    You will have to use a mask.
    See here:
    http://www.qtcentre.org/threads/3735...ape-of-QDialog
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    vertusd (28th December 2010)

Similar Threads

  1. Qt Widgets seen half transparent when using stylesheets
    By codeslicer in forum Qt Programming
    Replies: 5
    Last Post: 14th December 2010, 09:52
  2. widget not resized within QDockWidget
    By pospiech in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2008, 18:19
  3. QTreeWidget - preventing columns from being resized.
    By sternocera in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2007, 16:11
  4. Semi transparent QDialog
    By cs_raja in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 10:14
  5. QDialog w/ transparent background
    By LarryDobson in forum Qt Programming
    Replies: 6
    Last Post: 26th September 2006, 19:26

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.