This is my code:
QPixmap map(":/Medal.jpg");
QIcon ico(map);
ico.addPixmap(map);
QPushButton *p = new QPushButton;
p->setIcon(ico);
QString link = "http://www.google.com";
QObject::connect(p, SIGNAL(clicked()),window,SLOT(QDesktopServices::openUrl(QUrl (link))));
The pic is showing up but it is not opening the browser. Kindly help me out.
You have to use a lambda function:
or with
std::bind()note:
you need to enable C++11 in Qt, for this review the following question: How to enable C++11 in Qt Creator?, which indicates that you add
CONFIG += c++11in your .pro