Results 1 to 3 of 3

Thread: how to reshape pushbutton??

  1. #1
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question how to reshape pushbutton??

    hi all,
    i want to reshape the qpushbutton according to the shape of image.
    i used setIcon(qicon &) to set the image on pushbutton but it is setting the icon on a rectangular pushbutton.But i want the shape of pushbutton as of the image...
    How to do it??

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to reshape pushbutton??

    have a look at QWidget::setMask.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to reshape pushbutton??

    thnx for reply..
    i tried setmask(),but still after using this,i got a black boundary of pushbutton ,when i pressed the qpushbutton....
    i write the following code:
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
    2. {
    3. QPushButton *button_close=new QPushButton(this);
    4. QPixmap image(":/images/but_00.png");
    5. button_close->setGeometry(100,100,image.width(),image.height());
    6. button_close->setFlat(1);
    7. QSize size(image.width(),image.height());
    8. button_close->setIconSize ( size );
    9. button_close->setIcon(image);
    10. button_close->setMask(image.mask());
    11. }
    To copy to clipboard, switch view to plain text mode 
    Is something wrong in code??
    or Is there any other way to do this??
    plzz specify..

Similar Threads

  1. Help me to load one form over another form PushButton
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 26th November 2008, 16:11
  2. Problem with setFont for a PushButton
    By arunvv in forum Newbie
    Replies: 12
    Last Post: 7th April 2008, 23:35
  3. connecting image to a pushbutton
    By sudheer in forum Qt Tools
    Replies: 2
    Last Post: 4th December 2007, 09:23
  4. Replies: 1
    Last Post: 2nd July 2007, 16:29
  5. why pushbutton moving??
    By Shuchi Agrawal in forum Qt Tools
    Replies: 7
    Last Post: 19th January 2007, 17:17

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.