[Development] [QML] Need advice on frontend architecture

2015-11-18 Thread Ronan Jouchet

Hi.

I recently joined a nascent QML project with the objective to bring it 
from the "working prototype" stage to something maintainable and efficient.


Previously, my last GUI work was on a web application using React [1] + 
Flux [2], which I *loved* for the mental simplicity and testability 
their functional model brings (i.e: update the state, be confident that 
{1. the view is updated, 2. with good performance regardless of the 
state mutation complexity / number of bindings}).


Now, back to QML, looking at the documentation, examples, and a few blog 
posts,


- I find a good overview of QML language constructs

- ... as well as tons of simple, mostly stateless widget examples

, but:

- I have yet to encounter frontend architecture recommendations (like Flux)

- I often stumble on QML constructs that push me into 
one-component-directly-mutating-another corners. Drinking the React 
kool-aid made me very wary of those, and I'd now actively avoiding them 
because they can quickly lead to spaghetti. For example, QML states [3], 
and direct mutations using `parent`, `root`, or accessing by id.


So, as you can expect, I'm trying to bring a Flux-ish approach to our 
QML app, by creating central data stores encapsulating {a. my 
application state as pure data, b. functions to manipulate the state}, 
and making my QML components depend on this pure data.


But so far it feels like I'm swimming against the tide, plus:

- I have little idea how performance will evolve down the road.

- Contrarily to the web application mentioned in the introduction, I 
also have to mix my JS state with C++ classes instantiated in my QML, 
also bringing their own state, which I use too in QML.


- My store-observing logic implies regularly using `onXyzChanged` signal 
handlers (e.g. to re-generate a ListModel when the source Array 
changes), which means bring Data Store attribute `xyz` to the local QML 
component scope, which isn't feasible with a current-scope-limited 
aliases [4], so I'm using ordinary property references (property var 
cheeses: dataStoreInventory.cheeses;), which "allocates a new, unique 
storage space for the property", effectively doubling the memory usage 
of my state, with unknown memory leaking behavior.


- I'm reading lots of very affirmative, but sometimes old, and often 
poorly researched articles encouraging QML developers to avoid JS and do 
all the logic in C++, save for basic widget arithmetic. As a web 
developer, the productivity benefits of JS are obvious to me (plus the 
library availability, *when* libraries are content with the exotic JS 
environment provided by QML, but that's another question), but these 
claims are starting to make me wary of too much JS in my QML app. Or 
maybe these cautionary tales are just instances of good tools badly used 
yielding bad results? Anyway I'm wondering how much JS is reasonable in 
a long-running QML app with serious performance expectations 
(calculations and heavy 2d/3d in C++, QML gui)


As you can guess, I'm lost in all this. Do you have battlefield-tested 
advice/links to structure QML apps? Thanks for your help.


[1] https://facebook.github.io/react/
[2] https://facebook.github.io/flux/
[3] http://doc.qt.io/qt-5/qtquick-statesanimations-states.html
[4] 
http://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#property-aliases


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


Re: [Development] [QML] Need advice on frontend architecture

2015-11-18 Thread Florian Bruhin
Hey,

* Ronan Jouchet  [2015-11-18 10:46:06 -0500]:
> I recently joined a nascent QML project with the objective to bring it from
> the "working prototype" stage to something maintainable and efficient.
> 
> [...]

This list is for development *of* Qt itself, not *with* it. You
probably want to post this to the Interest mailinglist instead:

http://lists.qt-project.org/mailman/listinfo/interest

Florian

-- 
http://www.the-compiler.org | m...@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
 I love long mails! | http://email.is-not-s.ms/


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


[Development] FreeBSD 10 and up, No gcc and solution

2015-11-18 Thread Daniel Dettlaff
Hello, I’m heavy Qt user under FreeBSD on my servers (no gui stuff).

Here’s a definition for qt5 in my software (skip the software, it doesn’t 
matter): 
https://bitbucket.org/verknowsys/sofin-definitions/src/e57660d476d3725dc7aaa8a637be59da59349b22/definitions/qtbase55.def?at=stable=file-view-default

I created a spec for freebsd-clang based on freebsd-g++46.
It’s described/ scripted how I did create freebsd-clang spec for fBSD 10 and 11 
(tested with a lot of modules, and external Qt software since FreeBSD 10.0)
Standard specs bundled by default are - freebsd-g++, freebsd-g++46 and 
freebsd-icc - which simply wont work anymore for newer FreeBSD OS releases 
(without gcc).

My question is could you please provide such spec by default to be shipped with 
Qt itself? My solution is a hack obviously.

--
kind regards
Daniel (dmilith) Dettlaff




signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] FreeBSD 10 and up, No gcc and solution

2015-11-18 Thread Daniel Dettlaff
> I created a spec for freebsd-clang based on freebsd-g++46.
> It’s described/ scripted how I did create freebsd-clang spec for fBSD 10 and 
> 11 (tested with a lot of modules, and external Qt software since FreeBSD 10.0)
> Standard specs bundled by default are - freebsd-g++, freebsd-g++46 and 
> freebsd-icc - which simply wont work anymore for newer FreeBSD OS releases 
> (without gcc).

It’s also worth mentioning:

```
${SED_BIN} -i '' -e 's/-pthread/-pthread -lutil -lexecinfo/g’ qmake.conf
```

this part is necessary only under FreeBSD 10.x

Under 11.x it causes clang warnings (non fatal though so I left it this way).

--
kind regards
Daniel (dmilith) Dettlaff


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] FreeBSD 10 and up, No gcc and solution

2015-11-18 Thread Ralf Nolden
Am Mittwoch, 18. November 2015, 13:01:26 schrieb Daniel Dettlaff:

Hi Daniel,

you can simply use ./configure -platform unsupported/freebsd-clang

I've provided some patches for Qt on FreeBSD on the kde-freebsd mailinglist to 
move the libs to /usr/local/lib/qt5 which are still not in the freebsd ports 
yet. Those allow using portupgrade and building a custom Qt with a 
ports/packages installed Qt without build errors. You may want to have a look 
at those too.



> Hello, I’m heavy Qt user under FreeBSD on my servers (no gui stuff).
> 
> Here’s a definition for qt5 in my software (skip the software, it doesn’t
> matter):
> https://bitbucket.org/verknowsys/sofin-definitions/src/e57660d476d3725dc7aa
> a8a637be59da59349b22/definitions/qtbase55.def?at=stable=file-view
> -default
> 
> I created a spec for freebsd-clang based on freebsd-g++46.
> It’s described/ scripted how I did create freebsd-clang spec for fBSD 10 and
> 11 (tested with a lot of modules, and external Qt software since FreeBSD
> 10.0) Standard specs bundled by default are - freebsd-g++, freebsd-g++46
> and freebsd-icc - which simply wont work anymore for newer FreeBSD OS
> releases (without gcc).
> 
> My question is could you please provide such spec by default to be shipped
> with Qt itself? My solution is a hack obviously.
> 
> --
> kind regards
> Daniel (dmilith) Dettlaff

-- 
Kind regards,

Ralf Nolden

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


Re: [Development] FreeBSD 10 and up, No gcc and solution

2015-11-18 Thread Giuseppe D'Angelo
On Wed, Nov 18, 2015 at 1:30 PM, Daniel Dettlaff  wrote:
> Under 11.x it causes clang warnings (non fatal though so I left it this way).

Maybe you can contribute your improvements to the mkspecs?
http://wiki.qt.io/Category:Developing_Qt

Cheers,

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


[Development] New Qt 5.6 Beta snapshot available

2015-11-18 Thread Heikkinen Jani
Hi all,


New snapshot available for your testing:


Windows: http://download.qt.io/snapshots/qt/5.6/5.6.0-beta/268/

Linux: http://download.qt.io/snapshots/qt/5.6/5.6.0-beta/280/

Mac: http://download.qt.io/snapshots/qt/5.6/5.6.0-beta/213/

Src: http://download.qt.io/snapshots/qt/5.6/5.6.0-beta/latest_src/


These packages aren't yet final beta packages but we are closing so it is 
important to get these packages tested. Please test the packages & inform me 
immediately about new blockers found.


Known issues:

- WinRT x86 msvc2015 binaries still missing form winrt_msvc2015 package, 
binaries should be coming with next qt5.git integration

- Tech preview modules missing from src package, fix should be in next packages

- Open issues in blocker list (https://bugreports.qt.io/browse/QTBUG-47958):

* QTBUG-49197 WinRT: MSVC2015 
installer does not contain arm build

** Verification needed, should be fixed in packages

* QTBUG-49226 Unsatisfied 
dependencies to system libraries

** Verification needed, should be fixed in packages

* QTBUG-49367 
QtAndroidBluetooth-bundled.jar missing from 5.6 beta Mac installer

** Fix ongoing

* QTBUG-48914 Qt5.6 offline: 
plugins/mediaservice/ libs missing

** Fix under review

* QTBUG-49366 [Reg 5.5->5.6]: 
Cannot compile apps with sql for iOS

** Fix available

* QTBUG-49368 Windows Phone 
Emulator (x86) Qt version missing from installer

 ** Verification needed, should be fixed in packages

* QTBUG-48927 Regression: Qt 
Quick Controls applications containing a MenuBar with at least one Menu item 
crash

** Fix available & waiting for qt5.git integ.

* QTBUG-49211 [REG 5.5->5.6] 
Cannot find documentation specification file:

** Verification needed, should be fixed in packages

* QTBUG-49369 Several Qt tools 
fail to find QtCore:

** Fix available & waiting for qt5.git integration

* QTBUG-48915 Qt5.6 offline: 
Enginio missing from android targets:

** Fix in, should be ok in next packages

* QTBUG-49471 Bluetooth on 
Linux not working due to build issue

** Fix ongoing

* QTBUG-45662 Add 
qtbase/bin/fixqt4headers.pl to packages:

** Verification needed, should be fixed in packages

* QTBUG-49454 Qt 5.6 offline: 
msvc2013 #254 Installer fails on missing dependency

** Verification needed, should be fixed in packages

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


Re: [Development] [Qt-5.6] leak of QtSharedPointer::ExternalRefCountData objects

2015-11-18 Thread Liang Jian
I have submited a patch to fix this issue:
https://codereview.qt-project.org/#/c/141311/

On Mon, Nov 16, 2015 at 11:01 PM, Liang Jian  wrote:

> The allocated QV4::QObjectWrapper object hold a QPointer which track
> 'instance', it seems that it should be destroyed with 
> QObjectWrapper::destroyObject()
> to properly destruct the QPointer in it in QV4::MemoryManager::sweep().
> But when sweep() is being called it couldn't find the QObjectWrapper
> object created before which will make the QPointer in it not destructed
> properly.
>
> On Sun, Nov 15, 2015 at 11:58 PM, Liang Jian 
> wrote:
>
>> After some further investigation I can now confirm that one of the
>> leak is caused by the following code in QQmlObjectCreator::createInstance(),
>> qqmlobjectcreator.cpp:
>>
>> *sharedState->allJavaScriptObjects = QV4::QObjectWrapper::wrap(v4,
>> instance);
>>
>>   ++sharedState->allJavaScriptObjects;
>>
>>
>> But the reason is still unknown
>>
>>
>>
>> On Sun, Nov 15, 2015 at 10:19 PM, Liang Jian 
>> wrote:
>>
>>>   Hello everyone, I checkout qt 5.6 branch yesterday in my windows
>>> 10 x64 machine, I build it and run my program and see many leaks. Then I
>>> use C++ Memory Validator to find the source of the leaks, I can now
>>> confirm the leaked objects are QtSharedPointer::ExternalRefCountData which
>>> are created in QQmlObjectCreator::createInstance(), qqmlobjectcreator.cpp
>>> Line 1049, below is the call stack printed by C++ Memory Validator:
>>>
>>>Qt5Cored.dll  QtSharedPointer::ExternalRefCountData::getAndRef :
>>> [d:\qt5\qtbase\src\corelib\tools\qsharedpointer.cpp Line 1337]
>>>
>>>Qt5Qmld.dll  QWeakPointer::QWeakPointer :
>>> [d:\qt5\qtbase\src\corelib\tools\qsharedpointer_impl.h Line 706]
>>>
>>>Qt5Qmld.dll  QPointer::QPointer :
>>> [d:\qt5\qtbase\src\corelib\kernel\qpointer.h Line 65]
>>>
>>>Qt5Qmld.dll  QQmlObjectCreator::createInstance :
>>> [d:\qt5\qtdeclarative\src\qml\qml\qqmlobjectcreator.cpp Line 1049]
>>> 1044 : QQmlData *ddata = QQmlData::get(instance,
>>> /*create*/true);
>>> 1045 : ddata->rootObjectInCreation = true;
>>> 1046 :
>>> sharedState->rootContext->isRootObjectInCreation = false;
>>> 1047 : }
>>> 1048 :
>>> 1049 : sharedState->allCreatedObjects.push(instance);
>>> 1050 : } else {
>>> 1051 : Q_ASSERT(typeRef->component);
>>> 1052 : Q_QML_OC_PROFILE(sharedState->profiler,
>>> profiler.update(typeRef->component->fileName(),
>>> 1053 : context->url(), obj->location.line,
>>> obj->location.column));
>>> 1054 : if
>>> (typeRef->component->compilationUnit->data->isSingleton())
>>>Qt5Qmld.dll  QQmlObjectCreator::create :
>>> [d:\qt5\qtdeclarative\src\qml\qml\qqmlobjectcreator.cpp Line 197]
>>>
>>>Qt5Qmld.dll  QQmlComponentPrivate::beginCreate :
>>> [d:\qt5\qtdeclarative\src\qml\qml\qqmlcomponent.cpp Line 863]
>>>
>>>Qt5Qmld.dll  QQmlComponent::beginCreate :
>>> [d:\qt5\qtdeclarative\src\qml\qml\qqmlcomponent.cpp Line 812]
>>>
>>>Qt5Qmld.dll  QQmlComponent::create :
>>> [d:\qt5\qtdeclarative\src\qml\qml\qqmlcomponent.cpp Line 772]
>>>
>>>Qt5Quickd.dll  QQuickView::continueExecute :
>>> [d:\qt5\qtdeclarative\src\quick\items\qquickview.cpp Line 486]
>>>
>>>Qt5Quickd.dll  QQuickViewPrivate::execute :
>>> [d:\qt5\qtdeclarative\src\quick\items\qquickview.cpp Line 127]
>>>
>>>Qt5Quickd.dll  QQuickView::setSource :
>>> [d:\qt5\qtdeclarative\src\quick\items\qquickview.cpp Line 256]
>>>
>>>
>>> All the leaked QtSharedPointer::ExternalRefCountData objects are
>>> allocated in the line
>>> sharedState->allCreatedObjects.push(instance);
>>> then some other code path will also use QPointer (contained in some
>>> structures allocated by v4mm) to track the same object 'instance' and I
>>> guess the QPointer wasn't properly destructed which will cause the 
>>> QtSharedPointer::ExternalRefCountData
>>> not deleted.
>>> I have investigated this issue for nearly one day, but I can't find
>>> which code cause the leak, this is a non-trivial leak, I hope somebody can
>>> help to find the source of the leak. thanks!
>>>
>>>
>>
>
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development