Results 1 to 10 of 10

Thread: Icon only button

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Icon only button

    I never am able to do this:
    I did what the previous poster said,
    [qtcode]
    #include <QApplication>
    #include <QPushButton>
    int main(int argc, char *argv[])
    {

    QApplication app(argc, argv);
    QPushButton *pushButton = new QPushButton(QIcon("TestQT.ico"), "text", 0);
    pushButton->show();
    return app.exec();

    }

    [/qtcode]

    However, even though TestQT.ico and this program are in same folder, it does not work... neither does C:/blabla.... What do I do?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Icon only button

    ICO is neither a supported format. It is available as a commercial solution, though. As far as I remember, there is some open source implementation out there as well.

    You can simply use supported image formats, like PNG for constructing a QIcon.
    Use the QImageReader::supportedImageFormats() and QImageWriter::supportedImageFormats() functions to retrieve a complete list of the supported file formats.
    J-P Nurmi

Similar Threads

  1. set Icon to .app file
    By vishal.chauhan in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 21:13
  2. Mouse Over event on button
    By vishal.chauhan in forum Qt Programming
    Replies: 9
    Last Post: 10th January 2007, 05:03
  3. QPushbutton Flat property and icon appearance.
    By darpan in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2006, 08:30
  4. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40
  5. Displaying Icon
    By Seema Rao in forum Qt Programming
    Replies: 4
    Last Post: 9th February 2006, 20:43

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
  •  
Qt is a trademark of The Qt Company.