Results 1 to 4 of 4

Thread: QT, Is there a method that cancel an icon on a QPushButton, setted with setIcon?

  1. #1

    Default QT, Is there a method that cancel an icon on a QPushButton, setted with setIcon?

    Hi to all guys,

    I'm moving the first steps on QWidget programming. I have setted a icon on a QPushButton, but I can't remove it when I emit a particular signal. In the assigned slot I don't know what method I must use to clean the QPushButton from the icon I have setted.

    Another little help: If I need to create a new window in a QWidget class, how can I do? I've seen that in QWidget there is no chance to make new QWindows, the only window I can use and I must refer to is the QMainWindow. If someone could post a little example I'll be very grateful!!

    Thanks very much for attention!!

    AJ

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QT, Is there a method that cancel an icon on a QPushButton, setted with setIcon?

    Have you tried
    Qt Code:
    1. button->setIcon(QIcon());
    To copy to clipboard, switch view to plain text mode 
    ?

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

    rahuldas (24th July 2011)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT, Is there a method that cancel an icon on a QPushButton, setted with setIcon?

    Quote Originally Posted by anotherjoe View Post
    Another little help: If I need to create a new window in a QWidget class, how can I do? I've seen that in QWidget there is no chance to make new QWindows, the only window I can use and I must refer to is the QMainWindow. If someone could post a little example I'll be very grateful!!
    Qt Code:
    1. QWidget *w = new QWidget;
    2. w->show();
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #4
    Join Date
    Jul 2011
    Location
    Bangalore / Kochin
    Posts
    1
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT, Is there a method that cancel an icon on a QPushButton, setted with setIcon?

    Quote Originally Posted by stampede View Post
    Have you tried
    Qt Code:
    1. button->setIcon(QIcon());
    To copy to clipboard, switch view to plain text mode 
    ?
    Works! Thank you

Similar Threads

  1. [QPushButton] text below icon
    By Tomasz in forum Newbie
    Replies: 10
    Last Post: 3rd December 2010, 15:06
  2. How stretch icon in QPushButton?
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2010, 08:54
  3. QAbstractButton::setIcon | Icon posiition
    By ouekah in forum Newbie
    Replies: 2
    Last Post: 10th May 2010, 23:56
  4. QPushButton - Only show the Icon
    By graciano in forum Newbie
    Replies: 9
    Last Post: 19th September 2009, 21:15
  5. Stretching Icon in QPushButton
    By dsandber in forum Qt Tools
    Replies: 1
    Last Post: 6th October 2007, 16:51

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.