[SOLVED] Error while trying to add Icon to QPushButton



  • Hi there,
    I have the following simple code

    micon=new QIcon(QIcon::fromTheme("arrow-down"));
    button->setIcon(micon);
    

    Where

    QPushButton *button;
    QIcon *micon;
    

    are described in the header file.
    And when I'm trying to compile the compiler gives me an error message

    ERROR: no matching function for call to 'QPushButton::setIcon(QIcon*&)
    

    But it is ok for the compiler to write

    button->setIcon(QIcon::fromTheme("arrow-down"));
    

    and don't use "micon" variable.
    I am totally new to Qt so if someone can explain this to me I'll be really grateful.
    Thanks :)



  • sorry for stupid thread... I didnt think much about before posting.. fixed already...


  • Qt Champions 2016

    @Aram
    Its completely ok.
    Just mark it as SOLVED and all will be happy


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.