There is the possibility of encapsulating widgets in QGraphicItem (as QGraphicWidget), thus allowing them to be used in QML.<br><br>I don't know how these QGraphicWidget's handle QStyle, though....<br><br>- Chris -<br>
<br><div class="gmail_quote">On Thu, Feb 2, 2012 at 14:28, BogDan <span dir="ltr"><<a href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Hi,<br>
<br>
<br>
Yes ! BorderImage seems to be exactly the same thing with NinePatch, thanks for the tip !<br>
<br>
<br>
Anyway, as I said before I'd like to have a QStyle plugin which paints the classic widget also the qml ones, because it seems classic widgets are sill use by a lot of people !<br>
<div class="im HOEnZb"><br>
Cheers,<br>
<br>
BogDan.<br>
<br>
<br>
<br>
----- Original Message -----<br>
> From: Kate Alhola <<a href="mailto:kate.alhola@gmail.com">kate.alhola@gmail.com</a>><br>
</div><div class="im HOEnZb">> Sent: Wednesday, February 1, 2012 10:59 PM<br>
> Subject: Re: Integrating Qt Quick components in Ministro<br>
><br>
</div><div class="HOEnZb"><div class="h5">> Some quick look comments:<br>
><br>
> On Wed, Feb 1, 2012 at 9:20 PM, BogDan <<a href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>> wrote:<br>
>> Hello everyone,<br>
>><br>
>> I have good news on this topic, I manage to check (a little bit)<br>
> Android's source code and to extract, the exact, android's look and<br>
> style informations for a few widgets (buttonStyle, editTextStyle,<br>
> radioButtonStyle, checkboxStyle, etc.) and store them into a .json file (check<br>
> the attachment). Because qt 4.x doesn't come with json support, IMHO we have<br>
> two options:<br>
>> 1 - to use this [1] qt json implementation.<br>
>> 2 - or to backport Qt 5.x json implementation (my favorite option,<br>
> because it seems more complex and complete than the first one).<br>
>><br>
>> I need more time to finish the extraction class (which will be part of<br>
> the next Ministro release), so, if someone wants to step in and begin the Qt<br>
> implementation it will be very appreciated !<br>
>><br>
>> To understand how android paints the widgets you have to check a simple<br>
> widget how it's painted. So let's check Button class [2], which extends<br>
> TextView class [3] which extends the View class [4].<br>
>><br>
>> How it works:<br>
>> - Button class only pass to its super class (TextView) the style<br>
> attribute (com.android.internal.R.attr.buttonStyle)<br>
>> - TextView class pass the same information to its super class (View) then<br>
> in its constructor (check "public TextView(Context context, AttributeSet<br>
> attrs, int defStyle)" ) extracts text informations<br>
> (e.g.TextAppearance_textColor,TextAppearance_textSize, TextAppearance_typeface,<br>
> etc.) which are used to draw the text (check onDraw (...)).<br>
>> - View class in its constructor (check "public View(Context context,<br>
> AttributeSet attrs, int defStyle)") extracts a few informations e.g.<br>
> View_background, View_paddingLeft, etc. which are used to paint the basic parts<br>
> of the widget (e.g. the background).<br>
>><br>
>> If you check the json file, you'll see that there are more than one<br>
> .png files used to paint the background, one for every view state (enabled,<br>
> disabled, pressed, etc.). Android split every .png file into nine pieces (it<br>
> uses nine patch technique [5], [6]) which are used to seamlessly resize the<br>
> widget. AFAIK there is no support for such a thing into Qt, so IMHO this is the<br>
> first thing which must be implemented.<br>
>><br>
><br>
> The nime patch looks exactly same than Qt BorderImage (<br>
> <a href="http://developer.qt.nokia.com/doc/qt-4.8/qml-borderimage.html" target="_blank">http://developer.qt.nokia.com/doc/qt-4.8/qml-borderimage.html</a> )<br>
><br>
><br>
> Also, system that uses different images for different states is<br>
> exactly same that is used on components<br>
> meegotouch-button-background-pressed.png<br>
> meegotouch-button-background.png<br>
> meegotouch-button-background-selected.png<br>
> ....<br>
> and this for all combinations, inverted, disabled ...<br>
><br>
> The problem then comes more than could we do some mapping of Android<br>
> and MeeGotouch states like<br>
> meegotouch-button-background -> buttonStyle_View-background_Enabled.png<br>
><br>
> MeeGocomponents uses mthemedaemon plugin that fetch images, so, if we<br>
> could make just mapping names<br>
> and json query, we could in theory get theme engine.<br>
><br>
> Symbian components uses svg images , meegocomponents borderimages .<br>
> There is very little<br>
> difference in component API's. Least what I have used, porting on apps<br>
> were mostly changing import statements<br>
> and change of some colors.<br>
><br>
> Kate<br>
><br>
>> This weekend I hope to have enough time to create a wiki page which will<br>
> describe the content of the json file.<br>
>><br>
>> Cheers,<br>
>> BogDan.<br>
>><br>
>><br>
>> [1] <a href="https://github.com/ereilin/qt-json" target="_blank">https://github.com/ereilin/qt-json</a><br>
>> [2]<br>
> <a href="http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/widget/Button.java.htm" target="_blank">http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/widget/Button.java.htm</a><br>
>> [3]<br>
> <a href="http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/widget/TextView.java.htm" target="_blank">http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/widget/TextView.java.htm</a><br>
>> [4]<br>
> <a href="http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/view/View.java.htm" target="_blank">http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/view/View.java.htm</a><br>
>> [5] <a href="http://developer.android.com/reference/android/graphics/NinePatch.html" target="_blank">http://developer.android.com/reference/android/graphics/NinePatch.html</a><br>
>><br>
>> [6]<br>
> <a href="http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch" target="_blank">http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch</a><br>
>><br>
>><br>
>>><br>
>>> Hi,<br>
>>><br>
>>> Yes, sadly we have to get our hands very dirty.<br>
>>> First step is to identify all Qt components then we have to find<br>
>>> Android's corresponding components, then we must extract the style<br>
> &<br>
>>> look information to a central location (IMHO Ministro should do this<br>
> job), then<br>
>>> any application which starts will peek this infos from that location<br>
> and use<br>
>>> them to paint all controls.<br>
>>> Second step is to check how Android paints the controls, here the<br>
> things will<br>
>>> become dirty, we have to check<br>
>>> "frameworks/base/core/java/android/widget/TextView.java" from<br>
> Android<br>
>>> source code and it seems we have to use a lot of private data, I hope<br>
> the<br>
>>> Android versions are not so different.<br>
>>> Third step is to change Ministro in order to extract all the infos we<br>
> need to<br>
>>> paint our controls.<br>
>>> Fourth step is to create a QStyle plugin (which will be used by QML<br>
> as well)<br>
>>> which loads the data extracted by Ministro and use it to paint the<br>
> controls. If<br>
>>> the extract procedure is very fast (less than 10ms), I doubt it will be<br>
> that<br>
>>> fast :), we can skip the third step and extract the data directly in <br>
> QStyle.<br>
>>> Fifth step, if everything works, we must get drunk !<br>
>>><br>
>>><br>
>>> Cheers,<br>
>>> BogDan.<br>
>>><br>
>>><br>
>>>><br>
>>>><br>
>>>> While I don't agree on "almost all applications have the<br>
> same<br>
>>> look" (as far as I can see, the only fully common UI element is<br>
> the<br>
>>> menu/toolbar combo), I respect your choice.<br>
>>>><br>
>>>> The first step would be to define what is the "Android<br>
> style". Is<br>
>>> there some Google guidelines you plan to follow?<br>
>>>><br>
>>>> Regards<br>
>>>> - Chris -<br>
>>>><br>
>>>><br>
>>>> On Tue, Jan 3, 2012 at 17:45, BogDan <<a href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>><br>
> wrote:<br>
>>>><br>
>>>> Hi,<br>
>>>>><br>
>>>>><br>
>>>>> I think none of your examples are good to follow :) The<br>
> reason why<br>
>>> meego doesn't use QtStyle to draw the widgets is because meego<br>
> doesn't<br>
>>> have a "native" style. Symbian is even worst, open any two<br>
>>> applications on symbian and you'll see that none of them have the<br>
> same look<br>
>>> & style :) On Android is a different story, almost all applications<br>
> have the<br>
>>> same look & style, so if we want to have a first class citizen<br>
> port, all Qt<br>
>>> applications *MUST* look the same as any android application. I'm<br>
> choosing<br>
>>> to make QStyle plugin because this way all Qt applications will benefit<br>
> from it,<br>
>>> either they are made using old-fashion widgets or QML components.<br>
>>>>> For me a good android style is a top priority, I don't<br>
> believe<br>
>>> I'll have enough time to finish it till beta 1 but who knows ...:)<br>
> maybe if<br>
>>> other people will join me we can split the work and we can have this<br>
> feature in<br>
>>> time for beta1.<br>
>>>>><br>
>>>>><br>
>>>>> Cheers,<br>
>>>>> BogDan.<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>>><br>
>>>>>> and please note that the Qt quick components (either<br>
> symbian or<br>
>>> meego) don't use Qt widget styles. All the components are drawn in<br>
> qml so<br>
>>> the componenets would unfortunately not benefit from your work on a<br>
> widget<br>
>>> style.<br>
>>>>>>> - Chris -<br>
>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> On Thu, Dec 22, 2011 at 21:53, BogDan<br>
> <<a href="mailto:bog_dan_ro@yahoo.com">bog_dan_ro@yahoo.com</a>><br>
>>> wrote:<br>
>>>>>><br>
>>>>>><br>
>>>>>>><br>
>>>>>>> Hi Chris,<br>
>>>>>>><br>
>>>>>>> Please accept my apologize for the slow reply.<br>
>>>>>>> I think before we'll integrate the components into<br>
> Ministro,<br>
>>> we must do a few things:<br>
>>>>>>> - the components MUST use Android's style, next<br>
> year<br>
>>> I'm planning to create a style plugin for<br>
>>>>>>><br>
>>>>>>> widgets which should be used by Qt Quick Components for<br>
> Android.<br>
>>>>>>> - wait until Nokia finishes to define the API for Qt<br>
> Quick<br>
>>> components [1]. We can't afford to break the API after we release<br>
> it :)<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> Cheers,<br>
>>>>>>> BogDan.<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> [1]<br>
> <a href="https://bugreports.qt.nokia.com/browse/QTCOMPONENTS-200" target="_blank">https://bugreports.qt.nokia.com/browse/QTCOMPONENTS-200</a><br>
>>>>>>><br>
>>>>>>><br>
>>>>>>>><br>
>>>>>>>> Hi guys,<br>
>>>>>>>><br>
>>>>>>>> What would the steps be to integrate the Qt quick<br>
> components<br>
>>> for Android to Ministro as a package?<br>
>>>>>>>><br>
>>>>>>>> - Chris -<br>
>>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>> _______________________________________________<br>
>>> Necessitas-devel mailing list<br>
>>> <a href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br>
>>> <a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a><br>
>>><br>
><br>
</div></div></blockquote></div><br>