Re: [Interest] Clean way to define and categorize constants in QML

2016-04-29 Thread Jérôme Godbout
Note, you can also have to add the QObject* parent on the QmlObject.

On Fri, Apr 29, 2016 at 2:34 PM, Jérôme Godbout  wrote:

>
>1. You can do an Item as root object to put children. Annoying because
>it get a lot of unused properties.
>2. Or you can do your own QtObjectWithChildren from C++, which is just
>a QObject with children default property list of QObject*. (We did this and
>call them QmlObject)
>3. Or use a javascript map, annoying to emit changed() when modifying
>a single value inside the map.
>
> ex 2 implemented:
> QmlObject
> {
>   readonly property alias myCategory: myCategory_
>
>   QmlObject
>   {
>  id: myCategory_
>  readonly property color red: "#FF0"
>   }
> }
>
> On Fri, Apr 29, 2016 at 2:12 PM, Viktória Nemkin <
> viktoria.nem...@gmail.com> wrote:
>
>> Thank you for your help. The syntax for creating a named object property
>> is what I needed.
>>
>> Regards,
>> Viki
>>
>> On 29 April 2016 at 13:12, Kristoffersen, Even (NO14) <
>> even.kristoffer...@honeywell.com> wrote:
>>
>>> Those internal elements are not directly accessible.
>>>
>>> You can try exposing them with the use of *alias* in the root object.
>>>
>>>
>>>
>>>
>>>
>>> -Even
>>>
>>>
>>>
>>> *From:* Interest [mailto:interest-bounces+even.kristoffersen=
>>> honeywell@qt-project.org] *On Behalf Of *Viktória Nemkin
>>> *Sent:* 29. april 2016 13:04
>>> *To:* interest@qt-project.org
>>> *Subject:* [Interest] Clean way to define and categorize constants in
>>> QML
>>>
>>>
>>>
>>> Hello!
>>>
>>>
>>>
>>> What is a clean way to define and categorize constants in QML?
>>>
>>>
>>>
>>> I have came up with this so far:
>>>
>>>
>>>
>>> I have a QML singleton element, named Theme. There I keep a few constant
>>> things, like different background and font colors.
>>>
>>>
>>>
>>> Theme.qml:
>>>
>>> pragma Singleton
>>>
>>> import QtQuick 2.0
>>>
>>> QtObject {
>>>
>>> readonly property color backgroundRed: "#FF2510"
>>>
>>> readonly property color backgroundWhite: "#F0F0F0"
>>>
>>> readonly property color backgroundPurple: "#930083"
>>>
>>> readonly property color fontRed: "#FF1010"
>>>
>>> readonly property color fontWhite: "#F6F6F6"
>>>
>>> }
>>>
>>>
>>>
>>> When I want to use one of the colors I write:
>>>
>>>
>>>
>>> color: Theme.backgroundRed
>>>
>>>
>>>
>>> I don't like this approach. What I would like to be able to write is
>>> this:
>>>
>>>
>>>
>>> color: Theme.background.red
>>>
>>>
>>>
>>> I have tried adding nested QtObjects inside Theme but I could not get it
>>> working.
>>>
>>>
>>>
>>> QtObject {
>>>
>>> QtObject {
>>>
>>> id: *background*
>>>
>>> readonly property color red: "#FF2510"
>>>
>>> readonly property color white: "#F0F0F0"
>>>
>>> readonly property color purple: "#930083"
>>>
>>> }
>>>
>>>
>>>
>>> QtObject {
>>>
>>> id: *font*
>>>
>>> readonly property color red: "#FF1010"
>>>
>>> readonly property color white: "#F6F6F6"
>>>
>>> }
>>>
>>> }
>>>
>>>
>>>
>>> When I run it like this, I get an error: Theme.qml: Cannot assign to
>>> non-existent default property.
>>>
>>> Is there a way to accomplish this? Is there any clean way to define and
>>> categorize constants in QML?
>>>
>>> Thank you,
>>> Viki
>>>
>>
>>
>> ___
>> Interest mailing list
>> Interest@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Clean way to define and categorize constants in QML

