Results 1 to 4 of 4

Thread: how to make lineedit transparent

  1. #1
    Join Date
    Feb 2012
    Posts
    27
    Thanked 2 Times in 2 Posts

    Default how to make lineedit transparent

    Hi all,
    I have to make one application in which I need to make my Line Edit transparent.....
    if anyone knows that How to make Line Edit transparent then please reply.....

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to make lineedit transparent


  3. #3
    Join Date
    Feb 2012
    Posts
    27
    Thanked 2 Times in 2 Posts

    Default Re: how to make lineedit transparent

    Hey Marek I make it using following code..


    QPalette p;
    p.setColor(lineEdit->backgroundRole(), Qt::transparent);
    lineEdit->setPalette(p);


    But The problem is that the border of the line edit is disturbing my project.... Means I also want to make border transparent.... Is there any way to do that???


    Added after 26 minutes:


    I solve the problem simply using the stylesheet....

    lineEdit->setStyleSheet(QString::fromUtf8("border:0px;""bac kground:transparent"));

    Last edited by RENOLD; 16th February 2012 at 13:15.

  4. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to make lineedit transparent

    Try to avoid stylesheets if possible and use QPalette to do what you want.

    Qt Code:
    1. QPalette palette;
    2. palette.setBrush( QPalette::Base, Qt::transparent );
    3. lineEdit->setPalette( palette );
    4. lineEdit->setFrame( false );
    To copy to clipboard, switch view to plain text mode 
    simples.

Similar Threads

  1. Replies: 0
    Last Post: 5th November 2011, 16:50
  2. make transparent a QTextEdit
    By qlands in forum Newbie
    Replies: 3
    Last Post: 6th October 2011, 15:40
  3. How to make certain areas transparent with the desktop?
    By Sir Rogers in forum Qt Programming
    Replies: 5
    Last Post: 11th May 2010, 22:08
  4. Make the QComboBox popup translucent or transparent ?
    By charlse in forum Qt Programming
    Replies: 5
    Last Post: 18th August 2008, 16:18
  5. how can make the widget transparent
    By duduqq in forum Qt Programming
    Replies: 2
    Last Post: 24th June 2008, 12:24

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.