Results 1 to 2 of 2

Thread: QMessageBox icon

  1. #1
    Join Date
    Dec 2010
    Posts
    33
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default QMessageBox icon

    I have a QMessageBox,
    Qt Code:
    1. MessageBox loadMsgBox;
    2. loadMsgBox.setText("Loading file...");
    3. loadMsgBox.setWindowTitle(" ");
    4. loadMsgBox.setIconPixmap(QPixmap("./icons/icon_loading.gif"));
    5. loadMsgBox.exec();
    To copy to clipboard, switch view to plain text mode 

    I want to set the main icon on the title bar, by default it shows a white rectangle. How do i change that?

  2. #2
    Join Date
    Apr 2011
    Posts
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMessageBox icon

    Hi
    Use setWindowIcon();

    example:
    Qt Code:
    1. loadMsgBox.setWindowIcon(QIcon(QPixmap("./icons/ico.png")));
    To copy to clipboard, switch view to plain text mode 

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

    penny (8th April 2011)

Similar Threads

  1. QMessageBox missing icon
    By zanth in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2010, 22:20
  2. Replies: 2
    Last Post: 12th October 2008, 15:42
  3. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 20:03
  4. QMessageBox Icon Issue and How to add a dir to Qt Resources File
    By vishal.chauhan in forum Qt Programming
    Replies: 19
    Last Post: 25th March 2007, 01:13
  5. customize the Icon QMessageBox
    By QiT in forum Newbie
    Replies: 1
    Last Post: 26th August 2006, 11:40

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.