2016-04-29 Thread Jérôme Godbout
   1. You can do an Item as root object to put children. Annoying because
   it get a lot of unused properties.
   2. Or you can do your own QtObjectWithChildren from C++, which is just a
   QObject with children default property list of QObject*. (We did this and
   call them QmlObject)
   3. Or use a javascript map, annoying to emit changed() when modifying a
   single value inside the map.

ex 2 implemented:
QmlObject
{
  readonly property alias myCategory: myCategory_

  QmlObject
  {
 id: myCategory_
 readonly property color red: "#FF0"
  }
}

On Fri, Apr 29, 2016 at 2:12 PM, Viktória Nemkin 
wrote:

> Thank you for your help. The syntax for creating a named object property
> is what I needed.
>
> Regards,
> Viki
>
> On 29 April 2016 at 13:12, Kristoffersen, Even (NO14) <
> even.kristoffer...@honeywell.com> wrote:
>
>> Those internal elements are not directly accessible.
>>
>> You can try exposing them with the use of *alias* in the root object.
>>
>>
>>
>>
>>
>> -Even
>>
>>
>>
>> *From:* Interest [mailto:interest-bounces+even.kristoffersen=
>> honeywell@qt-project.org] *On Behalf Of *Viktória Nemkin
>> *Sent:* 29. april 2016 13:04
>> *To:* interest@qt-project.org
>> *Subject:* [Interest] Clean way to define and categorize constants in QML
>>
>>
>>
>> Hello!
>>
>>
>>
>> What is a clean way to define and categorize constants in QML?
>>
>>
>>
>> I have came up with this so far:
>>
>>
>>
>> I have a QML singleton element, named Theme. There I keep a few constant
>> things, like different background and font colors.
>>
>>
>>
>> Theme.qml:
>>
>> pragma Singleton
>>
>> import QtQuick 2.0
>>
>> QtObject {
>>
>> readonly property color backgroundRed: "#FF2510"
>>
>> readonly property color backgroundWhite: "#F0F0F0"
>>
>> readonly property color backgroundPurple: "#930083"
>>
>> readonly property color fontRed: "#FF1010"
>>
>> readonly property color fontWhite: "#F6F6F6"
>>
>> }
>>
>>
>>
>> When I want to use one of the colors I write:
>>
>>
>>
>> color: Theme.backgroundRed
>>
>>
>>
>> I don't like this approach. What I would like to be able to write is this:
>>
>>
>>
>> color: Theme.background.red
>>
>>
>>
>> I have tried adding nested QtObjects inside Theme but I could not get it
>> working.
>>
>>
>>
>> QtObject {
>>
>> QtObject {
>>
>> id: *background*
>>
>> readonly property color red: "#FF2510"
>>
>> readonly property color white: "#F0F0F0"
>>
>> readonly property color purple: "#930083"
>>
>> }
>>
>>
>>
>> QtObject {
>>
>> id: *font*
>>
>> readonly property color red: "#FF1010"
>>
>> readonly property color white: "#F6F6F6"
>>
>> }
>>
>> }
>>
>>
>>
>> When I run it like this, I get an error: Theme.qml: Cannot assign to
>> non-existent default property.
>>
>> Is there a way to accomplish this? Is there any clean way to define and
>> categorize constants in QML?
>>
>> Thank you,
>> Viki
>>
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Clean way to define and categorize constants in QML

2016-04-29 Thread Viktória Nemkin
Thank you for your help. The syntax for creating a named object property is
what I needed.

Regards,
Viki

On 29 April 2016 at 13:12, Kristoffersen, Even (NO14) <
even.kristoffer...@honeywell.com> wrote:

