Hi,

as fast example:

int main(int argc, char **argv)
{

    MApplication app(argc, argv);
    MApplicationWindow w;
    MApplicationPage p;

    MLayout * layout = new MLayout(p.centralWidget());

    layout->setContentsMargins(0,0,0,0);
    MLinearLayoutPolicy *policy = new
MLinearLayoutPolicy(layout,Qt::Vertical);
    MButton * button1 = new MButton();

    button1->setStyleName("ButtonExample");
    button1->setViewType(MButton::iconType);
    button1->setIconID("icon-l-backup");
    policy->addItem(button1,Qt::AlignCenter);

    layout->setLandscapePolicy(policy);

    p.appear(&w);
    w.show();
    return app.exec();
}

And then you placed in the CSS file the following style:

#ButtonExample {
 icon-size: 60mm 60mm;
}

It will scale your icon until the mentioned size. I tested and it works
without any problem.

Cheers,

Adrian.

On 04/14/2011 10:54 AM, ext Pai, Cary wrote:
> Hi, Rusty,
> 
> Thanks for the response, I have a question about using the MButton, I want to 
> create a button which is only showing the Icon on MButton, when I use 
> "setViewType(MButton::iconType);", the icon can only display in a fix size no 
> matter what I change the icon-size attribute in the CSS file, but if I do not 
> use "setViewType(MButton::iconType);" , the Icon can show the size that I set 
> in the CSS file, but it will have the square button outline under the icon, 
> please tell me how to show an icon button without back square button outline, 
> and showing the exactly size I want, thanks.
> 
> Best Regards.
> 
> Intel Software & Service Group
> 
> [cid:[email protected]]
> 
> B1 #205 Tun-Hwa North Rd, Taipei, Taiwan
> 
> Desk
> 
> +886-2-2514-4603
> 
> Mobile
> 
> +886-987-369-617
> 
> E-Mail
> 
> [email protected]<mailto:[email protected]>
> 
> 
> 
> From: Lynch, Rusty
> Sent: Thursday, April 14, 2011 12:13 PM
> To: Chen, Zhang Z
> Cc: Pai, Cary; [email protected]; [email protected]
> Subject: Re: [MeeGo-dev] Can MTF application use QWidget?
> 
> On 04/13/2011 07:55 PM, Chen, Zhang Z wrote:
> Forwarding to meego-dev
> 
> From: [email protected]<mailto:[email protected]> 
> [mailto:[email protected]] On Behalf Of Pai, Cary
> Sent: Thursday, April 14, 2011 10:14 AM
> To: [email protected]<mailto:[email protected]>
> Subject: [MeeGo-SDK] Can MTF application use QWidget?
> 
> Hi, All,
> 
> I have created a MTF application, but when I run the application with the 
> QPushButton add into MApplicationPage, it will have the segmentation fault, 
> why MTF can't add the QWidget based item? The code I wrote are as below :
> 
> int main(int argc, char *argv[])
> {
>     MApplication a(argc, argv);
>     MApplicationWindow w;
>     MApplicationPage p;
>     QPushButton* but = new QPushButton("test");
>     p.scene()->addWidget(but);
>     p.appear(&w);
>     w.show();
>     return a.exec();
> }
> 
> Since the p.scene() is QGraphicsScene why it will have the error on runtime?
> 
> Your attempting to mix QGraphics programing with QWidget programming.  It is 
> possible to wrap a QWidget for use in a QGraphicsView, but it comes at a cost 
> and is usually the wrong answer.
> 
> For example... if you wanted to add button into an MTF based app, just use 
> MButton (or whatever the name of the associated button class is.)
> 
> I would advise sitting down and reading through all the QGraphicsView 
> programming documentation and tutorials that come with Qt.   Once you 
> comprehend QGraphicsView then MTF programming will make a lot more sense.
> 
>     --rusty
> 
> 
> 
> 
> 
> _______________________________________________
> MeeGo-dev mailing list
> [email protected]
> http://lists.meego.com/listinfo/meego-dev
> http://wiki.meego.com/Mailing_list_guidelines

_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines

Reply via email to