Results 1 to 2 of 2

Thread: why Qicon does not work as I wanted

  1. #1
    Join Date
    Jan 2008
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default why Qicon does not work as I wanted


    Hi, I want to use different icon when I point to my QAction. And I write some simple code for my app.
    But When I selected toggled qaction. My QAction object does not show selected icon.
    What is problem?

    Qt Code:
    1. iconToolButtonLeft = new QIcon();
    2. iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/save.png"), QIcon::Normal, QIcon::On );
    3. iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/greenTick.gif"), QIcon::Active, QIcon::On );
    4. iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/cut.png"), QIcon::Selected, QIcon::On );
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. normalAct = new QAction(*iconToolButtonLeft, tr("&Normal"), editToolBar );
    2. normalAct->setCheckable(true);
    3.  
    4. editToolBar->addAction(normalAct);
    To copy to clipboard, switch view to plain text mode 

    It works for QIcon's normal and active state but does not work in selected state?
    But why?
    thanks in advance
    regards
    Last edited by jpn; 31st July 2008 at 19:46. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: why Qicon does not work as I wanted

    Shouldn't you use Normal/Off combination for toggled action?

    iconToolButtonLeft->addPixmap(QPixmap(":/new/prefix1/Resources/cut.png"), QIcon::Normal, QIcon::Off );

Similar Threads

  1. Make error with Qt Jambi 4.3.2_01
    By pamalite in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd November 2007, 12:05

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.