×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Oct 2010
    Location
    chennai
    Posts
    97

    Exclamation Making a dialog/widget as a transparent dialog/widget

    How to make a dialog/widget as a transparent dialog/widget????????

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Making a dialog/widget as a transparent dialog/widget

    Yes, You can make the widget or Dialog transparent.....
    Explanation is given in this article : Transparent Widget or Dialog

    Best regards,

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Making a dialog/widget as a transparent dialog/widget

    This is an example to draw a semitransparent gradient rounded rect... hope this helps
    void YourWidget:aintEvent(QPaintEvent *){
    QPainter painter( this );
    QRect rect(0,0,100,200);
    QPointF startPoint(rect.x(),rect.y());
    QPointF stopPoint(rect.x(),rect.y()+rect.height());
    QLinearGradient fade;
    fade.setStart(startPoint);
    fade.setFinalStop(stopPoint );
    fade.setColorAt( 0.0, QColor(0xf2,0x48,0xa0,0xc0));
    fade.setColorAt( 0.5, QColor(0xe2,0x41,0x92,0xc0));
    fade.setColorAt( 1.0, QColor(0xbc,0x21,0x6d,0xc0) );
    QPen pen;
    pen.setColor(QColor(0xff,0xff,0xff));
    pen.setWidth(2);
    QBrush brush=QBrush(fade);
    painter.setPen(pen);
    painter.setBrush(brush);
    painter.drawRoundedRect(rect.x(),rect.y(), rect.width(), rect.height(),10,10);
    }
    Last edited by lucarocchi; 2010-12-06 at 13:52.

Similar Threads

  1. Replies: 4
    Last Post: 2010-12-08, 04:28
  2. What is the difference between Widget and dialog?
    By rahul.kulshreshtha in forum Qt
    Replies: 1
    Last Post: 2010-09-20, 13:42
  3. How to make widget grow outside of its parent widget
    By supermanfg in forum [Archived] Qt SDKs and Tools
    Replies: 3
    Last Post: 2010-01-09, 11:07
  4. Replies: 1
    Last Post: 2009-12-20, 05:28
  5. Replies: 1
    Last Post: 2009-08-06, 04:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×