> Those internal elements are not directly accessible.
>
> You can try exposing them with the use of *alias* in the root object.
>
>
>
>
>
> -Even
>
>
>
> *From:* Interest [mailto:interest-bounces+even.kristoffersen=
> honeywell@qt-project.org] *On Behalf Of *Viktória Nemkin
> *Sent:* 29. april 2016 13:04
> *To:* interest@qt-project.org
> *Subject:* [Interest] Clean way to define and categorize constants in QML
>
>
>
> Hello!
>
>
>
> What is a clean way to define and categorize constants in QML?
>
>
>
> I have came up with this so far:
>
>
>
> I have a QML singleton element, named Theme. There I keep a few constant
> things, like different background and font colors.
>
>
>
> Theme.qml:
>
> pragma Singleton
>
> import QtQuick 2.0
>
> QtObject {
>
> readonly property color backgroundRed: "#FF2510"
>
> readonly property color backgroundWhite: "#F0F0F0"
>
> readonly property color backgroundPurple: "#930083"
>
> readonly property color fontRed: "#FF1010"
>
> readonly property color fontWhite: "#F6F6F6"
>
> }
>
>
>
> When I want to use one of the colors I write:
>
>
>
> color: Theme.backgroundRed
>
>
>
> I don't like this approach. What I would like to be able to write is this:
>
>
>
> color: Theme.background.red
>
>
>
> I have tried adding nested QtObjects inside Theme but I could not get it
> working.
>
>
>
> QtObject {
>
> QtObject {
>
> id: *background*
>
> readonly property color red: "#FF2510"
>
> readonly property color white: "#F0F0F0"
>
> readonly property color purple: "#930083"
>
> }
>
>
>
> QtObject {
>
> id: *font*
>
> readonly property color red: "#FF1010"
>
> readonly property color white: "#F6F6F6"
>
> }
>
> }
>
>
>
> When I run it like this, I get an error: Theme.qml: Cannot assign to
> non-existent default property.
>
> Is there a way to accomplish this? Is there any clean way to define and
> categorize constants in QML?
>
> Thank you,
> Viki
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Nuno Santos
Ok Thiago, many thanks! 

> On 29 Apr 2016, at 17:35, Thiago Macieira  wrote:
> 
> On sexta-feira, 29 de abril de 2016 17:19:03 PDT Nuno Santos wrote:
>>> So I have to ask:
>>> a) are you sure your system wasn't already hard-float?
>> 
>> I don’t have a clue
>> 
>>> b) if it wasn't, are the hard-float libs for EVERYTHING available on the 
>>> 
>>>  system? And does the lib loader know how to find them?
>> 
>> I don’t have a clue
> 
> Then I recommend not pursuing this line of development until you find out 
> more.
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Thiago Macieira
On sexta-feira, 29 de abril de 2016 17:19:03 PDT Nuno Santos wrote:
> > So I have to ask:
> > a) are you sure your system wasn't already hard-float?
> 
> I don’t have a clue
> 
> > b) if it wasn't, are the hard-float libs for EVERYTHING available on the 
> >
> >   system? And does the lib loader know how to find them?
> 
> I don’t have a clue

Then I recommend not pursuing this line of development until you find out more.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Ola Røer Thorsen
2016-04-29 16:36 GMT+02:00 Jean-Michaël Celerier <
jeanmichael.celer...@gmail.com>:

>
> On Fri, Apr 29, 2016 at 1:55 PM, Ola Røer Thorsen 
> wrote:
>
>>
>> float a = 1.0f;
>> float b = 2.0*a; // BAD!
>> float b = 2.0f*a; // Good!
>>
>
> Pretty sure that this would be a non-problem starting at -O1 optimization
> level.
>

Well you're wrong. If you multiply with a double precision constant value
(2.0), the multiplication is done in double precision and the result is
then converted to single precision, regardless of the optimize level. This
makes a big difference on hardware that only support single-precision in
hardware (I know this from experience, not assumptions).
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Nuno Santos
Thiago,

> On 29 Apr 2016, at 17:12, Thiago Macieira  wrote:
> 
> So I have to ask:
> a) are you sure your system wasn't already hard-float?

I don’t have a clue

> b) if it wasn't, are the hard-float libs for EVERYTHING available on the 
>   system? And does the lib loader know how to find them?

I don’t have a clue

I was able to compile my code with the hard-float settings but it doesn’t seem 
to speed up. For the contrary. I think it is slowing down.

This is unknown territory for me and I don’t know what I am doing.

Nuno___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Thiago Macieira
On sexta-feira, 29 de abril de 2016 14:59:35 PDT Nuno Santos wrote:
> While Qt code may be compiled with support for hard float, the qmake.specs
> file for android doesn’t show that and, in general, it seems that hard
> float support is disabled by default in android:

