X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=Client%2Fcustombutton.cpp;h=39072673261f98bfc969b810a40432d2b6d1b0aa;hb=04e7348e047307f792f88b7a3e198a008eef0e8b;hp=af023adc5735271ce35a2dffd06bc73a3a2d07da;hpb=11f1a13db92a9ba7798952e6760ba68dcd20eb6f;p=speedfreak diff --git a/Client/custombutton.cpp b/Client/custombutton.cpp index af023ad..3907267 100644 --- a/Client/custombutton.cpp +++ b/Client/custombutton.cpp @@ -17,10 +17,17 @@ CustomButton::CustomButton(QWidget *parent, QIcon *icon) : QWidget(parent) { bPressed = false; + //Get size of the icon + QList list = icon->availableSizes(QIcon::Normal,QIcon::On); + + //If icon is empty, do not create pixmaps and leave + if(list.isEmpty()) + return; + QSize size = list.first(); if( icon ) { - pict1 = new QPixmap(icon->pixmap(125,125,QIcon::Normal,QIcon::On)); - pict2 = new QPixmap(icon->pixmap(125,125,QIcon::Normal,QIcon::Off)); + pict1 = new QPixmap(icon->pixmap(size.width(),size.height(),QIcon::Normal,QIcon::On)); + pict2 = new QPixmap(icon->pixmap(size.width(),size.height(),QIcon::Normal,QIcon::Off)); } } /**