Qt-interest Archive, March 2008
QPushButton icon/image problem
Message 1 in thread
HI.
I wanna set QPshbutton(QT4.2) with icon or image, icon/image 's size is (60,40) not (32,32) or (16,16)
I have tried following method, but without effect,
1. use the designer to Choose the image "from resource", BUT i cannot find the one(60,40) list in "Icon Property Dialog".
2. add the function in the parent Widget Constructor:
ui.pushButton->setIconSize(QSize(60,40));
ui.pushButton->setIcon(QIcon("E:\\Develop\\VS2005\\Seat\\Resources\\1.png"));
but still not help.
so, how can i fit it?
Regards.
zjk
2008-3-10
Message 2 in thread
HI.
I wanna set QPshbutton(QT4.2) with icon or image, icon/image 's size is
(60,40) not (32,32) or (16,16)
I have tried following method, but without effect,
1. use the designer to Choose the image "from resource", BUT i cannot find
the one(60,40) list in "Icon Property Dialog".
2. add the function in the parent Widget Constructor:
ui.pushButton->setIconSize(QSize(60,40));
ui.pushButton->setIcon(QIcon("E:\\Develop\\VS2005\\Seat\\Resources\\1.png"));
but still not help.
so, how can i fit it?
Regards.
zjk
--
[ signature omitted ]
Message 3 in thread
Hi,
> I wanna set QPshbutton(QT4.2) with icon or image, icon/image 's size is
> (60,40) not (32,32) or (16,16)
> I have tried following method, but without effect,
Do you mean the icon is not displayed, or the size is not correct?
> 1. use the designer to Choose the image "from resource", BUT i cannot find
> the one(60,40) list in "Icon Property Dialog".
What is this "Icon Property Dialog" and how doesn't it work? "Choose file..."
works for me.
> 2. add the function in the parent Widget Constructor:
> ui.pushButton->setIconSize(QSize(60,40));
> ui.pushButton->setIcon(QIcon("E:\\Develop\\VS2005\\Seat\\Resources\\1.png"));
> but still not help.
How doesn't it help? What do you see and what do you expect?
--
[ signature omitted ]
Message 4 in thread
i make it finally , thx all
It work as follows.
1.add the image in .qrc file, or the image would NOT appear int the Icon
Property Dialog.
2.it's unhelpful to use the file path in QIcon ,as it should use the
resource path.
"Dimitri" <dimitri@xxxxxxxxxxxxx> ??????:frjl0a$7rg$1@xxxxxxxxxxxxxxxx
> Hi,
>
>> I wanna set QPshbutton(QT4.2) with icon or image, icon/image 's size
>> is (60,40) not (32,32) or (16,16)
>> I have tried following method, but without effect,
>
> Do you mean the icon is not displayed, or the size is not correct?
>
>> 1. use the designer to Choose the image "from resource", BUT i cannot
>> find the one(60,40) list in "Icon Property Dialog".
>
> What is this "Icon Property Dialog" and how doesn't it work? "Choose
> file..." works for me.
>
>> 2. add the function in the parent Widget Constructor:
>> ui.pushButton->setIconSize(QSize(60,40));
>>
>> ui.pushButton->setIcon(QIcon("E:\\Develop\\VS2005\\Seat\\Resources\\1.png"));
>> but still not help.
>
> How doesn't it help? What do you see and what do you expect?
>
> --
> Dimitri
--
[ signature omitted ]