Unless you're recompiling ALL of Android, you can't change the option. If you 
turn on hard float on a system that uses soft float parameter passing, all 
function calls that take or return floating point will fail in unpredictable 
ways.

So I have to ask:
a) are you sure your system wasn't already hard-float?
b) if it wasn't, are the hard-float libs for EVERYTHING available on the 
   system? And does the lib loader know how to find them?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Thiago Macieira
On sexta-feira, 29 de abril de 2016 13:55:05 PDT Ola Røer Thorsen wrote:
> As far as I know Qt is built with qreal as double as a default setting.

qreal is double.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Add another translation?

2016-04-29 Thread ekke
Am 26.04.16 um 22:24 schrieb Jason H:
> How I currently support English and Spanish, how do I add another language in 
> Qt Linguist? it seems that I need to re-run lupdate? I'd love to be able to 
> to it all by GUI, since I already have working TS files. I should be able to 
> use them as the template, change the language, then have it wipe the values 
> and save.
>
> File -> New - > Language from this file... [Enter language code].. Done.
>
> vs
> Drop to the command line, find the binary, invoke it with --help, review it, 
> prepare the command line, hoping I remembered the switches I used originally, 
> (like -tr-function-alias)  inspect the output that it looks reasonable. And 
> start working with that. 
>
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
Jason,
I just published blog article about Qt 5.7 translations for Android /
iOS apps where all can be done without the need of command line:
https://appbus.wordpress.com/2016/04/28/howto-translations-i18n/
hope it helps
ekke
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Jean-Michaël Celerier
On Fri, Apr 29, 2016 at 1:55 PM, Ola Røer Thorsen 
wrote:

>
> float a = 1.0f;
> float b = 2.0*a; // BAD!
> float b = 2.0f*a; // Good!
>

Pretty sure that this would be a non-problem starting at -O1 optimization
level.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Nuno Santos
Ola,

Thanks for your reply.

While Qt code may be compiled with support for hard float, the qmake.specs file 
for android doesn’t show that and, in general, it seems that hard float support 
is disabled by default in android:

QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp 
-ffunction-sections -funwind-tables -fstack-protector -fno-short-enums 
-DANDROID -Wa,--noexecstack -fno-builtin-memmove

I have found some questions/answer around the internet suggesting the following:

QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 
-mhard-float -ffunction-sections -funwind-tables -fstack-protector 
-fno-short-enums -DANDROID -D_NDK_MATH_NO_SOFTFP=1 -Wa,--noexecstack 
-fno-builtin-memmove

How can I have sure that it is in fact enabled?

Regards,

Nuno Santos
Founder / CEO / CTO
www.imaginando.pt
+351 91 621 69 62

> On 29 Apr 2016, at 12:55, Ola Røer Thorsen  wrote:
> 
> 2016-04-29 10:11 GMT+02:00 Nuno Santos  >:
> 
> Code compiled and ruined fine but couldn’t notice a faster performance (I 
> have profiling timers in critical parts of the application).
> 
> Has anyone done this before? 
> 
> 
> As far as I know Qt is built with qreal as double as a default setting. 
> 
> In case your cpu only does single precision floats in hardware:
> 
> Maybe try to build Qt with qreal as single precision floats?
> I think the Qt configure option is "-qreal float", please check to be sure. 
> 
> Makes a notable difference on my ancient arm omap3 processor, at least. 
> 
> Also I'd recommend using the gcc warnings
> -Wdouble-promotion
> -Wfloat-conversion
> and make sure you are just using single precision floats as much as possible. 
> Lots of performance is lost if you keep mixing single- and double precision. 
> 
> float a = 1.0f;
> float b = 2.0*a; // BAD!
> float b = 2.0f*a; // Good!
> 
> Make sure you are using single-precision math functions (use std::sin, 
> std::abs, not cmath sin, abs, etc). The warnings above will show you all 
> these cases. 
> 
> Cheers,
> Ola
> 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Static Qt 5.6.0 on Linux cannot find any fonts

2016-04-29 Thread Nikos Chantziaras

On 29/04/16 15:22, Nikos Chantziaras wrote:

