Re: [Interest] QML Loader sourceComponent Dynamic selection (not source property)
Hi, Not sure if this is what you want but recently I have implemented a dynamic delegate usage by using the Component class. DeviceParameterView had three types: button, option, slider. I want to render a different delegate depending on the type of the parameter model. This was the solution I have implemented since instantiating the three different delegates inside the delegate was killing list performance. This approach will asynchronously load the specified component. import QtQuick 2.2 Item { id: root clip: true property var parameter property Component component property DeviceParameterButton button property DeviceParameterOption option property DeviceParameterSlider slider Component.onDestruction: { if (button!=null) button.destroy() if (option!=null) option.destroy() if (slider!=null) slider.destroy() } onParameterChanged: { switch (parameter.type) { case 0: component = Qt.createComponent(DeviceParameterButton.qml); var incubator = component.incubateObject(root, {height: 20, parameter: parameter}); if (incubator.status != Component.Ready) { incubator.onStatusChanged = function(status) { if (status == Component.Ready) { button = incubator.object root.width = button.width } } } break; ... } } } On 17 Nov 2014, at 03:18, mark diener rpzrpz...@gmail.com wrote: Even: A couple months back you gave an intelligent answer from a interest list query about creating complex list views. I was a little tied up with things and could not get around to actually create a working example of a complex list view. Now is that time. Maybe you could get me past some implementation uncertainties Attached below is a copy of the original message. I am having trouble defining a loader that does not need a separate QML file for its definition, but a javascript function that is away of which row index of the model it is currently drawing and can pass that to a javacript function that will return a Component value directly instead of a reference to an QML file. I have included a small snippet QML file below: ListModel { id: glistdata { type: 1 name : Joe Perra cell: 555-1212 eyes: blue mood: sad } ListElement { type: 2 name : Mary Tyler cell: 555-1213 eyes: brown mood: happy } ListElement { type: 3 name : Peter Gabriel cell: 555-1214 eyes: blue mood: bitter } } Component { id: gflavorone Item { Text { text: 'Name:' + name } Text { text: 'Mood:' + mood } } Component { id: gflavortwo Item { Text { text: 'Name:' + name } Text { text: 'Eyes:' + eyes } } Component { id: gflavorthree Item { Text { text: 'Name:' + name } Text { text: 'cell:' + cell } } Loader { id: gloader function getComp(gidx) { switch (gidx) { case 1: return gflavorone case 2: return gflavortwo } //Default case return gflavorthree } } sourceComponent: getComp(index) } ListView { id: glistview anchors.margins: 0 anchors.fill: parent delegate: gloader model: glistdata } Maybe you or anybody else has some ideas on how to specifically code the Loader written to a dynamic Component instead of referring to an external QML file to generate the Component value. And on top of that, how does the loader getComp( ) function access the index of the row or maybe it must just only refer to the model fields So yes, I would like the Loader to intelligently select the sourceComponent using a dynamic function attached to the loader. This is an area that needs maybe a long experience QT veteran to comment on this. Cheers, md Subject: [Interest] Qt Quick 2.x Complex ListView Hello QTers: Does anybody have an idea on how to create each row of the listview with a delegate that allows for each row to be rendered with separate logic instead of the standard delegate which renders each row with the same or very similar logic. Any comments or tips would be useful and I am sure more people would like this option Not sure if it covers what you need, but I believe the common way to solve this is through using a Loader element as the delegate and changing the source depending on your criteria for which row delegate to use
Re: [Interest] Slackware binary package of Qt5
Thank you. I suggest to add checksum files. md5sum 906eaddf087a19ce294b529aab69a331 qt5-5.3.2-i486-1_SBo.tgz sha1sum 894d3210262c987c03bcb389e6de6ae0057f7eb9 qt5-5.3.2-i486-1_SBo.tgz On Sun, 16 Nov 2014 17:20:44 -0400 Rodrigo Gonçalves de Oliveira rodrigo.gol...@gmail.com wrote: I've built Qt 5.3.1 for Slack-current x86_64 [1] and 5.3.2 for Slack-current x86 [2] sometime ago, based on its SlackBuild [3] These builds are for my personal use, but you can try them (slack-current) Alien Bob also have some builds on his KDE5 testing repo, take a look here (x86_64) [4] or here (x86) [5] See ya, and good luck! [1] http://thecoreme.org/slack/pkgs/x86_64/qt/ [2] http://thecoreme.org/slack/pkgs/x86/qt/ [3] http://slackbuilds.org/repository/14.1/libraries/qt5/ [4] http://taper.alienbase.nl/mirrors/alien-kde/current/testing/x86_64/deps/ [5] http://taper.alienbase.nl/mirrors/alien-kde/current/testing/x86/deps/ On Fri, Nov 14, 2014 at 5:23 PM, Genghis Khan genghisk...@gmx.ca wrote: Hello, I was wondering if anyone on this list knows of a trusted source where one can achieve Slackware binary package of Qt5. Alternatively, provide me with a solution for overcoming the following error during compilation (see file attached). sed: can't read /tmp/SBo/package-qt5/usr/lib/pkgconfig/Qt5WebKit.pc: No such file or directory With regards, --GK ___ 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] QML Loader sourceComponent Dynamic selection
Nuno: Thanks for this info. I had not gotten a running example yet to determine performance, but I figured if I could reduce that substantially if I embedded the dynamic components inside the QML file that contained the Loader. In your sample, you gave: component = Qt.createComponent(DeviceParameterButton.qml); (In an offline email, maybe you could send along a sample of the DeviceParameterButton.qml file) I was looking to use Loader::sourceComponent : Loader { INLINE COMPONENTS }. Not Loader::source : Loader { QML FILE }. Anybody with ideas? Cheers, Marco On 11/17/2014 4:32 AM, Nuno Santos wrote: Hi, Not sure if this is what you want but recently I have implemented a dynamic delegate usage by using the Component class. DeviceParameterView had three types: button, option, slider. I want to render a different delegate depending on the type of the parameter model. This was the solution I have implemented since instantiating the three different delegates inside the delegate was killing list performance. This approach will asynchronously load the specified component. import QtQuick 2.2 Item { id: root clip: true property var parameter property Component component property DeviceParameterButton button property DeviceParameterOption option property DeviceParameterSlider slider Component.onDestruction: { if (button!=null) button.destroy() if (option!=null) option.destroy() if (slider!=null) slider.destroy() } onParameterChanged: { switch (parameter.type) { case 0: component = Qt.createComponent(DeviceParameterButton.qml); var incubator = component.incubateObject(root, {height: 20, parameter: parameter}); if (incubator.status != Component.Ready) { incubator.onStatusChanged = function(status) { if (status == Component.Ready) { button = incubator.object root.width = button.width } } } break; ... } } } On 17 Nov 2014, at 03:18, mark diener rpzrpz...@gmail.com mailto:rpzrpz...@gmail.com wrote: Even: A couple months back you gave an intelligent answer from a interest list query about creating complex list views. I was a little tied up with things and could not get around to actually create a working example of a complex list view. Now is that time. Maybe you could get me past some implementation uncertainties Attached below is a copy of the original message. I am having trouble defining a loader that does not need a separate QML file for its definition, but a javascript function that is away of which row index of the model it is currently drawing and can pass that to a javacript function that will return a Component value directly instead of a reference to an QML file. I have included a small snippet QML file below: ListModel { id: glistdata { type: 1 name : Joe Perra cell: 555-1212 eyes: blue mood: sad } ListElement { type: 2 name : Mary Tyler cell: 555-1213 eyes: brown mood: happy } ListElement { type: 3 name : Peter Gabriel cell: 555-1214 eyes: blue mood: bitter } } Component { id: gflavorone Item { Text { text: 'Name:' + name } Text { text: 'Mood:' + mood } } Component { id: gflavortwo Item { Text { text: 'Name:' + name } Text { text: 'Eyes:' + eyes } } Component { id: gflavorthree Item { Text { text: 'Name:' + name } Text { text: 'cell:' + cell } } Loader { id: gloader function getComp(gidx) { switch (gidx) { case 1: return gflavorone case 2: return gflavortwo } //Default case return gflavorthree } } sourceComponent: getComp(index) } ListView { id: glistview anchors.margins: 0 anchors.fill: parent delegate: gloader model: glistdata } Maybe you or anybody else has some ideas on how to specifically code the Loader written to a dynamic Component instead of referring to an external QML file to generate the Component value. And on top of that, how does the loader getComp( ) function access the index of the row or maybe it must just only refer to the model fields So yes, I would like the Loader to intelligently select the sourceComponent using a dynamic function attached to the loader. This is an area that needs maybe a long experience QT veteran
Re: [Interest] QML Loader sourceComponent Dynamic selection (not source property)
Hello Mark. Seems like the access of values in the listview does not work as you would expect from what is written in the documentation. The instanciated delegate is not treated as an actual child object and as such does not have access to the references it would have if it was instanciated from a file. If you use the Loader as a delegate directly and define the components as child objects in the Loader it works: ListView { id: glistview anchors.margins: 0 anchors.fill: parent delegate: Loader { function getComp(gidx) { switch (gidx) { case 1: return gflavorone case 2: return gflavortwo } //Default case return gflavorthree } sourceComponent: getComp(index) Component { id: gflavorone Column { width: glistview.width height: 40 Text { text: 'Name:' + name } Text { text: 'Mood:' + mood } } } Component { id: gflavortwo Column { width: glistview.width height: 40 Text { text: 'Name:' + name } Text { text: 'Eyes:' + eyes } } } Component { id: gflavorthree Column { width: glistview.width height: 40 Text { text: 'Name:' + name } Text { text: 'cell:' + cell } } } } model: glistdata } -Even From: mark diener [mailto:rpzrpz...@gmail.com] Sent: 17. november 2014 04:18 To: Kristoffersen, Even (NO14) Cc: interest@qt-project.org Subject: QML Loader sourceComponent Dynamic selection (not source property) Even: A couple months back you gave an intelligent answer from a interest list query about creating complex list views. I was a little tied up with things and could not get around to actually create a working example of a complex list view. Now is that time. Maybe you could get me past some implementation uncertainties Attached below is a copy of the original message. I am having trouble defining a loader that does not need a separate QML file for its definition, but a javascript function that is away of which row index of the model it is currently drawing and can pass that to a javacript function that will return a Component value directly instead of a reference to an QML file. I have included a small snippet QML file below: ListModel { id: glistdata { type: 1 name : Joe Perra cell: 555-1212 eyes: blue mood: sad } ListElement { type: 2 name : Mary Tyler cell: 555-1213 eyes: brown mood: happy } ListElement { type: 3 name : Peter Gabriel cell: 555-1214 eyes: blue mood: bitter } } Component { id: gflavorone Item { Text { text: 'Name:' + name } Text { text: 'Mood:' + mood } } Component { id: gflavortwo Item { Text { text: 'Name:' + name } Text { text: 'Eyes:' + eyes } } Component { id: gflavorthree Item { Text { text: 'Name:' + name } Text { text: 'cell:' + cell } } Loader { id: gloader function getComp(gidx) { switch (gidx) { case 1: return gflavorone case 2: return gflavortwo } //Default case return gflavorthree } } sourceComponent: getComp(index) } ListView { id: glistview anchors.margins: 0 anchors.fill: parent delegate: gloader model: glistdata } Maybe you or anybody else has some ideas on how to specifically code the Loader written to a dynamic Component instead of referring to an external QML file to generate the Component value. And on top of that, how does the loader getComp( ) function access the index of the row or maybe it must just only refer to the model fields So yes, I would like the Loader to intelligently select the sourceComponent using a dynamic function attached to the loader. This is an area that needs maybe a long experience QT veteran to comment on this. Cheers, md Subject: [Interest] Qt Quick 2.x Complex ListView Hello QTers: Does anybody have an idea on how to
Re: [Interest] reference counting
On Monday 17 November 2014 12:54:59 René J.V. Bertin wrote: Out of curiosity: is QEventLoopLocker thread-safe? That is, can the lock be set (increased aka reference counter increment) in a background thread and unset (decreased aka reference counter decrement) in the main thread? This happens in KDevelop 4 because it creates (or starts) KJobs in background threads but deletes the objects in the main thread, and at least in KDE 4 it is written nowhere that that is not done. Yes, it's thread-safe. -- 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] reference counting
On Monday November 17 2014 09:03:48 Thiago Macieira wrote: Yes, it's thread-safe. OK, thanks. :) R. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QVector::resize / QList
There is a QVector::resize but no QList::resize Any design reason for this? Philippe ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QVector::resize / QList
On Monday November 17 2014 22:23:15 Philippe wrote: There is a QVector::resize but no QList::resize Any design reason for this? Vector classes are often designed for speed (for instance to support SIMD operations), lists for flexibility. I don't know if that difference applies to QVector and QList too, but if it does, QList::resize might be missing because implicit/automatic. R. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QVector::resize / QList
Il 17/11/2014 22:23, Philippe ha scritto: Any design reason for this? No, simply nobody implemented it so far. (And given that QList is the preferred return type in Qt APIs, I've hit my face against this many many times. However there's the long trend of moving towards QVector...) Contributions are welcome, anyhow. -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Software Engineer KDAB (UK) Ltd., a KDAB Group company Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090 KDAB - Qt Experts - Platform-independent software solutions smime.p7s Description: Firma crittografica S/MIME ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Qt 5.3.2 / OSX cannot use native CGContext drawing in paintEvent / Flickering
Hi List ! I narrowed down my previous Problem about beeing unable to draw exact RGB device values... The core problem is that i cannot really use native (CGContext) drawing in Qt5 ! (Where it was working fine in Qt4). When i show the Qwidget subclass containing my paintEvent there is a short flicker where i can see my CGContext drawings ( 2 to three times) until finally i can only see a QWidget background. So i know i draw things but its somehow not persistent /overwritten. What i am doing: --- I create a QWidget subclass and implement a paintEvent method. Here is a shortened paintEvent method: void nativePainter::paintEvent(QPaintEvent* e) { QPainter painter; painter.begin(this); painter.beginNativePainting(); //creating a CGImageRef and put some Bitmap in it ... //until here CGContextRef context = QtMac::currentCGContext(); CGContextDrawImage(context, cgrect, iref); CGContextFlush(context); //end painting painter.endNativePainting(); painter.end(); } You can get a full sample that shows the effect here: http://qt-project.org/forums/viewthread/49751/ Is there someone who can help me out on this one ? Is it a Qt5 Bug ? Greetings, Nils ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QVector::resize / QList
On Monday 17 November 2014 22:47:51 Giuseppe D'Angelo wrote: Il 17/11/2014 22:23, Philippe ha scritto: Any design reason for this? No, simply nobody implemented it so far. (And given that QList is the preferred return type in Qt APIs, I've hit my face against this many many times. However there's the long trend of moving towards QVector...) Contributions are welcome, anyhow. I've just set the task (QTBUG-42732) to unassigned. If someone wants to implement it, go ahead. -- 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] QML. onPaint is called when Canvas is invisible
I filed a bug: https://bugreports.qt-project.org/browse/QTBUG-42737 2014-11-16 16:24 GMT+03:00 Dmitrii Volosnykh dmitrii.volosn...@gmail.com: By the way, it is unclear when canvas gets repainted on requestPaint(): some time when it becomes visible or immediately? 2014-11-16 16:21 GMT+03:00 Dmitrii Volosnykh dmitrii.volosn...@gmail.com : Is such a behaviour is correct or this should be considered as a bug? onPaint handler gets triggered on requestPaint() and markDirty(Qt.rect(0, 0, width, height)). if (!visible) return guard works as a workaround. Regards, Dmitrii. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest