Re: [Development] QUrl setPath Qt4 vs Qt5

2014-09-28 Thread Samuel Gaist

 On 28 sept. 2014, at 03:26, Thiago Macieira thiago.macie...@intel.com wrote:
 
 On Sunday 28 September 2014 01:02:11 Samuel Gaist wrote:
 Hi,
 
 Following a post on the forum, I've checked and there's been a behavior
 change in QUrl's setPath between Qt 4 and Qt 5 that is not mentioned in the
 C++ API changes chapter.
 
 If I understood correctly:
 
 QUrl example1(http://www.example.com;);
 example1.setPath(pub/something);
 
 makes example1 invalid in Qt 5 due to the fact that pub/something is a
 relative path (following QUrl documentation and test) but in Qt 4 the
 result is http://www.example.com/pub/something;.
 
 Should it be considered bug in Qt 4 that needs fixing ? However fixing it
 might break existing application that could be relying on that behavior. In
 this case, simply add the API break in Qt 5's documentation ?
 
 Yes, it's a bug in Qt 4, bug I won't fix it because it's not that important 
 and 
 would require a major change.
 
 QUrl in Qt 4 has quite a few known issues with encoding and decoding of 
 delimiters too. And its QString constructor is a completely flawed design and 
 should never be used.
 
 QUrl changed considerably in Qt 5 to comply better with the URL 
 specifications 
 and with brokenness out there. If we add anything to the documentation, it 
 would be the previous sentence, with no extra details.

I remember now following a discussion about that matter some time ago.

Fine for me. I'll update the API change doc to include that so future users 
won't be surprised.

Samuel
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] Copying QJSValue arrays

2014-09-28 Thread Paul Lemire




Hi guys,




We're working on being able to set GLSL uniform arrays from QML.

Basically what we have is a QParameter QObject exposed to QML as Parameter.




It contains a QString name property and a QVariant value property.




Here's how it can be used for scalar types.




Parameter { name : uniformName; value : 1.0; } 




What we want is to send a copy of value to our backend renderer, so that we 
won't have any problem with threading. For scalar types, the copy is done 
implicitly.




For array types, we'd like to be able to do something like that:




property var myArray : [1.0, 1.0, 1.0]

Parameter { name : uniformArray; value : myArray }




However in that case, value is a QJSValue containing a JS Array object.

We need a way to be able to copy that object.

The tricky part there is that we can't check the QVariant to to see if it 
contains a QJSValue directly as we don't want to introduce a dependency to the 
QML module.




We're thinking of maybe introducing a Qt.array helper function that would 
return us a copy of the array directly or retrieve a QVectorQVariant.




If you've got ideas around that issue, please step in.



Thanks,



Paul Lemire









  ___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development