A statically built Qt 5.6.0 results in this when trying to run any
application built with it:

QFontDatabase: Cannot find font directory
/home/realnc/opt/qt-5.6/lib/fonts - is Qt installed correctly?


Please ignore. I'm an idiot. I forgot to pass "-fontconfig" to the 
configure script...



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Static Qt 5.6.0 on Linux cannot find any fonts

2016-04-29 Thread Nikos Chantziaras
A statically built Qt 5.6.0 results in this when trying to run any 
application built with it:


QFontDatabase: Cannot find font directory 
/home/realnc/opt/qt-5.6/lib/fonts - is Qt installed correctly?


The application is completely lacking any text.

From what I was able to find, it seems I have to bundle fonts with the 
executable and set QT_QPA_FONTDIR to my bundled fonts directory? That 
just doesn't sound right. The end user should be able to use the system 
fonts.


How do I make that happen?

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Ola Røer Thorsen
2016-04-29 10:11 GMT+02:00 Nuno Santos :

>
> Code compiled and ruined fine but couldn’t notice a faster performance (I
> have profiling timers in critical parts of the application).
>
> Has anyone done this before?
>
>
As far as I know Qt is built with qreal as double as a default setting.

In case your cpu only does single precision floats in hardware:

Maybe try to build Qt with qreal as single precision floats?
I think the Qt configure option is "-qreal float", please check to be sure.

Makes a notable difference on my ancient arm omap3 processor, at least.

Also I'd recommend using the gcc warnings
-Wdouble-promotion
-Wfloat-conversion
and make sure you are just using single precision floats as much as
possible. Lots of performance is lost if you keep mixing single- and double
precision.

float a = 1.0f;
float b = 2.0*a; // BAD!
float b = 2.0f*a; // Good!

Make sure you are using single-precision math functions (use std::sin,
std::abs, not cmath sin, abs, etc). The warnings above will show you all
these cases.

Cheers,
Ola
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Clean way to define and categorize constants in QML

2016-04-29 Thread Kristoffersen, Even (NO14)
Those internal elements are not directly accessible.
You can try exposing them with the use of alias in the root object.


-Even

From: Interest 
[mailto:interest-bounces+even.kristoffersen=honeywell@qt-project.org] On 
Behalf Of Viktória Nemkin
Sent: 29. april 2016 13:04
To: interest@qt-project.org
Subject: [Interest] Clean way to define and categorize constants in QML

Hello!

What is a clean way to define and categorize constants in QML?

I have came up with this so far:

I have a QML singleton element, named Theme. There I keep a few constant 
things, like different background and font colors.

Theme.qml:

pragma Singleton

import QtQuick 2.0

QtObject {

readonly property color backgroundRed: "#FF2510"

readonly property color backgroundWhite: "#F0F0F0"

readonly property color backgroundPurple: "#930083"

readonly property color fontRed: "#FF1010"

readonly property color fontWhite: "#F6F6F6"

}


When I want to use one of the colors I write:



color: Theme.backgroundRed


I don't like this approach. What I would like to be able to write is this:



color: Theme.background.red


I have tried adding nested QtObjects inside Theme but I could not get it 
working.



QtObject {

QtObject {

id: background

readonly property color red: "#FF2510"

readonly property color white: "#F0F0F0"

readonly property color purple: "#930083"

}



QtObject {

id: font

readonly property color red: "#FF1010"

readonly property color white: "#F6F6F6"

}

}


When I run it like this, I get an error: Theme.qml: Cannot assign to 
non-existent default property.

Is there a way to accomplish this? Is there any clean way to define and 
categorize constants in QML?

Thank you,
Viki
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Clean way to define and categorize constants in QML

2016-04-29 Thread Dmitry Volosnykh
Using such approach you have to write something like readonly property
QtObject backgroundColor: QtObject { ...

On Fri, Apr 29, 2016 at 2:04 PM Viktória Nemkin 
wrote:

> Hello!
>
> What is a clean way to define and categorize constants in QML?
>
> I have came up with this so far:
>
> I have a QML singleton element, named Theme. There I keep a few constant
> things, like different background and font colors.
>
> Theme.qml:
>
> pragma Singleton
>
> import QtQuick 2.0
>
> QtObject {
>
> readonly property color backgroundRed: "#FF2510"
>
> readonly property color backgroundWhite: "#F0F0F0"
>
> readonly property color backgroundPurple: "#930083"
>
> readonly property color fontRed: "#FF1010"
>
> readonly property color fontWhite: "#F6F6F6"
>
> }
>
>
> When I want to use one of the colors I write:
>
>
> color: Theme.backgroundRed
>
>
> I don't like this approach. What I would like to be able to write is this:
>
>
> color: Theme.background.red
>
>
> I have tried adding nested QtObjects inside Theme but I could not get it
> working.
>
>
> QtObject {
>
> QtObject {
>
> id: background
>
> readonly property color red: "#FF2510"
>
> readonly property color white: "#F0F0F0"
>
> readonly property color purple: "#930083"
>
> }
>
>
> QtObject {
>
> id: font
>
> readonly property color red: "#FF1010"
>
> readonly property color white: "#F6F6F6"
>
> }
>
> }
>
>
> When I run it like this, I get an error: Theme.qml: Cannot assign to
> non-existent default property.
>
> Is there a way to accomplish this? Is there any clean way to define and
> categorize constants in QML?
>
> Thank you,
> Viki
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Clean way to define and categorize constants in QML

2016-04-29 Thread Viktória Nemkin
Hello!

What is a clean way to define and categorize constants in QML?

I have came up with this so far:

I have a QML singleton element, named Theme. There I keep a few constant
things, like different background and font colors.

Theme.qml:

pragma Singleton

import QtQuick 2.0

QtObject {

readonly property color backgroundRed: "#FF2510"

readonly property color backgroundWhite: "#F0F0F0"

readonly property color backgroundPurple: "#930083"

readonly property color fontRed: "#FF1010"

readonly property color fontWhite: "#F6F6F6"

}


When I want to use one of the colors I write:


color: Theme.backgroundRed


I don't like this approach. What I would like to be able to write is this:


color: Theme.background.red


I have tried adding nested QtObjects inside Theme but I could not get it
working.


QtObject {

QtObject {

id: background

readonly property color red: "#FF2510"

readonly property color white: "#F0F0F0"

readonly property color purple: "#930083"

}


QtObject {

id: font

readonly property color red: "#FF1010"

readonly property color white: "#F6F6F6"

}

}


When I run it like this, I get an error: Theme.qml: Cannot assign to
non-existent default property.

Is there a way to accomplish this? Is there any clean way to define and
categorize constants in QML?

Thank you,
Viki
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] armv7a-hard-float in Qt android apps

2016-04-29 Thread Nuno Santos
Hi,

I’m trying to enable hard float computation on arm.

I think I have managed to enable it doing the following changes:

1) Set a new environment var ANDROID_ARCH_TARGET=armeabi-v7a-hard
2) Adding 

equals(ANDROID_TARGET_ARCH, armeabi-v7a-hard): \
QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 
-mhard-float -ffunction-sections -funwind-tables -fstack-protector 
-fno-short-enums -DANDROID -D_NDK_MATH_NO_SOFTFP=1 -Wa,--noexecstack 
-fno-builtin-memmove

3) QMAKE_LFLAGS= --sysroot=$$ANDROID_PLATFORM_ROOT_PATH 
-Wl,--no-warn-mismatch -lm_hard
4) QMAKE_LIBS_PRIVATE  = -lgnustl_shared -llog -lz -lm_hard -ldl -lc -lgcc

Code compiled and ruined fine but couldn’t notice a faster performance (I have 
profiling timers in critical parts of the application).

Has anyone done this before? 

Regards,

Nuno___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Few questions regarding Qt Quick Scene Graph

2016-04-29 Thread Artem Fedoskin
After evaluating the amount of xChanged(), yChanged() and visibleChanged()
signals I decided to stick with the approach where I create QQuickItems
from C++ with overriden updatePaintNode()  instead of direct instantiation
of QSGNodes. Thank you for your help! It was tremendous useful and now I
understand the internals of Scene Graph a little better.

Regards, Artem

2016-04-28 11:27 GMT+02:00 Gunnar Sletta :

>
> > On 27 Apr 2016, at 22:47, Artem Fedoskin  wrote:
> >
> > 1. I have experimented a little with the Scene Graph and got following
> results:
> >   • Rectangles with the same color were batched
> >   • Differently colored rectangles weren't batched
>
> Yeah, this is explained by the fact that QSGSimpleRectNode is implemented
> using the QSGFlatColorMaterial which passes the color via a uniform and
> will as a result have unique state per object. Prefer to use a
> QSGGeometryNode + QSGVertexColorMaterial instead as that allows you to use
> the same material state across all instances. You can even use the same
> material and save a tiny bit of memory in the process if that fits with
> your design.
>
> >   • Textures were batched if the QQuickWindow::TextureCanUseAtlas
> flag was set but only if QSG_ATLAS_WIDTH and QSG_ATLAS_HEIGHT were big
> enough.
>
> Sure, as is to be expected.
>
> > 2. I also found one of your E-mails here
> http://lists.qt-project.org/pipermail/interest/2014-January/010674.html
> where you suggested to use GL_MAX_TEXTURE_SIZE for setting atlas width and
> height, however, it didn't work when I set it as a value for environmental
> variable QSG_ATLAS_WIDTH and QSG_ATLAS_HEIGHT.
>
> Verify the atlas size using QSG_INFO=1 in the environment. Setting the
> environment variables does work, but we don't stuff textures into the atlas
> which will take up a huge percentage of it.
>
> > 3. If I'm going to create say 100 000 objects and change X and Y
> coordinates with setX() setY() funcitions and at the same time set some
> objects to invisible state with setVisible(), can signals emitted from
> calling this setters cause significant drop in performance if I'm not
> connecting any slots on my side?
>
> I would not use signals/slots for 100.000 lively changing objects.
>
> > 4. How setX() and setY() changes the position of the QQuickItem? I
> didn't noticed any calls to updatePaintNode() and is it better to set
> coordinates this way then directly changing coordinates of graphic nodes in
> updatePaintNode() and constantly call update()?
> >
>
> The geometry is changed, which triggers the transform node for that item
> to be changed. As the x/y does not change the contents, the paint node does
> not need to be updated and updatePaintNode() is not called.
>
> > Sorry for so much questions, but my project has to display and process a
> lot of items on the screen and it has to work good on mobile platforms.
>
> QML and SG apis are all well and nice, but did you consider doing parts of
> this visualization in raw OpenGL? Using for instance
> QQuickWindow::afterRendering() and doing a GL pass on top of the output
> frame allows you to batch and manage the GL resources explicitly. (Or
> beforeRendering and putting the UI on top as a HUD) The scene graph does a
> fairly good job at batching and will outperform trivial GL code in most
> cases, but for any given scenario, dedicated code will most likely
> outperform it.
>
> >
> > Thank you very much for all your advices and suggestions.
> >
> > Regards,
> >
> > Artem Fedoskin
> >
> >
> > 2016-04-26 9:19 GMT+02:00 Gunnar Sletta :
> >
> > > On 25 Apr 2016, at 19:46, Artem Fedoskin  wrote:
> > >
> > > Thank you for your reply Gunnar,
> > >
> > > Can you please tell me - can I store a pointer to the object of
> external class (even not a QQuickItem derived one) in QSGNode derived
> class? Each object of the class Data is associated with corresponding
> Triangle in View. Whenever View is updated, it checks in loop Data objects
> on special condition and based on that sets the corresponding Triangle to
> visible or invisible state. If Triangle is visible, Triangle itself calls a
> bunch of functions from external classes and uses pointer on object Data to
> retrieve Data's info about coordinates then accesses function from another
> class to convert the received coordinates to x,y positions.
> > >
> > > I understand that it is not safe to access QSGNode not from
> updatePaintNode(), but is it actually safe to access other classes from
> QSGNode itself? How far can I go in QSGNode in accessing things in GUI
> thread?
> >
> > Normal threading considerations apply. You can reference anything to
> your liking from objects that live on the render thread, there is nothing
> special about it. We just strongly encourage to not cross reference between
> GUI and render threads because the two run independently and objects can
> come and go on both.
> >
> > >
> > >