[Interest] Qt Quick + Unreal Engine?

2022-01-19 Thread Ola Røer Thorsen
Hi all,

just wondering if any of you have had any experience with combining Qt
Quick and Unreal Engine 4 (or 5)? My goal would be to use a Qt Quick UI on
top of 3D scenes from Unreal Engine. If you have, it would be interesting
to hear how it went, and if you have any recommendations.

I'm considering using Qt Quick render control inside Unreal Engine (if
possible). Or maybe use Unreal Engine pixel streaming to a video texture
rendered in the background of a Qt Quick window.

Best regards,
Ola
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] Quick3D in Qt 5.15: Texture file format with mipmaps and tool to create them on Linux?

2021-08-17 Thread Ola Røer Thorsen
Hi, as far as I can see Qt Quick3D in Qt 5.15 is not able to automatically
generate mipmaps on textures (introduced in Qt 6.x as far as I can see).

Anyone know which texture file formats are supported in Qt Quick3D in Qt
5.15, and any Linux-based tools to use to generate such files from a .png
file including generating mipmaps?

Not able to go to Qt 6 until Qt Location is ported over.

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


[Interest] Future of Qt Location (mapping solutions) in Qt 6

2021-04-12 Thread Ola Røer Thorsen
Hi all,

just wanted to bring some attention to the fact that it is still unclear if
the Qt Location module (which gives plotting of geographical maps) will be
included in Qt 6 at all.

For our use-case it's a complete show-stopper if it disappears (especially
using the mapbox-gl plugin) and we would be stuck with Qt 5.15 until we
find some other way to proceed. How widespread is the actual use of this
module? It brings a lot of value for us for sure (commercial product). I've
brought this up with commercial support, but I guess it would be
interesting to hear what the open source side thinks too.

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


Re: [Interest] mapboxgl plugin and glyphs

2019-12-27 Thread Ola Røer Thorsen


> 27. des. 2019 kl. 19:51 skrev maitai :
> 
> Hello,
> 
> Is there a way to specify a specific url for glyphs in mapboxgl plugin?
> 

Define a custom map style with those glyphs and serve it locally is the only 
way I can think of. Your server needs to serve the glyphs too along with the 
style. 

Cheers, 
Ola

> Longer version:
> I need to disable all access to mapbox urls, (i.e. I want to use mapboxgl 
> plugin just to load our own geojson geometries, and anyway the app must run 
> completely offline). For that I have put a dummy url in 
> mapboxgl.mapping.additional_style_urls parameter (namely http://none), so the 
> map displays only what is added via source, paint, etc. Is there a better way 
> to inhibit mapbox tiles access? When I use this dummy address of course qt 
> cannot load glyphs, and as a consequence labels in geojson are not shown. At 
> the end of the day I will need to specify a local source for glyphs, is it 
> doable?
> 
> Thanks and happy end of year to all
> 
> Philippe.
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] MapboxGL offline and custom vector tiles source

2019-12-22 Thread Ola Røer Thorsen
tor. 19. des. 2019 kl. 17:24 skrev maitai :

> We would like to serve custom vector tiles, ideally though an API call
> or eventually a local server/stream. We don't want to add data or layers
> to an existing mapbox chart, but rather respond to tile queries by
> sending our own geojson tiles. We have already done that for OSM plugin
> (with raster tiles), but we don't really know where to start with
> concerning mapbox vector tiles.
>
>
Some tips in general for custom vector tiles that have worked for me:
- take a look at everything at openmaptiles.org
- to have your Qt mapbox-gl plugin to load data from your own tile server,
use the "mapboxgl.mapping.additional_style_urls" plugin parameter
- your own map style needs to point to your own tile server for the source
data

There are several open source mbtiles servers out there, or you can write
your own and even run it as a part of your main application.


> The tiles are not stored in a database or mbtiles, but need to be
> generated on request.
>

Maybe this here is relevant,
https://openmaptiles.org/docs/generate/custom-vector-from-shapefile-geojson/

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


[Interest] Proper way to handle QUdpSocket::writeDatagram when it returns TemporaryError

2019-10-08 Thread Ola Røer Thorsen
Hi all, I've got a thread in an application (Linux, Qt 5.13.0) which just
writes udp datagrams at a relatively high frequency (video streaming).
Sometimes the QUdpSocket::writeDatagram function returns -1 and the socket
error is "TemporaryError". Looking into the source code of the udp socket
class, it seems like the actual reason is that the OS returns EAGAIN which
means I need to try again.

The thread is a QThread running the default event loop.

What's the best way to handle this? Right now I just made a dumb loop
trying again and again with a short usleep inbetween until it finally ships
the datagram. I tried using waitForBytesWritten when getting the temporary
error before trying again, but that had no noticeable effect. Without a
sleep, this spinning loop might have some several 100 retries before it is
successful.

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


Re: [Interest] Expected event execution order in this multi-thread application

2019-09-30 Thread Ola Røer Thorsen
man. 30. sep. 2019 kl. 16:48 skrev Thiago Macieira <
thiago.macie...@intel.com>:

>
> It's just wrong to use it. Just like QThread::{,m,u}sleep. Don't use them.
>
>
What's wrong with the sleep functions in particular? Are they worse than
calling for example unistd.h's "usleep" or
"std::this_thread::sleep_for(std::chrono::milliseconds(x));"?

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


Re: [Interest] Operator QMap[] is casting to int?

2019-05-07 Thread Ola Røer Thorsen
> Could you make an example where the casts are needed? Maybe the code can
> be rearranged in a way that the casts are NOT needed in the first place.
>
>
QByteArray bytes; // chosen because some api needs it later
std::vector other_bytes; // maybe returned from some 3rd party library
...
if (static_cast(bytes.size()) >= other_bytes.size()) {
...
}

I guess i could write stuff like

const std::size_t byteSize = bytes.size();
if (byteSize >= other_bytes.size())

but then I rather prefer static_cast. Note that I'm not saying we should
change everything in Qt to unsigned int, I think that might break a lot of
existing application code out there. Just saying that sometimes a
static_cast is needed.

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


Re: [Interest] Operator QMap[] is casting to int?

2019-05-07 Thread Ola Røer Thorsen
lør. 4. mai 2019 kl. 17:51 skrev Thiago Macieira :

> No, the size of something definitely fits in int on 32-bit systems. And
> why do
> you need to do any static_cast in the first place?
>

We build our code using gcc with the options "-Wall -Wextra -Werror" and
this leads us to have to use static_cast for example when comparing int and
unsigned int (or std::size_t). A mix of using std::array, std::string and
QVector/QByteArray often gives a few extra static casts, not that it
bothers me too much.

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


Re: [Interest] Screen Capture as format YUV

2018-11-08 Thread Ola Røer Thorsen
There is some code in the QMultimedia source that does convert from YUV to
RGB while rendering to the screen, I'd recommend you take a look there for
inspiration. I think it's the qsgvideonode_yuv.cpp file.

I've done similar things (I do rgb->yuv instead). Basically you upload your
YUV image to textures (use one for Y, another 1 or 2 for UV, depending on
the YUV format used). Render a textured quad to an FBO with an RGB texture,
using a shader that converts YUV to RGB. Read that FBO texture back to CPU
memory either with glReadPixels directly (slow!) or using pixel buffer
objects (PBO, much more efficient). With regards to performance, in my
experience on iMX6 (embedded linux, eglfs), a 720p stream will run at 1-2Hz
using glReadPixels, and at least 30Hz using glReadPixels on PBOs.

Things you need to read up on: OpenGL "render to texture", framebuffer
objects (FBO), pixel buffer objects (PBO), shaders. You can use Qt OpenGL
classes (such as QOpenGLContext, QOpenGLFramebufferObject and
QOpenGLShaderProgram) for pretty much everything except the PBOs, there you
need the native OpenGL API.

Cheers,
Ola






Den ons. 7. nov. 2018 kl. 17:55 skrev Jason H :

> I would be very interested in such a solution as well, but I don't know
> anything about "fragment shaders". If you know of any resources, I'm all
> ears!
>
>
>
> *Sent:* Wednesday, November 07, 2018 at 11:46 AM
> *From:* "Sean Harmer" 
> *To:* interest@qt-project.org
> *Subject:* Re: [Interest] Screen Capture as format YUV
>
> That would also be horribly slow for large frames. I'd suggest using a
> fragment shader to perform the conversion then glReadPixels to get it back
> to the CPU (or even better pass the texture id to gstreamer if it can work
> with them and avoid the round trip).
>
> Cheers,
>
> Sean
>
> On 07/11/2018 16:23, Jason H wrote:
>
> No. Video formats are not supported for paint operations. You'll have to
> convert.
> You can use a Runnable and do it on another core, though that adds
> asyncronicities...
>
>
> *Sent:* Wednesday, November 07, 2018 at 4:25 AM
> *From:* "Emre Cetin"  
> *To:* interest@qt-project.org
> *Subject:* [Interest] Screen Capture as format YUV
> Hi everyone,
>
> I have a project related to image processing on QT and GStream. I have
> created a program with QWidget, and I got a screenshot of this program with
> QPixmap. However, I need to convert these frames into a YUV format and
> send them to GStream because I am going to merge these frames another video
> frames with GStream.
>
> Is there any way I can get QWidget frames in YUV format? Without
> conversion. I am working on QT 5.5. Any advice ?
>
> Thanks,
> Emre Cetin
> ___ Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
> ___
> Interest mailing 
> listInterest@qt-project.orghttp://lists.qt-project.org/mailman/listinfo/interest
>
>
> ___ 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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt installer from console

2018-09-15 Thread Ola Røer Thorsen
Last time I tried the command line options to avoid using the installer gui
did not do anything. Then spent some time trying to script the installer
for console-only-use, but it's not well documented and hard to get right.
Expect to get into situations during upgrades where your script will get
stuck, especially if there are changes in the online installer gui after an
upgrade.

If you're able to forward X with "ssh -X" and just run the installer on
your server with the GUI on your computer then that's probably your easiest
option. I'd wish for a complete set of command line options in the
installer so that the gui could be bypassed completely.

Cheers,
Ola


2018-09-15 11:27 GMT+02:00 Roman Wüger :

> Hi,
>
> I have Ubuntu server 18.04 Installed and wanted to install Qt with the
> online installer. Is this somehow possible. I thought it was possible in
> the past if I remember correctly.
>
> Thanks in advance
> Regards Roman
>
> ___
> 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] Qt Quick and animatic 12MP image

2018-09-05 Thread Ola Røer Thorsen
2018-09-05 14:08 GMT+02:00 Tomasz Olszak :

> Hi, I want to animate (change flickable contentX and contentY) image
> position in screen. Image is bigger(4000x3000) than screen. Currently, I
> implemented it on I7 ivybridge on Kubuntu 18.04.
> It simply stutters few times a second. If anyone has integrated Intel GPU
> - could I kindly ask to check if it also stutter for him? Is it a GPU limit
> to handle such big texture or perhaps I can tweak something to make it
> fluent:
>
>
Instead of flickable i'd use GridView (which uses flickable). Only the
items actually on screen will be instantiated, so it scales much better.

If your real case is an image and your GPU supports texture sizes as big as
your image size then maybe something like this could be faster (let a
shader to the zooming/cropping):


import QtQuick 2.9

import QtQuick.Window 2.2


Window {

visible: true

width: 640

height: 480


Image {

id: img

source:
"http://www.letsgodigital.org/images/producten/1515/testrapport/underwater-photos.jpg;

visible: false

}


Flickable {

anchors.fill: parent

id: flicker

contentWidth: dummyFlickItem.width

contentHeight: dummyFlickItem.height


Item {

id: dummyFlickItem

width: img.sourceSize.width

height: img.sourceSize.height

}

}


ShaderEffect {

anchors.fill: flicker

property variant src: img

property real xPosition: flicker.visibleArea.xPosition

property real yPosition: flicker.visibleArea.yPosition

property real widthRatio: flicker.visibleArea.widthRatio

property real heightRatio: flicker.visibleArea.heightRatio


vertexShader: "

  uniform highp mat4 qt_Matrix;

  attribute highp vec4 qt_Vertex;

  attribute highp vec2 qt_MultiTexCoord0;


  uniform highp float xPosition;

  uniform highp float yPosition;

  uniform highp float widthRatio;

  uniform highp float heightRatio;


  varying highp vec2 coord;

  void main() {

  coord.x = xPosition + widthRatio*qt_MultiTexCoord0.x;

  coord.y = yPosition + heightRatio*qt_MultiTexCoord0.y;

  gl_Position = qt_Matrix * qt_Vertex;

  }"

fragmentShader: "

  varying highp vec2 coord;

  uniform sampler2D src;

  uniform lowp float qt_Opacity;

  void main() {

  gl_FragColor = texture2D(src, coord);

  }"

}

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


Re: [Interest] qtLocation and mbtiles

2018-07-09 Thread Ola Røer Thorsen
>
>
> Thanks Ola for your reply and advise. I gave it a try and it is working
> nicely (the server is in a thread of the main application as you
> suggested). I used the osm plugin instead of mapbox-gl, is there any reason
> why mapbox-gl would be more advantageous?
>
>
I'm using a mix of vector and raster tiles, so I needed mapbox-gl. If you
only use raster tiles then osm should be just fine! I guess it should be
much easier to use as a starting point for your own plugin too.

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


Re: [Interest] qtLocation and mbtiles

2018-07-07 Thread Ola Røer Thorsen


> I need to create a plugin for qtLocation that would use a local mbtile sql 
> database instead of an online provider or a directory. The mbtiles management 
> part is not an issue, I have already a class responding to tiles queries that 
> I use in another widget-based application.
> 
> So far my understanding is that I need to subclass 
> QGeoServiceProviderFactoryV2 and all other relevant classes. Is it the 
> correct approach or is there something more simple? I couldn't find any 
> sample on internet, and I find the documentation very limited.
> 
> Any clue welcomed to help getting me started.

If you write a small http mbtiles server then you can use one of the existing 
plugins that are bundled with Qt. I’ve done this using the mapboxgl-plugin. You 
can run the “server” from a thread in your application if you want. 

This might be the easiest solution for you, sounds like you have most of it 
already. 

For the mapbox-gl plugin, pass it an additional style to use, then serve this 
style from your server. You must also serve a “tilejson” file. Check out 
tileserver-gl on github for inspiration (node.js-based).

Cheers,
Ola

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


[Interest] QTimer at 30Hz interval?

2018-04-04 Thread Ola Røer Thorsen
is there some nice trick to make a QTimer trigger at 30 Hz? This interval
can't be expressed properly in milliseconds (1000/30 = 33.33...)

My use case is for Linux only so I'd be happy with some Linux-specific way
of triggering a signal at 30 Hz too. It won't have to be very precise for
each trigger as long as the average frequency is 30 Hz.

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


Re: [Interest] Efficiently render QtQuick-scene and encode to H264 on i.MX6 VPU?

2018-03-23 Thread Ola Røer Thorsen
Small update, it turns out GL_viv_direct_texture can only be used to upload
textures to the GPU, not the other way around. I did try this out to be
sure, no success.

The recommendations I get from NXP is to use their "virtual framebuffer"
kernel module, that creates as many virtual framebuffers I'd like. These
are only buffers in memory that can be read on the cpu side.

So now my question is this: is it possible from a Qt application to render
to more than one frambuffer at the same time? How can this be done, in
combination with QQuickRenderControl (I need to control the framerate)?
I still need to render to /dev/fb0 for my regular GUI (regular LCD screen),
but now I also need to render a window to one of these virtual framebuffers
("/dev/fbX", X > 0).

If this is not possible then I'll try to run that application as a separate
process setting the environment variable QT_QPA_EGLFS_FB to my virtual
device. I'd like to avoid this if possible.

Cheers,
Ola



2018-03-23 9:12 GMT+01:00 Ola Røer Thorsen <o...@silentwings.no>:

> Hi Gunnnar,
>
> thanks a lot, this gives me a good starting point. I didn't know I could
> use GL_viv_direct_texture "in reverse" like this, I'll try it out. Already
> using it to stream decoded h264 video to a texture for rendering to the
> screen.
>
> I don't know which one will work best, but you want to avoid the
>> QOpenGLFrameBufferObject -> QImage conversion at all cost :)
>>
>>
> Yeah that's the one I was worried about :)
>
> Cheers,
> Ola
>
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Efficiently render QtQuick-scene and encode to H264 on i.MX6 VPU?

2018-03-23 Thread Ola Røer Thorsen
Hi Gunnnar,

thanks a lot, this gives me a good starting point. I didn't know I could
use GL_viv_direct_texture "in reverse" like this, I'll try it out. Already
using it to stream decoded h264 video to a texture for rendering to the
screen.

I don't know which one will work best, but you want to avoid the
> QOpenGLFrameBufferObject -> QImage conversion at all cost :)
>
>
Yeah that's the one I was worried about :)

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


[Interest] Efficiently render QtQuick-scene and encode to H264 on i.MX6 VPU?

2018-03-22 Thread Ola Røer Thorsen
Hi,

I need to render a Qt Quick scene and stream it as H264 data on an
i.MX6-device running Linux. The use case is to be used live with as little
latency as possible.

I'm thinking of using the QQuickRenderControl class. The easy way is
probably to render the scene to a QOpenGLFramebufferObject, convert to
QImage, convert to yuv420p, and feed to the VPU encoder. But maybe there is
some device-specific way that is more efficient?

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


Re: [Interest] Two from one.

2018-02-08 Thread Ola Røer Thorsen
2018-02-08 13:56 GMT+01:00 william.croc...@analog.com <
william.croc...@analog.com>:

> I have an application.
> I would like to rearchitect it were 90% is in a shared library.
> I would use that lib to link a main application.
> I would like to create a single .pro file that can be
> used to create both the library and main app.
> I do not want to create the lib and app in separate dirs
> with separate .pro files.
>

I don't think it's possible at all with qmake the way you describe it.

However it is easily done with Qbs. You can have a single file, and you
won't have to move any source files.
http://doc-snapshots.qt.io/qbs-1.11/howtos.html (second section)

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


Re: [Interest] How to make a looping element?

2018-01-29 Thread Ola Røer Thorsen
Try the RotationAnimation item and set the direction property to shortest.
http://doc.qt.io/qt-5/qml-qtquick-rotationanimation.html

Cheers, 
Ola


> Den 29. jan. 2018 kl. 02.15 skrev Jason H :
> 
> I am trying to make a compass control, something that shows 0-360, like a 
> boat compass. It's got hash marks and numbers 350...0...10, etc. I have 
> something that largely works, but when the position crosses over 360 to 0, 
> the whole thing swings back around. It's very jerky, so I animate it, and 
> it's got that nice smoothness. I've tried to use complete() to make the 
> animation finish when it's a switch over, no luck.
> 
> Does anyone have tips on how I can do this?
> ___
> 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] Webgl (streaming) platform plugin in Qt 5.10 missing?

2017-10-26 Thread Ola Røer Thorsen
Is the new webgl streaming platform plugin supposed to be included in the
Qt 5.10 Linux installer, or do I have to build Qt from source to use this?

The platform plugin is as far as I can see not included in the current
beta2 (installed using the online installer).

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


Re: [Interest] Set transparent fill on map using mapboxgl plugin

2017-10-24 Thread Ola Røer Thorsen
>
> MapParameter {
> type: "paint"
> property var layer: "water-shadow"
> property var fillOpacity: 0.1
> }
>
>
... sorry for accidentally pressing send.

It seems like the map does not handle transparency properly. I also tried
creating my own mapbox style with most fill-colors set transparent. However
in Qt Quick Map the transparent colors are rendered as black instead so the
map cannot be used as an overlay on top of the rest of the Qt Quick scene.

Is this a bug, or simply not possible?

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


Re: [Interest] Set transparent fill on map using mapboxgl plugin

2017-10-24 Thread Ola Røer Thorsen
2017-10-24 12:36 GMT+02:00 Paolo Angelelli :

>
> For your specific problem, if this is going to work, it's probably by
> setting some of the properties described
> in https://www.mapbox.com/mapbox-gl-js/style-spec/#layers-fill
>
>
Thanks for the reply! I got it working, after I figured out that the mapbox
property names are translated from the mapbox names with dashes to
camelCase in the MapParameter item. So this here work for example:

MapParameter {
type: "paint"
property var layer: "water-shadow"
property var fillOpacity: 0.1
}



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


[Interest] Set transparent fill on map using mapboxgl plugin

2017-10-23 Thread Ola Røer Thorsen
Hi, I'm evaluating using QtLocation's map using mapboxgl. Currently I'm
using the default settings, default map style, default developer access
token.

I'd like to set most layers' fill color to transparent, to see how it works
out as an overlay on top of some live video.

>From the documentation it seems like I can use the MapParameter items to do
this, but so far I haven't been able to do anything to change the existing
layers.

Anyone have some hints for me how to do this? Basically i'd like to set the
colors for layers like the background, water, etc. to transparent.

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


[Interest] How to get in touch with the Qt Company sales people?

2017-09-27 Thread Ola Røer Thorsen
Hi,

my employer has now tried to get in touch with sales at the Qt Company to
get a license quote for the last two weeks. They tried using the contact
form at the web page as well as the phone numbers listed on the website (HQ
and Nordic). Nobody answers the phone, and the forms filled out appear to
go unnoticed.

If anyone on this list from the Qt Company can give me some valid contact
information please send me an email.

Best regards,
Ola Røer Thorsen
o...@silentwings.no
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Setting propery values on Q_GADGET-based objects in qml possible?

2017-06-20 Thread Ola Røer Thorsen
2017-06-20 13:52 GMT+02:00 Ola Røer Thorsen <o...@silentwings.no>:


> function doStuff() {
>var o = theGadget;
>console.log("o.name"); // prints "Name"
>o.name = "Some other name"; // No error, but nothing really happens
> either
>console.log("o.name"); // Still prints "Name" instead of "Some other
> name"
>backend.setNewGadget(o);
> }
>
>
Turns out that the problem is that "o" in this case is not really my
MyGadget type, but rather a QVariant (?) containing the MyGadget type
because it was exposed to QML via a C++ list model (the model data()
function returns the gadget wrapped in QVariant).

If I make a hack addition to my class like
Q_INVOKABLE MyGadget getMyself() const { return *this; }

then call
var o = theGadget.getMyself();
o.name = ...

it actually works.

If any of you have some better way to do this I'd be happy to learn about
it. The QVariant::value function is not callable in qml.

Could the behavior with silently ignoring assigning property values when
wrapped in QVariant be considered a bug? If so I'll make a bug report.

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


[Interest] Setting propery values on Q_GADGET-based objects in qml possible?

2017-06-20 Thread Ola Røer Thorsen
Hi all,

I have a Q_GADGET-based class with properties that I instantiate in C++ and
expose to qml via QVariant in a list model. The class is registered to Qt
and Qml using Q_DECLARE_METATYPE,
qRegisterMetaType and qmlRegisterUncreatableType.

The properties are defined like this:

class MyGadget {
Q_GADGET
Q_PROPERTY(Type propName MEMBER propName)
public:
Type propName;
... etc
};

In QML I can read the properties just fine.

Now I'd like to take one of these gadget-objects in QML, modify some of
it's properties and then use it as an argument when calling a Q_INVOKABLE
c++ function.

In qml code this looks something like

property var theGadget // with a property .name = "Name"

function doStuff() {
   var o = theGadget;
   console.log("o.name"); // prints "Name"
   o.name = "Some other name";
   console.log("o.name"); // Still prints "Name" instead of "Some other
name"
   backend.setNewGadget(o);
}

Trying to set any of the gadget object's properties does not have any
effect. The value of property "name" here is the same before and after the
assignment. Are Q_GADGET types to be considered read-only in QML, or am I
missing something else to make this work?

This is using Qt 5.9.0.

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


[Interest] Open source license attribution when deploying a Qt-based application

2016-11-23 Thread Ola Røer Thorsen
I plan to release a closed source Qt-based application in a few months.
It's using the LGPL version of Qt, and I plan to bundle the Qt dynamic
libraries and plugins I need along with the application in an installer.

I have built up a list of the open source libraries that I have used along
with their license text available from inside the application (help - about
etc). Here Qt itself is included. Should I also add all the libraries that
Qt have used here? That means practically more or less this whole list:
http://doc.qt.io/qt-5/3rdparty.html ?

Any hints to what is the commonly accepted practice would be welcome.

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


[Interest] Qt Data Visualization - Scatter3D gradient from independent value

2016-08-29 Thread Ola Røer Thorsen
I'm plotting 3d point cloud data in QML using the Scatter3D item. I'd like
to set the color of each point individually from a gradient, but not
related to each point's position.

The use case is plotting temperatures in 3d-space. Each point represents a
temperature measurement at some 3d coordinate.

Is this possible using Qt 5.7 and the Scatter3D item? It looks like I need
to use the Theme3D.ColorStyleObjectGradient color style, but I cannot
figure out how to actually set the gradient position/value for each point.

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


Re: [Interest] Qt Location with Mapbox plugin?

2016-07-17 Thread Ola Røer Thorsen
2016-07-15 18:08 GMT+02:00 :

>
> Do you see http://doc.qt.io/qt-5/location-plugin-mapbox.html and
> https://www.mapbox.com/help/define-map-id/ ?
>
>
Thank you! That second URL helped, I had not seen it. I was using the
Mapbox Studio, and that page says
"Styles made in Mapbox Studio do not have map IDs, instead they have style
URLs.". Got it working now.

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


Re: [Interest] Managing memory with QObject*-models exposed to QML

2016-07-17 Thread Ola Røer Thorsen
Thank you for the feedback, Ben.

2016-07-15 19:32 GMT+02:00 Ben Lau :

> Hi,
>
> In my humble opinion, QObjectListModel is a bad idea. Because it is
> difficult to manage the life cycle of QObject with QML. Just like your
> problem. I have met the similar issue in my first QML project. The
> application always crashes. The pattern is purely random. I wasted a lot of
> time to discover the root cause.
>
>
Right. Well it's disappointing if this cannot be solved properly at all. A
QObjectList is mentioned as a proper model usable in QML so I am tempted to
say this is a rather big flaw in the QML engine itself.
http://doc.qt.io/qt-5/qtquick-modelviewsdata-cppmodels.html
It would be nice to get som kind of confirmation from someone knowing the
insides of the QML engine, if this is supposed to work or not, and if it
can be fixed.

Moreover, I am doubt to use a list of QObject as a data storage class.
> Since QObject is not copyable, it must use a pointer to share QObject to
> multiple classes. Extra care is needed to manage its life cycle. And they
> are not able to be passed to another thread for processing directly.
> Therefore, I always prefer an implicitly shared class over a list of
> QObject as data storage. It is copyable and thread safe (using a worker
> model).
>
>
Yes I agree it's not always optimal to use the QObjects. But in the
application I am working on now it actually makes sense (convenient, few
lines of code) to use QObjects with properties and especially qml-invokable
functions.


> Instead, I use another approach for sharing data between C++ and QML. I
> just hold a QList (T is an implicitly shared class) as the central data
> storage in memory. Whatever it is changed, it will update a
> QVariabtListModel to inform QML to render the content. However, QML/JS do
> not write to the model directly. Instead, it will ask another C++ object to
> update the central data. (e.g by context object / messaging system)
>
> In order to simplify the process to update the QVariantListModel, I have
> written a library called QSyncable. It have document and example code to
> demonstrate how this approach works.
>
> https://github.com/benlau/qsyncable
>
>
This is interesting, I'll try it out. Seems like there is some additional
overhead of creating the maps and such, but I might not notice.

Is it easy to use additional proxy-models in combination with your library
to filter and/or sort the lists live, based on updated data in the lists?

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


Re: [Interest] Qt Location with Mapbox plugin?

2016-07-15 Thread Ola Røer Thorsen


> Den 15. juli 2016 kl. 15:01 skrev "Olivier B." 
> <perso.olivier.barthel...@gmail.com>:
> 
> There was a message about it in that same mailing list earlier this morning 
> from alexander.blas...@qt.io : 
> 

Saw that but it's not relevant to my actual question. I am actually trying to 
use mapbox, not osm/mapquest that is now broken.



> 2016-07-15 14:43 GMT+02:00 Ola Røer Thorsen <o...@silentwings.no>:
>> I'm struggling getting any maps shown using the Qt Location Mapbox plugin. 
>> I'm getting error messages like "failed to fetch tile, , server replied: 
>> Forbidden". 
>> 
>> The plugin needs a map_id and an access_token. 
>> 
>> On the mapbox website it's easy to find the access tokens, but no map id's. 
>> Maybe they have changed the way this is done? They refer a lot to Style URLs 
>> instead. 
>> 
>> Are any of you out there successfully using Mapbox? How did you configure 
>> the plugin? 
>> 
>> 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
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt Location with Mapbox plugin?

2016-07-15 Thread Ola Røer Thorsen
I'm struggling getting any maps shown using the Qt Location Mapbox plugin.
I'm getting error messages like "failed to fetch tile, , server
replied: Forbidden".

The plugin needs a map_id and an access_token.

On the mapbox website it's easy to find the access tokens, but no map id's.
Maybe they have changed the way this is done? They refer a lot to Style
URLs instead.

Are any of you out there successfully using Mapbox? How did you configure
the plugin?

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


[Interest] Managing memory with QObject*-models exposed to QML

2016-07-14 Thread Ola Røer Thorsen
I've found that creating C++ models containing a list of QObject* based on
QAbstractListModels and using them in Quick views such as ListView is very
useful. I'm not the only one, there are several implementations of
"QObjectListModel" around, and I've got my own as well.

On quite rare ocations I have had crashes deep inside the QML engine
itself, that are very hard to reproduce, when rapidly adding and removing +
deleting objects in the model from C++. I think this probably has to do
with the Quick view's delegate that might still be using an Object that was
just deleted.

I've made sure that all objects put into the list model are created in C++
and they do have a parent to avoid qml taking ownership of them. When
removing from a model, they are first removed  (beginRemoveRows, remove
from array, endRemoveRows), then finally deleted using
object->deleteLater().

My worry here is that deleteLater() is sometimes still too soon for the QML
engine to keep up, especially when there is a lot of things going on in the
Quick scene.

Could this be the case? If so, what is the rock-solid way to do this?

One ugly "fix" that I would like to avoid is to put the objects in some
queue and delete them after a given "safe time duration", like
"deleteMuchLater()".

Another way idea that I have not tried is to use QSharedPointer, and expose
some wrapper Q_GADGET-based type to QML that contains this pointer with
some raw pointer property, but this introduces shared pointers to my C++
application and changes a lot of other things.

I'd appreciate any input on if this is a real problem to begin with, and if
so, how to work around it.

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


[Interest] Qt3D camera field of view angle definition?

2016-07-08 Thread Ola Røer Thorsen
What's the definition of the field of view angle for Q3D' s QCamera? Is it
the diagonal field of view?

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


[Interest] Qt3D SceneLoader - adjusting materials when using Collada files exported from Blender

2016-07-08 Thread Ola Røer Thorsen
Hi,

I need to load some simple 3d scenes into an application using Qt3D,
QtQuick and Qt 5.7.

I've created the scenes in Blender, exported them as Collada files and they
mostly show up in my application unless SceneLoader causes a crash. I'm
using the basic ForwardRenderer frameGraph like so,

components: [

RenderSettings {

activeFrameGraph: ForwardRenderer {

camera: camera

clearColor: "lightskyblue"

}

},

InputSettings { }

]


There is one light source acting as the sun,

Entity {

id: sun

components: [

DirectionalLight {

color: Qt.rgba(1,1,1,1)

worldDirection: Qt.vector3d(0,-1,0)

}

]

}


However the end result is very dark, and it does not seem like any material
changes I do in Blender have much effect on the rendering in my
application. Texturing works OK, the diffuse color is used for texturing.
The ambient light color shows up as completely black, making the scene much
too dark in the shadow areas. Specular is very "hard" which also makes the
overal scene darker. It also seems like only one light source is used when
rendering, even if I define several to try to lighten up the shadows.

If anyone have some hints on how to tune the materials used in a workflow
like this I'd be really happy to hear about it. In general I want to create
a scene in Blender, import it somehow to my application, and render the
scene in a way that doesn't have completely black shadow areas. Is there
some way to tune the materials used by SceneLoader?

For other entities in the scene I'm using the DiffuseMapMaterial which
gives me good results.

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


[Interest] How to set absolute Qt3D::QCamera rotation/orientation

2016-06-08 Thread Ola Røer Thorsen
I need to set a Qt3D::QCamera orientation directly. I've got the position
in a QVector3D and the rotation in a QQuaternion. I can't seem to find any
API for this. The "rotate"-function just adds my quaternion to the existing
orientation which is not what I'm looking for. Is there some better way to
do this?

Cheers,
Ola
___
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-30 Thread Ola Røer Thorsen
2016-04-30 10:46 GMT+02:00 Jean-Michaël Celerier <
jeanmichael.celer...@gmail.com>:

> https://godbolt.org/g/DqBlFG
>
> With gcc -O1
>
> float f(float x)
> {
>   return 2. * x;
> }
>
> becomes
>
> f(float):
> addss   %xmm0, %xmm0
> ret
>
>
> and
>
> float g (float x)
> {
>   return 2.f * x;
> }
>
> becomes
>
> g(float):
> addss   %xmm0, %xmm0
> ret
>
>
This is on x86. I was talking about ARM with single-precision FPUs and the
general advice not to use double precision constants if possible there.

This is what GCC itself says in the documentation for -Wdouble-promotion:

-Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)Give a
warning when a value of type float is implicitly promoted to double. CPUs
with a 32-bit “single-precision” floating-point unit implement float in
hardware, but emulate double in software. On such a machine, doing
computations using double values is much more expensive because of the
overhead required for software emulation.

It is easy to accidentally do computations with double because
floating-point literals are implicitly of type double. For example, in:

  float area(float radius)
  {
 return 3.14159 * radius * radius;
  }

the compiler performs the entire computation with double because the
floating-point literal is a double.
___
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 <o...@silentwings.no>
> 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 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] [Qt3D] Render to video

2016-04-18 Thread Ola Røer Thorsen
2016-04-18 14:38 GMT+02:00 Andy :

> On Mon, Apr 18, 2016 at 3:26 AM, Harald Vistnes 
> wrote:
>
>> Hi Andy,
>>
>> An alternative is to use the FFMPEG encoding library instead of the
>> command line tools. Then you can pass each frame to the video encoder as
>> you generate it without writing them all to disk first.
>>
>
> This is non-GPL software, so I can't use the lib directly (I should have
> mentioned that).  I haven't found a BSD or MIT lib that encodes the common
> formats - is anyone aware of one?
>

I've written an application using Qt Quick that exports mp4 video files
from OpenGL content, but not involving Qt3D.

I render my scene into a FBO, grab the contents of the FBO into CPU memory,
encode using OpenH264, and put the resulting h264 stream into in a mp4
container.

OpenH264 has a BSD license: http://www.openh264.org/
Mp4v2 uses the Mozilla license, https://code.google.com/archive/p/mp4v2/
(not sure if this is the proper homepage anymore)

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


[Interest] Qt3D 2 and Bullet physics

2015-09-02 Thread Ola Røer Thorsen
Hi all,

just wondering if someone has tried using the Bullet physics engine with
Qt3D 2.0? Wondering about the best/recommended way to combine these. I'd
like to step Bullet's simulation loop and visualize the rigid bodies,
basically.

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


[Interest] Use of enum class, Q_ENUM and QML

2015-04-09 Thread Ola Røer Thorsen
Hi,

I'm looking into using enum classes (c++11) and exposing them to QML as a
part of planning a new project. It will use Qt 5.5 so I'm using Qt 5.5
alpha for now.

I'd like to use enum classes for the enums, but I'm not sure if it is
possible to use these in QML. Let's say I have two enums in a class,

TestClass
{
   Q_GADGET

public:
   enum class Something { Undef, On, Off };
   Q_ENUM(Something)
   enum class Other { Undef = 5, On = 6, Off = 10, Maybe = 255 };
   Q_ENUM(Other)
};

In my main.cpp I register this like so

qmlRegisterUncreatableTypeTestClass(Test,1,0,Test,Error...);

There does not seem to be any way in QML to differ between the two enum
classes. Looks like the values of the second defined class are used (so in
QML, Test.Undef will have the value of 5).

I tried registering the enum classes, but that doesn't work
(qmlRegisterUncreatableTypeTestClass::Something ... )

Do any of you know a way around this? The obvious fallback is to use unique
enum keys like when not using enum classes, (SomethingUndef, SomethingOn,
etc..), but I'd like not to, if it can be avoided.

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


Re: [Interest] Pre-compile system

2015-02-24 Thread Ola Røer Thorsen
2015-02-24 8:51 GMT+01:00 Mathieu Slabbinck matty.slabbi...@gmail.com:


 So my question here: how can I make a qt project that compiles libx
 before starting on the app itself, disregarding multiple jobs.


Hi, I think doing something like this in your subdir project file will help:

TEMPLATE = subdirs
SUBDIRS = SomeLibrary TheApplication
TheApplication.depends = SomeLibrary

This will make sure that TheApplication is built after SomeLibrary, also
with -j4.

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


Re: [Interest] QtQuick - How to move focus away from disabled Item?

2015-01-28 Thread Ola Røer Thorsen
Hi Jerome, thanks!

Yes I know about the FocusScope item and how it works. The specific issue
is the one I explained in my previous email, and I'm looking for a
workaround. FocusScope doues not move focus to another item if the current
focus item is disabled.

Cheers,
Ola


2015-01-28 18:04 GMT+01:00 Jérôme Godbout jer...@bodycad.com:

 Hi,
 This may not be a direct answer but you may want to take a look at
 FocusScope Qml Element:
 http://doc.qt.io/qt-5/qml-qtquick-focusscope.html

 Here's a good explaination about those scope:
 http://doc.qt.io/qt-5/qtquick-input-focus.html

 Hope this help somehow,
 Jerome


 On Wed, Jan 28, 2015 at 9:46 AM, Ola Røer Thorsen o...@silentwings.no
 wrote:

 Hi,

 I'm having some trouble making a robust QtQuick 5.4-based application
 where I only have 4 cursor keys and a return key available as the input
 method for the user.

 I have various gui buttons that I can move focus between. I've set this
 up using the KeyNavigation.onXXX etc. For a simple static gui, this is
 fine.

 However I get into trouble once some buttons get disabled
 (enabled-property set to false). This is done based on external events, so
 it may happen at any time.

 If a button with active focus is disabled, I'm stuck. The button's focus
 property is still true, but it will not receive key events, so I cannot
 move focus to the next using the cursor keys. I'd like focus to move on to
 some other item automatically anyway.

 Have any of you got some recommended way of dealing with situations like
 this?

 I think I've spent half the development time on this application just
 making sure keyboard navigation cannot get stuck.

 I did not have such issues when creating similar applications with Qt
 Widgets. There the behavior is that focus moves on to another widget
 automatically if I call setEnabled(false) on a widget with current active
 focus.

 I've tried doing something like this in my Button item:

 Button {
id: button
activeFocusOnTab: true
function transferFocus() {
   if(!visible || enabled)
  return;
   if(nextItemInFocusChain() === button)
  return;
   if(focus)
  nextItemInFocusChain().focus = true;
}
onEnabledChanged: transferFocus()
 }

 This works OK in a smaller test application, but makes the larger
 application hang when  nextItemInFocusChain is called for the 20th time
 or so.

 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


[Interest] QtQuick - How to move focus away from disabled Item?

2015-01-28 Thread Ola Røer Thorsen
Hi,

I'm having some trouble making a robust QtQuick 5.4-based application where
I only have 4 cursor keys and a return key available as the input method
for the user.

I have various gui buttons that I can move focus between. I've set this up
using the KeyNavigation.onXXX etc. For a simple static gui, this is fine.

However I get into trouble once some buttons get disabled (enabled-property
set to false). This is done based on external events, so it may happen at
any time.

If a button with active focus is disabled, I'm stuck. The button's focus
property is still true, but it will not receive key events, so I cannot
move focus to the next using the cursor keys. I'd like focus to move on to
some other item automatically anyway.

Have any of you got some recommended way of dealing with situations like
this?

I think I've spent half the development time on this application just
making sure keyboard navigation cannot get stuck.

I did not have such issues when creating similar applications with Qt
Widgets. There the behavior is that focus moves on to another widget
automatically if I call setEnabled(false) on a widget with current active
focus.

I've tried doing something like this in my Button item:

Button {
   id: button
   activeFocusOnTab: true
   function transferFocus() {
  if(!visible || enabled)
 return;
  if(nextItemInFocusChain() === button)
 return;
  if(focus)
 nextItemInFocusChain().focus = true;
   }
   onEnabledChanged: transferFocus()
}

This works OK in a smaller test application, but makes the larger
application hang when  nextItemInFocusChain is called for the 20th time
or so.

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


Re: [Interest] Custom QtQuick Animator API?

2015-01-26 Thread Ola Røer Thorsen
Hi Gunnar, thanks for the reply.


2015-01-25 16:42 GMT+01:00 Gunnar Sletta gun...@sletta.org:



 No such plan, no :)

 Doing custom animations on your nodes is easy using the QSGNode API
 though. For instance, like it is done in the “threadedanimation” example:
 https://qt.gitorious.org/qt/qtdeclarative/source/817cd03a5f437c9e8862646cca5ea016b1223bc7:examples/quick/scenegraph/threadedanimation


I use the QSGNode API already. But this only works for nodes I instantiate
myself, right?


I'm looking for a way to manipulate a transform node so that any child item
instantiated in QML will be affected.


MyAnimatedNode {

   Text {

  ...

   }

   Image {

  ...

   }

}


If MyAnimatedNode was a spinner like in the threadedanimation example,
the text and image would not spin along.


I did find a way though, but it does abuse the API. I can use
QSGNode::parent to find the parent transform node (the itemNode?) of a
dummy node I create. I can then manipulate the itemNode's transform similar
to what the animator classes do. Not that I'll ship anything actually doing
that.


Cheers,

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


[Interest] Custom QtQuick Animator API?

2015-01-22 Thread Ola Røer Thorsen
Hi all,

I would like to create a custom Animator class, or something similar that
can manipulate a QQuickItem's x and y position from the render thread.

The intended use is to move some label items on top of a 3d scene. The
labels will follow certain entities in the 3d scene. I know it will mostly
work by just setting the label item's x and y properties, but it will not
be as smooth as possible.

I've been looking into the Animator source code, which is all private API.
Are there any plans to make a public API for the Animators in a later Qt
version?

Alternatively, is there some way to get the root item node as returned by
QQuickItemPrivate::itemNode(), without using the private API? Any other
hints on how to do this?

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


Re: [Interest] Qt Quick UI Forms item views: best practices

2015-01-21 Thread Ola Røer Thorsen

Den 2015-01-21 09:24, skrev Alexander Ivash:
Yes, your are right, there was an error in my sample, but even fixing 
it doesn't change a lot: ui.qml files becomes not editable via 
QtCreator's QML designer due to presence


onClicked: root.onClicked(root.model.get(index)); /// this line makes 
QtCreator unhappy :(




As far as I have understood it, the whole idea of the ui.qml files are 
that they should not contain any javascript whatsoever. It's very 
difficult to develop a designer that understands what to do with 
javascript snippets while only working on a single file from a larger 
application.


You have to expose all items in your .ui.qml file via property aliases, 
and do all your logic code from the outside. The regular qtcreator 
designer doesn't have any button for exposing items as properties so you 
need to add them in the text editor manually. The commercial edition of 
qtcreator has such a button I think.


It's a bit confusing for new users. The default Quick project in 
QtCreator makes an example .ui.qml file with 3 buttons exposed as 
property aliases, and shows how to use them. It warns the user not to 
edit these ui.qml files by hand. Still, .ui.qml files are mostly useless 
if you don't create any property aliases, which you have to do by typing 
them into the text editor.


Maybe you could try something like this (haven't tested it myself):

Form.ui.qml
Item {
   property alias listView: theListView

   ListView {
  id: theListView
   }
}

Delegate.ui.qml
Item {
   property alias ma: mouseArea
   MouseArea {
  id: mouseArea
  anchors.fill: parent
  }
}

main.qml
Item {
   Form {
  listView.delegate: Delegate {
 ... javascript and bindings here.. .
  }
   }
}



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


[Interest] 64bit integer type in QML?

2015-01-14 Thread Ola Røer Thorsen
Hi all,

is it possible to use 64bit integers in QML?

Looking at the docs at http://doc.qt.io/qt-5/qml-int.html it seems like the
integers are 32-bit signed only (by counting the zeros in 20...)

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


Re: [Interest] How do properly deal with items being disabled in a focus scope in Quick2 (5.2.0)?

2014-01-23 Thread Ola Røer Thorsen
Hi Frederik,

thanks for the reply!

I've created a bug report here:
https://bugreports.qt-project.org/browse/QTBUG-35051
It includes some example code to play with. It got assigned to Alan Alpert,
so maybe you could change that if necessary.

I know it's tricky once all items are disabled. In the bug report I've
suggested this:

Plan A: move focus to the next child item with activeFocusOnTab and enabled
set to true
Plan B: if no such items were found, try moving active focus to the next
item in the tab chain.

Best regards,
Ola






2014/1/22 Frederik Gladhorn frederik.gladh...@digia.com

 Onsdag 22. januar 2014 13.46.03 skrev Ola Røer Thorsen:
  I've got a custom menu item (ColumnLayout-based), where the items inside
  are some custom button items. Each item is set up with KeyNavigation so
  that active focus is moved up and down using the cursor keys.
 
  If a button item's enabled property is set to false while having active
  focus, it's not possible to move active focus with the keys anymore. The
  item will not have active focus, and will not receive key events. The
 focus
  scope will not pass active focus to any other item either, so you are
  basically stuck. Using mouse or touch input is not always an option.
 
  How is this supposed to work? The way this works now, custom javascript
  focus handler code has to be added tailor made for a certain menu,
 everyone
  will have to invent their own.
 
  I would have hoped the focus scope could move active focus to the next
 item
  in the focus chain, if the active item is disabled.

 I agree that the current behavior is not very sensible. I'm not sure what
 the
 desired behavior is though, if you have any good suggestions, it is
 certainly
 something that could be fixed.

 I wouldn't mind a bug report.

 What if all items in the scope become disabled? Should the focus be moved
 left
 or down? Or should there be an exception: when enabled==false all Keys
 events
 are ignored but the arrow keys? None of these seems very satisfying.

 --
 Best regards,
 Frederik Gladhorn
 Senior Software Engineer - Digia, Qt
 Visit us on: http://qt.digia.com


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


[Interest] How do properly deal with items being disabled in a focus scope in Quick2 (5.2.0)?

2014-01-22 Thread Ola Røer Thorsen
I've got a custom menu item (ColumnLayout-based), where the items inside
are some custom button items. Each item is set up with KeyNavigation so
that active focus is moved up and down using the cursor keys.

If a button item's enabled property is set to false while having active
focus, it's not possible to move active focus with the keys anymore. The
item will not have active focus, and will not receive key events. The focus
scope will not pass active focus to any other item either, so you are
basically stuck. Using mouse or touch input is not always an option.

How is this supposed to work? The way this works now, custom javascript
focus handler code has to be added tailor made for a certain menu, everyone
will have to invent their own.

I would have hoped the focus scope could move active focus to the next item
in the focus chain, if the active item is disabled.

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


[Interest] Qt Quick Scene Graph, texture questions, Qt 5.2.0

2014-01-20 Thread Ola Røer Thorsen
Hi, I've got 3 questions about texture use in the Qt Quick scene graph:

1.

In general it's recommended in OpenGL to use power-of-two-sized textures
whenever possible, for performance resons. Does the Qt Quick scenegraph
deal with this in any way, or is it up to the user to use properly sized
images whenever possible?

By deal with this, it could be that the scenegraph adds some padding to
fit an image within the closest larger power-of-two size, at the cost of
wasting some memory.

2.

I've tried the option to visualize which images are put in a texture atlas (
QSG_ATLAS_OVERLAY). In my application, that has a lot of smaller icon
images (128x128 mostly), just about half of them are put in the atlas. Is
there just a single texture atlas implemented, or are there several of
them? My impression is that there is only one, and it gets filled up rather
quickly.

3.

How does Qt Quick deal with trying to show an image that is larger than the
maximum texture size supported on the targeted GPU? Does it tile several
textures internally?

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


[Interest] PVRTC textures in Qt Quick 2?

2014-01-20 Thread Ola Røer Thorsen
Is it possible to use PVRTC texture compression in Qt Quick 2 on PowerVR
gpus? If not, what would it take to add such a feature?

I searched through the Qt 5.2.0 source code, seems there was PVRTC support
in the old QGL* classes, but nothing in the QOpenGL* classes.

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


Re: [Interest] PVRTC textures in Qt Quick 2?

2014-01-20 Thread Ola Røer Thorsen
2014/1/20 Gunnar Sletta gunnar.sle...@jolla.com

 You can install a custom image provider that provides the PowerVR texture
 directly as a QSGTexture. In the scenegraph playground repository there is
 already a plugin that does this for AMD compressed textures. You can use
 that as a basis for your code.


 https://qt.gitorious.org/qtplayground/scenegraph/source/6379165f6ae63c3a73a62b8fa3845cc299449827:imageproviders/amd_compressed_atc_texture


Ah, brilliant! :-) Thanks!

I guess compressed textures can't be added to the regular texture atlas? Is
it possible to create a QSGTexture pointing to a custom texture atlas
instead? I could return custom QSGTextures re-implementing
normalizedTextureSubRect?

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


Re: [Interest] Qt Quick Scene Graph, texture questions, Qt 5.2.0

2014-01-20 Thread Ola Røer Thorsen
Thanks Gunnar :-)
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QML and video

2014-01-17 Thread Ola Røer Thorsen
Not directly answering your question Jeff, but anyway, I recommend looking
into using bc-cat on the SGX if possible.

http://processors.wiki.ti.com/index.php/OpenGLES_Texture_Streaming_-_bc-cat_User_Guide

You will have to write your own video render item for Qt Quick, because you
need a special texture lookup in the fragment shader (it's not a regular
texture). Also you need a custom video surface class (inheriting
QAbstractVideoSurface), that will upload the texture for you using bc-cat.

Apart from the faster texture uploads, bc-cat also automatically converts
YUV to RGB for you so there is no need for YUV-RGB conversions in the
shader (also faster).

Cheers,
Ola







2014/1/17 Lopes Yoann yoann.lo...@digia.com

  On which platform are you? Embedded Linux using GStreamer as multimedia
 backend?


 Yoann Lopes
 Senior Software Engineer - Digia, Qt
 Visit us on: http://qt.digia.com


 ___
 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] Caching of compiled/initialized qml code to disk possible?

2014-01-15 Thread Ola Røer Thorsen
Hi all,

I have an application written with Qt 5.2 in C++ and QtQuick2, running on a
low-end ARM device. I use the Loader item to select between various screens
in the application (I've currently got 6 screens or so). This way I can
limit the amount of active bindings at a given time, etc.

The first time I enter a new screen, there is a very noticeable delay (1-2
seconds), as the new items are compiled. The next time I enter the same
screen, the delay is much shorter. So I guess some things have been cached
in memory.

Would it be possible to cache this on disk, to prevent this from happening
every single time the application is started? I'm asking for something
pretty similar to Python's .pyc files.

Is it possible, or would it be possible in some future version of Qt?

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


Re: [Interest] Question about reading glsl shader source from a QResource using compression

2014-01-14 Thread Ola Røer Thorsen


 I think the example is just doing it wrong, it should instead load the
 resource file contents using QFile into two QByteArrays into the ctor
 and then return the QByteArrays' contents there.


Right. Thanks for the feedback! I'll use QFile to be sure, in case
compression is enabled.

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


[Interest] Question about reading glsl shader source from a QResource using compression

2014-01-13 Thread Ola Røer Thorsen
Hi all,

I've been looking at the Scene Graph - Graph example application included
with Qt5.2.0, to see how to create a custom shader material for Qt Quick.

In linenode.cpp, there is a LineShader class, where the shaders are read
like so:

const char *vertexShader() const {

QResource r(:/scenegraph/graph/shaders/line.vsh);

Q_ASSERT(r.isValid());

return (const char *) r.data();

}


const char *fragmentShader() const {

QResource r(:/scenegraph/graph/shaders/line.fsh);

Q_ASSERT(r.isValid());

return (const char *) r.data();

}


In the documentation for QResource, it says that the data returned by
r.data may be compressed. So is this way of reading the shader source code
safe at all times? Shouldn't it check with r.isCompressed and if so,
uncompress? Is there some assumption here that such small text files aren't
compressed?

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


Re: [Interest] QtQuick real-time meter widget question (QML Loader-related)

2014-01-06 Thread Ola Røer Thorsen
2014/1/3 VStevenP vstevenpa...@yahoo.com

 1. Is there a way to run this meter so that it will not be blocked by any
 QML Loader activity?  (I have some launcher icons on a sidebar which
 control what QML is loaded to appear in the common desktop client area of
 my display.)

 My hope is that the meter could be put directly into the scene graph
 somehow, and run on the render thread.  (I've had success doing that with
 the new YAnimator in Qt 5.2, but I don't know how to do this for my own
 QtQuick widget.)


I think that if you want to not have the meter interrupted by anything
happening in the QML code, you'll have to implement your meter item in C++,
and render it with custom geometry which is synchronized directly with your
audio data (not using signals/slots etc).

Before that though, did you try to set the asynchronous property to true
for your Loader items? They should cause less blocking that way.

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


Re: [Interest] Having an issue with a font

2014-01-02 Thread Ola Røer Thorsen
2013/12/20 Rogers Nate nate.rog...@raymondcorp.com

  I am having an issue where sometimes certain letters of one of the fonts
 I am using are getting corrupted.  It is not always the same letter, each
 time I do a build it changes, one time it may be a W then next time it’s a
 c or an h, sometimes it is none.  Anyway the font itself looks fine to me
 but I attached it for your review.  I also took a picture of the screen so
 you could see what is happening.  Notice the lowercase c and the lowercase
 h, it is especially noticeable on the c.  I am not sure what to do so any
 advice would be helpful.  Thanks!



 BTW I am using Qt5.1.1, eglfs platform, embedded Linux, on a am335x
 starter kit which has a 480x272 pixel 4.3in display.



I've seen the exact same rendering issue as well. In my case it happens
when using the Ubuntu Mono font. It only happens on the target hardware
using EGLFS (original beagleboard).

It's rather ugly, happens randomly, and is especially visible on the
forward slash character (/). I didn't have time to investigate further so
I just chose another font for the time being.

I think you should report it as a bug (https://bugreports.qt-project.org).

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


[Interest] Best practice for properties, QAbstractListModel with a QListQObject* and a Quick2 view

2013-12-18 Thread Ola Røer Thorsen
Hi,

I have a list of objects at the core of a class inheriting
QAbstractListModel,

QListMyObject* m_list;

MyObject inherits QObject and has many properties (20 or so). I need to
access most of these properties in a Quick2 view delegate.

To avoid creating roles for each of these properties, I created a
myObject role in the list model class instead, that returns a QVariant
containing the pointer to the object.

This works allright as long as the model count doesn't change. In a
delegate, I can get the properties like so:

Item {
   id: theDelegate
   property string someValue: myObject.someObjectValue
}

The properties have proper bindings, so the properties are updated when
something changes.

However I get problems when I delete objects from the list model. The
delegates are deleted later than the actual objects, so I get warnings from
QML on the console (saying myObject is null). These seem harmless enough,
but I would like to avoid having any warnings at all.

I can avoid them by doing tests where I use myObject in QML like so,

Item {
   id: theDelegate
   property string someValue: myObject ? myObject.someObjectValue : 
}

but this is just ugly.

So I wonder, how should I best deal with situations like this? Is exposing
the object pointer a bad practice to begin with?

The alternative is to create roles for every property in MyObject, and
connect signals for every one of them so the model updates when one of the
properties changes. Perfectly doable of course, but it has to be kept
up-to-date with the properties in MyObject, and feels like duplicating a
lot of code.

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


Re: [Interest] Best practice for properties, QAbstractListModel with a QListQObject* and a Quick2 view

2013-12-18 Thread Ola Røer Thorsen
Hi Jan!


 When working with the QAbstractItemModel, items can only be deleted via
 resetting the model, or when removing rows/columns. The row/column removal
 shall happen in three phases:

 1) call beginRemoveRows
 2) remove the internal representation, freeing the MyObject instances
 3) call endRemoveRows

 I will argue that if a delegate is alive after the beginRemoveRows
 finished, then the QML view is broken. The view shall react to
 rowsAboutToBeRemoved and kill any delegates in response to that signal.

 However, you absolutely must not free your internal representation prior to
 calling beginRemoveRows. Are you sure that this is not the case?


Yes. When deleting, I basically do this:

(m_objs_ is a QListMyObject* )
int rm_idx; // the index to remove

m_objs_[rm_idx]-deleteLater();
beginRemoveRows(QModelIndex(), rm_idx, rm_idx);
m_objs_.removeAt(rm_idx);
endRemoveRows();

I verified that the object is deleted later.


  Item {
 id: theDelegate
 property string someValue: myObject ? myObject.someObjectValue : 
  }
 
  but this is just ugly.

 Something is apparently picking up some signal which causes the delegate to
 notice that the value of myObject has changed. What signal is it? Are the
 delegates alive even after rowsAboutToBeRmoved is emitted?


The delegate is alive for a short period after this, it seems. I guess
maybe just another event loop cycle? I didn't investigate it further yet
though.


 It's interesting that you've solved the problem of too many roles by using
 a QObject instance within the model itself. I wonder whether this is
 actually a good path -- QObjects are rather heavyweight, so it is a
 question whether you gain anything by trading the disadvantage of got to
 call the model's data() too many times, once for each role by another
 problem, got to manage expensive QObjects instead of some liteweight
 internal nodes.

 Perhaps it fits the rest of the code and using QObjects inside the model
 makes sense. However, if that was not the case, simply emitting
 dataChanged() when any property changes migth be even easier (and would
 elliminate the need to use properties and separate signals in the first
 place).


The MyObject class is a QObject for various reasons, I have some other
objects of the same type that aren't stored in this list. So it looked like
a decent solution. But I guess it's a bit outside the normal use of the
model/views.

I don't instance that many of them (5-10) so the performance seems decent
enough.

Thanks for the feedback,
Ola
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Set custom fragment shader on a QQuickFramebufferObject-based item?

2013-12-17 Thread Ola Røer Thorsen
Is it possible to set a custom fragment shader (for rendering on screen) on
an item that is inheriting QQuickFramebufferObject? If so, how?

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


Re: [Interest] QOpenGLFramebufferObject, render to FBO using texture from another Image item?

2013-12-13 Thread Ola Røer Thorsen

Thanks Gunnar,

tried that now and it works!

Cheers,
Ola


Den 2013-12-13 12:03, skrev Sletta Gunnar:
Getting the Image element's textureProvider at the time of 
QQuickFrameBufferObject::synchronize should give you a 
QSGTextureProvider for that image, assuming that the Image.status == 
Ready. This is the same mechanism that ShaderEffect uses internally as 
well. You are not supposed to use the item on the render thread. That 
is unsafe and will lead to crashes. The texture provider is the right 
thing.


cheers,
Gunnar



*Fra:* interest-bounces+gunnar.sletta=digia@qt-project.org 
[interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av 
Ola Røer Thorsen [o...@silentwings.no]

*Sendt:* 12. desember 2013 15:34
*To:* interest@qt-project.org
*Emne:* [Interest] QOpenGLFramebufferObject, render to FBO using 
texture from another Image item?


I recently discovered the new way of doing render-to-FBO in Qt 5.2.0. 
It's a major improvement compared with what had to be done previously, 
I think! :-)


However I have run into something tricky as I want to do something 
more advanced:


I need to render some textured geometry into an FBO. The use-case is 
something similar to correcting for lens artifacts in a photograph, 
and the geometry is too advanced for using the Shadereffect items 
(can't use a regular mesh grid).


The texture is loaded from a .jpg file on disk. The image is rather 
large, so I want to use similar mechanisms as used by the Quick2 Image 
item (cache, asynchronous loading, etc).


It's not a good idea to use the internals from qquickimage, so I 
thought of doing something similar to what the Shadereffectsource item 
does, by using the texture created by an Image item. This way, I can 
re-use all the advanced things the Image item does internally for 
loading an image.


I have now got a class inheriting QQuickFramebufferObject. It has a 
sourceItem property, which holds a QQuickItem*. In my QML code, i set 
this to be a Image item.


Image {
   id: rawImage
   source: picture.jpg
   visible: false
   asynchronous: true
   onStatusChanged: {
  (status === Image.Ready) {
 fboRender.updateTexture(); // this calls update(); on the 
item in c++

  }
   }
}

MyFboRenderer {
   id: fboRender
   sourceItem: rawImage
}

In c++, I now need to safely pass the texture eventually found in the 
sourceItem to my QQuickFramebufferObject::Renderer. This has to be 
thread-safe in every way. As the Image and FBO render items in QML are 
to be used in model view delegates, they are created and deleted runtime.


Any hints on how to accomplish this would be very welcome!

Things I've found so far are:
- calling sourceItem()-textureProvider()-texture() from the 
renderer's synchronize function returns 0 even if synchronize was 
triggered as result of an update called when the image has completed 
loading.
- calling the same from the render-function gives a texture valid 
texture, and this sortof works, but there is no obvious safe way of 
accessing sourceItem at this point. I've tried to store a pointer to 
either the source item or the QQuickFramebufferObject, but both of 
these might be deleted/invalid when render() is called and crashes do 
happen.


Cheers
Ola










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


Re: [Interest] Quick2 ListView - set current index to a new item when added

2013-12-12 Thread Ola Røer Thorsen
2013/12/11 Preet prismatic.proj...@gmail.com


 The index is exposed just as 'index' in the delegate itself.


Ah. Thank you! Somehow missed that earlier.



  What's the difference between that one and Component.onCompleted?

 I think Component.onCompleted is run any time something creates the
 component, which might not be what you want if you're using the same
 delegate for multiple views. The exact point at which ListView.onAdd
 is called might also vary and that might be important if you're using
 transition animations when modifying the ListView elements.


Makes sense now :-)


 There are some other ways you can do it too -- using the
 'onCountChanged' handler in the ListView, etc.


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


[Interest] QOpenGLFramebufferObject, render to FBO using texture from another Image item?

2013-12-12 Thread Ola Røer Thorsen
I recently discovered the new way of doing render-to-FBO in Qt 5.2.0. It's
a major improvement compared with what had to be done previously, I think!
:-)

However I have run into something tricky as I want to do something more
advanced:

I need to render some textured geometry into an FBO. The use-case is
something similar to correcting for lens artifacts in a photograph, and the
geometry is too advanced for using the Shadereffect items (can't use a
regular mesh grid).

The texture is loaded from a .jpg file on disk. The image is rather large,
so I want to use similar mechanisms as used by the Quick2 Image item
(cache, asynchronous loading, etc).

It's not a good idea to use the internals from qquickimage, so I thought of
doing something similar to what the Shadereffectsource item does, by using
the texture created by an Image item. This way, I can re-use all the
advanced things the Image item does internally for loading an image.

I have now got a class inheriting QQuickFramebufferObject. It has a
sourceItem property, which holds a QQuickItem*. In my QML code, i set this
to be a Image item.

Image {
   id: rawImage
   source: picture.jpg
   visible: false
   asynchronous: true

   onStatusChanged: {
  (status === Image.Ready) {
 fboRender.updateTexture(); // this calls update(); on the item
in c++
  }
   }
}

MyFboRenderer {
   id: fboRender
   sourceItem: rawImage
}

In c++, I now need to safely pass the texture eventually found in the
sourceItem to my QQuickFramebufferObject::Renderer. This has to be
thread-safe in every way. As the Image and FBO render items in QML are to
be used in model view delegates, they are created and deleted runtime.

Any hints on how to accomplish this would be very welcome!

Things I've found so far are:
- calling sourceItem()-textureProvider()-texture() from the renderer's
synchronize function returns 0 even if synchronize was triggered as
result of an update called when the image has completed loading.
- calling the same from the render-function gives a texture valid texture,
and this sortof works, but there is no obvious safe way of accessing
sourceItem at this point. I've tried to store a pointer to either the
source item or the QQuickFramebufferObject, but both of these might be
deleted/invalid when render() is called and crashes do happen.

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


[Interest] Quick2 ListView - set current index to a new item when added

2013-12-09 Thread Ola Røer Thorsen
Hi all,

I have a ListView showing a c++ model that changes runtime. Items are added
and deleted.

When an item is added, how do I set the ListView's current index to the new
item?

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


[Interest] QuickControls Action shortcut property - more detailed description somewhere?

2013-12-09 Thread Ola Røer Thorsen
Hi all,

the shortcut property on QuickControls Action uses a string. The
documentation on this one is very short: Shortcut bound to the action.
Defaults to the empty string.

Is there a list somewhere describing the string names of all keys and how
to write these as combinations of ctrl, shift, etc.?

Are the key names as strings always the same as in the Qt::Key enum without
the Key_ part?

Is it possible to set up key sequences like those used in QtCreator?
(ctrl-e, ctrl-2 and such) How's the string syntax for those?

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


Re: [Interest] Quick2 ListView - set current index to a new item when added

2013-12-09 Thread Ola Røer Thorsen
2013/12/9 Preet prismatic.proj...@gmail.com



 Have you tried connecting to the onAdd() signal and then calling
 positionViewAtIndex?


 http://doc-snapshot.qt-project.org/qdoc/qml-qtquick-listview.html#positionViewAtIndex-method


I was a bit confused about that one, it has to be done like this, right?
It's an attached signal handler, so..

Component {

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


Re: [Interest] Quick2 ListView - set current index to a new item when added

2013-12-09 Thread Ola Røer Thorsen

 2013/12/9 Preet prismatic.proj...@gmail.com



 Have you tried connecting to the onAdd() signal and then calling
 positionViewAtIndex?


 http://doc-snapshot.qt-project.org/qdoc/qml-qtquick-listview.html#positionViewAtIndex-method


I was a bit confused about that one, it has to be done like this, right?
It's an attached signal handler, so...

Component {
   id: myDelegate
   Item {

  ListView.onAdd: {
 // here it is, but what is the index?
  }
   }
}

If i use that, what's the index to use in positionViewAtIndex?

What's the difference between that one and Component.onCompleted?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Not possible to connect QTcpSocket::error signal the Qt5-way?

2013-11-25 Thread Ola Røer Thorsen
Got it, thanks.

It's unfortunate that there is a method and a signal in QAbstractSocket
witht the same name, but I guess we're stuck with that now.

It's tricky coming up with the correct signature syntax if not having
seen it before. Maybe some example code could be added to this page here,

http://qt-project.org/doc/qt-5.1/qtcore/signalsandslots.html ?


Cheers,

Ola







2013/11/22 Thiago Macieira thiago.macie...@intel.com

 On sexta-feira, 22 de novembro de 2013 16:56:47, Ola Røer Thorsen wrote:
  Is this a bug in Qt, or did I not use the correct syntax? I recon this
 has
  to do with QAbstractSocket having the error() function as well as an
 error
  signal.

 You did not use the correct syntax.

 The compiler told you that the problem was that you did not select one of
 the
 overloads. QTcpSocket::error points to multiple functions and you need to
 select one only.

 To do that, you need to cast the identifier to a specific signature.

 void (QAbstractSocket:: *sig)(QAbstractSocket::SocketError) =
 QAbstractSocket::error;
 connect(tcp_socket, sig, this, MyClass::tcpSocketError);

 --
 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


[Interest] Keyboard navigation issues in Quick2

2013-11-22 Thread Ola Røer Thorsen
Hi all,

here is a case that I find rather limiting and time-consuming. It has to do
with focus scopes and keyboard navigation. I'm looking for a best way to
deal with the following situation:

- I have a ColumnLayout of button-like items, like a popup-menu.
- The first item has focus set to true.
- KeyNavigation.down is used to walk between these to move focus.
- The Items' enabled-value can be set to false if this item is
unavailable for some reason. In this case KeyNavigation works fine and
jumps past the element and on to the next (good).

However if you try to activate focus on the first item (using KeyNavigation
from some other item), and it is disabled, you get no focus at all, and
keyboard navigation is stuck.

I would expect that focus would move on to the next item in the focus
scope, if the item with active focus was disabled.

Also if you disable the item that has focus, focus does not move to the
next item. So you're stuck again.

Why would I disable one of the items? Well if this is a menu, it could be
that one of the menu actions are unavailable for some reason.

Isn't this a bug? It can be worked around with ugly javascript code, but
the fixes are not scalable and you will need calling forceActiveFocus on
items instead.

KeyNavigation seems to be way to create a focus order chain similar to
what you could do with widgets. Or am I wrong?

Below is an example snippet that demonstrate these two issues (tested with
Qt5.2RC1). It has two columns that you can jump between using the cursor
keys. Press the spacebar to disable the upper left box, and see what
happens if focus is on the right, or focus is on left box 1.

Best regards,
Ola


import QtQuick 2.1
import QtQuick.Layouts 1.0

Rectangle {
width: 800
height: 480

Keys.onSpacePressed: {
box1.enabled = !box1.enabled;
}

Text {
anchors.centerIn: parent
text: Use cursor keys to move focus around.\nPush spacebar to
toggle box1 enabled.\n\nNote that it is not possible to go from the right
boxes to\nthe left if box1 is disabled (gray).\nYou'd expect that box2
would get focus if box1 is disabled.\nIt is also possible to get stuck if
box1 is disabled while it has active focus.\n
}

ColumnLayout {
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 200

Rectangle {
focus: true
id: box1
color: enabled ? (activeFocus ? green : orange) : gray
width: 180
height: 30
Text {
anchors.fill: parent
text: box1
}
KeyNavigation.down: box2
KeyNavigation.right: rbox1
}

Rectangle {
focus: true
id: box2
color: enabled ? (activeFocus ? green : orange) : gray
width: 180
height: 30
Text {
anchors.fill: parent
text: box2
}
KeyNavigation.down: box3
KeyNavigation.right: rbox1
}

Rectangle {
focus: true
id: box3
color: enabled ? (activeFocus ? green : orange) : gray
width: 180
height: 30
Text {
anchors.fill: parent
text: box3
}
KeyNavigation.down: box4
KeyNavigation.right: rbox1
}

Rectangle {
focus: true
id: box4
color: enabled ? (activeFocus ? green : orange) : gray
width: 180
height: 30
Text {
anchors.fill: parent
text: box4
}
KeyNavigation.down: box1
KeyNavigation.right: rbox1
}
}
ColumnLayout {
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 200

Rectangle {
focus: true
id: rbox1
color: enabled ? (activeFocus ? green : orange) : gray
width: 180
height: 30
Text {
anchors.fill: parent
text: rightbox1
}
KeyNavigation.down: rbox2
KeyNavigation.left: box1
}
Rectangle {
focus: true
id: rbox2
color: enabled ? (activeFocus ? green : orange) : gray
width: 180
height: 30
Text {
anchors.fill: parent
text: rightbox2
}
KeyNavigation.down: rbox1
KeyNavigation.left: box1
}
}

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


Re: [Interest] Tearing in Quick2 flickable-based items with clipping enabled

2013-11-22 Thread Ola Røer Thorsen
Thanks for the feedback both of you!

VStevenP, yes I've looked at the TI wiki regarding failure modes and
whatnot, and tried setting the paramBufferSize and such. Doesn't seem have
any effect on the tearing. I think they might have some race condition in
the gpu driver or something,

My application is running at 800x480. I knew the SGX wasn't very powerful
before starting coding so I didn't expect too much. Therefore I've actually
been rather happy with the general results. I've done things like
- Make sure to set the background color on the QuickView and NOT fill the
whole screen with a background rectangle the way most example snippets do
- Avoid animating movement of large Items (looks jerky anyway), I just fade
opacity in/out.
- At least in 5.1.1 opacity = 0 is slower than visible = false so I make
sure to set visible = false as often as possible (documentation examples
often say it's enough to do opacity=0)
- Try to avoid clip = true, and never use smooth = true
- Keep javascript logic to an absolute minimum, move as much as possible to
c++ (the arm core isn't the quickest one either).
- Use dynamic creation of larger gui modules on demand, to limit the amount
of active bindings on things that aren't on screen. The annoying bit here
is the waiting pause when the new QML items are compiled on the fly. You
don't notice that on the Desktop, but you sure do on ARM.

Compared with my previous application based on Qt4's widgets that I now
have replaced, the new one uses just a third of the cpu load, with much
smoother and more complex things happening on the screen.

I hope to try 5.2 as soon as possible.

Cheers,
Ola





2013/11/20 VStevenP vstevenpa...@yahoo.com

 Hi Gunnar -

 Thanks for these performance improvement ideas.

 I write QtQuick2 apps.  I'll see if I can use requestedFormat().  (I know
 how to write widgets in C++ and make them available in QML.)

 I rechecked my emails, and it was a Digia rep who made the comment about
 800x600:

 The SGX chip on the BeagleBoard is not really capable of running any
 advanced graphics at a high display resolution, which is why we have set it
 to 800x600 by default. This is the highest resolution with which we are
 comfortable performance wise.

 That said, you are correct - it's not Qt's fault for SGX GPU shortcomings.

 Yes, DM3730 on BB-xM supports CPU frequency scaling.  I don't think I'm
 using frequency scaling in my current configuration, because I am using
 Angstrom 2011.03 from Narcissus Image builder.  I'll get a new package from
 Narcissus which contains cpufrequtils and investigate.  I really hope I can
 document that CPU usage of simple custom QtQuick2-based widgets is
 reasonable on DM3730/BB-xM.

 - VStevenP

 
 On Wed, 11/20/13, Sletta Gunnar gunnar.sle...@digia.com wrote:

  Subject: SV: [Interest] Tearing in Quick2 flickable-based items with
 clipping enabled
  To: vstevenpa...@yahoo.com vstevenpa...@yahoo.com, Ola Røer
 Thorsen o...@silentwings.no, interest@qt-project.org 
 interest@qt-project.org
  Date: Wednesday, November 20, 2013, 1:58 AM

   I find frame rate issues when
  using:
  
   * opacity that is not equal to zero or one
   * rounded rectangles a.k.a Rectangles with specified
  radius property
   * clip property (sometimes)

  The SGX does not do GL_BLEND very well. In fact it does it
  quite badly, so opacity other than 0 an 1 should be avoided
  at all costs on this hardware. Qt Quick will potentially
  make this worse when antialiasing is used on items as the
  antialiasing is implemented by default by using vertex
  opacity and the entire primitive becomes blended, regardless
  of its shape.

  5.2 makes it possible to prefer multisample antialiasing
  over vertex antialiasing by adding
  QSurfaceFormat::setSamples() to
  QQuickWindow::requestedFormat().

  QSurfaceFormat format = window.requestedFormat();
  format.setSamples(4);
  window.setFormat(format);

  This will cause both images and rectangles to use MSAA for
  antialiasing which means that the primitives themselves are
  fully opaque. With the new renderer this is even better as
  opaque primitives can be freely batched with very little
  overhead.

  The same can be acheived in Qt 5.1 by using a customcontext
  from
 https://github.com/qtproject/playground-scenegraph/tree/master/customcontext
  and configuring it with

qmake -config msaa

  That leaves image art. It generally has semi transparent
  areas and opaque areas and for hardware that doesn't do
  blending one ideally wants to split the image into its
  opaque and translucent parts. I started playing around with
  this in the spring here:
 https://github.com/qtproject/playground-scenegraph/tree/master/shapes
  It is working but not product quality at this point, but it
  gives an idea about what can be done.

   The problem is worse especially at higher resolution
  displays
   such as 1280x800.  Evidently, TI recommends to only
  drive a
   somewhat

Re: [Interest] Keyboard navigation issues in Quick2

2013-11-22 Thread Ola Røer Thorsen
Hi Liang,

thanks for the reply! I will create a bug report right away.

Best regards,
Ola




2013/11/22 Liang Qi cavendish...@gmail.com

 Hi, Ola,

 Just got notification about your question from others, and subscribed this
 mailing list.
 http://lists.qt-project.org/pipermail/interest/2013-November/009878.html

 Your question is valid here in some way. I think you could create a bug
 report in jira.

 There is no focus chain concept when Qt Quick 2 was ready at the
 beginning. We tried to support sth like that in this feature,
 QQuickItem::activeFocusOnTab:

 http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-item.html#activeFocusOnTab-prop

 And it doesn't cover the case like your code, KeyNavigation will not work
 when the Item is disabled itself. You need to maintain the focus chain
 yourself in current code. Maybe we could support it in Qt side in the
 future.

 Regards,
 Liang

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


Re: [Interest] Keyboard navigation issues in Quick2

2013-11-22 Thread Ola Røer Thorsen
And here it is: https://bugreports.qt-project.org/browse/QTBUG-35051



2013/11/22 Ola Røer Thorsen o...@silentwings.no

 Hi Liang,

 thanks for the reply! I will create a bug report right away.

 Best regards,
 Ola




 2013/11/22 Liang Qi cavendish...@gmail.com

 Hi, Ola,

 Just got notification about your question from others, and subscribed
 this mailing list.
 http://lists.qt-project.org/pipermail/interest/2013-November/009878.html

 Your question is valid here in some way. I think you could create a bug
 report in jira.

 There is no focus chain concept when Qt Quick 2 was ready at the
 beginning. We tried to support sth like that in this feature,
 QQuickItem::activeFocusOnTab:

 http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-item.html#activeFocusOnTab-prop

 And it doesn't cover the case like your code, KeyNavigation will not work
 when the Item is disabled itself. You need to maintain the focus chain
 yourself in current code. Maybe we could support it in Qt side in the
 future.

 Regards,
 Liang



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


[Interest] Not possible to connect QTcpSocket::error signal the Qt5-way?

2013-11-22 Thread Ola Røer Thorsen
Hi all,

I've started using the new Qt5 way of connecting signals and slots, to
get errors compile-time instead of runtime. Great stuff.

Here is one I struggle to connect. If you have a QTcpSocket, and want to
handle the error signal in a slot called tcpSocketError, a connect like
this:

connect(tcp_socket_, QTcpSocket::error, this, MyClass::tcpSocketError);


fails, the compiler says

error: no matching function for call to 'MyClass::connect(QTcpSocket*,
unresolved overloaded function type, MyClass* const, void
(MyClass::*)(QAbstractSocket::SocketError))'

All the other signals in QTcpSocket connect fine using the same syntax. So
for now I use the old connect for the error signal, and that works fine.

connect(tcp_socket_, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(tcpSocketError(QAbstractSocket::SocketError)));


Is this a bug in Qt, or did I not use the correct syntax? I recon this has
to do with QAbstractSocket having the error() function as well as an error
signal.

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


Re: [Interest] C++ enums undefined in QML

2013-11-15 Thread Ola Røer Thorsen
Did you remember to import your registered type in your qml code? If you
register something like this,

qmlRegisterTypeMyClass(MyClass,1,0,MyClass);

where you have your enums then in qml you need to import that type on the
top of your code,

import MyClass 1.0

Cheers,
Ola




2013/11/14 Guido Seifert warg...@gmx.de

 Hi,
 I have a little problem with my enums in QtQuick 2.

 Im a C++ class I created an enum and used Q_ENUMS to make the enums known
 to the property system.
 I registered my class with qmlRegisterType.
 So far so good. Works. I can invoke methods, which I marked with
 Q_INVOKABLE. Get signals from C++.
 Everythings works as expected. What I don't expect is that all my C++
 enums are 'undefined'.
 The QtCreator completion finds all enum names, so some of the export must
 have worked.
 However, I don't get any values.

 Any ideas?

 Guido
 ___
 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] Tearing in Quick2 flickable-based items with clipping enabled

2013-11-14 Thread Ola Røer Thorsen
Hi again, digging further into this reveals some issues with the PowerVR
SGX530 (Omap3) when using the flip mode. So it's not Qt. Sorry for the
noise.

Seems like it only happens at 60Hz. Will there be an option in 5.2 to set
the swap interval, or did it end up in 5.3? I'd probably go for a steady
30Hz instead of a 30-60 mix with the occasional tearing.

Cheers,
Ola







2013/11/13 Ola Røer Thorsen o...@silentwings.no

 Hi Gunnar, I'll see if I can create a small example that reproduces it.

 Cheers,
 Ola



 2013/11/13 Sletta Gunnar gunnar.sle...@digia.com

  If this consistently reproducible across desktop and device, then I
 would appreciate a bugreport with an example that reproduces it. It is not
 a known issue to me at least. (bugreports.qt-project.org)

  Clipping is implemented using scissor or stencil depending on the
 complexity of the mask, no intermediate texture is involved.

  cheers,
 Gunnar

  --
 *Fra:* 
 interest-bounces+gunnar.sletta=digia@qt-project.org[interest-bounces+gunnar.sletta=
 digia@qt-project.org] på vegne av Ola Røer Thorsen [
 o...@silentwings.no]
 *Sendt:* 13. november 2013 15:29
 *To:* interest@qt-project.org
 *Emne:* [Interest] Tearing in Quick2 flickable-based items with clipping
 enabled

   Hi all,

  I'm seeing tearing-effects when scrolling in ListView and other items
 based on Flickable when clipping is enabled. This is running on both a
 Linux desktop as well as an embedded Linux device (eglfs). The Qt version
 is 5.1.1.

  The systems are running with vsync enabled and double-buffering. There
 is no tearing in any other items except the ones with clipping enabled.
 Tearing is especially noticeable on the embedded device. The GPU is a
 PowerVR SGX chip which is tile-based, so the tearing lines are actually
 vertical. Also the framerate is mostly somewhere between 30-60.

  Tearing appears maybe 20% of the time spent scrolling.

  I'm wondering if the core issue is this:

  I assume clipping is implemented as rendering the item into a temporary
 texture, and the clipped area is of this is finally rendered to the screen
 buffer. This temporary texture is not double-buffered. This means it would
 be possible that the render pipeline starts writing into a texture (next
 frame) that is being drawing into the screen buffer (current frame).

  Any thoughts? The tearing is really bad sometimes, and I don't really
 have the option of disabling clipping either.

  Cheers,
 Ola





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


Re: [Interest] Tearing in Quick2 flickable-based items with clipping enabled

2013-11-13 Thread Ola Røer Thorsen
Hi Gunnar, I'll see if I can create a small example that reproduces it.

Cheers,
Ola



2013/11/13 Sletta Gunnar gunnar.sle...@digia.com

  If this consistently reproducible across desktop and device, then I
 would appreciate a bugreport with an example that reproduces it. It is not
 a known issue to me at least. (bugreports.qt-project.org)

  Clipping is implemented using scissor or stencil depending on the
 complexity of the mask, no intermediate texture is involved.

  cheers,
 Gunnar

  --
 *Fra:* 
 interest-bounces+gunnar.sletta=digia@qt-project.org[interest-bounces+gunnar.sletta=
 digia@qt-project.org] på vegne av Ola Røer Thorsen [o...@silentwings.no
 ]
 *Sendt:* 13. november 2013 15:29
 *To:* interest@qt-project.org
 *Emne:* [Interest] Tearing in Quick2 flickable-based items with clipping
 enabled

   Hi all,

  I'm seeing tearing-effects when scrolling in ListView and other items
 based on Flickable when clipping is enabled. This is running on both a
 Linux desktop as well as an embedded Linux device (eglfs). The Qt version
 is 5.1.1.

  The systems are running with vsync enabled and double-buffering. There
 is no tearing in any other items except the ones with clipping enabled.
 Tearing is especially noticeable on the embedded device. The GPU is a
 PowerVR SGX chip which is tile-based, so the tearing lines are actually
 vertical. Also the framerate is mostly somewhere between 30-60.

  Tearing appears maybe 20% of the time spent scrolling.

  I'm wondering if the core issue is this:

  I assume clipping is implemented as rendering the item into a temporary
 texture, and the clipped area is of this is finally rendered to the screen
 buffer. This temporary texture is not double-buffered. This means it would
 be possible that the render pipeline starts writing into a texture (next
 frame) that is being drawing into the screen buffer (current frame).

  Any thoughts? The tearing is really bad sometimes, and I don't really
 have the option of disabling clipping either.

  Cheers,
 Ola




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


Re: [Interest] Quick2 ShaderEffect: source or provider missing when binding textures

2013-11-08 Thread Ola Røer Thorsen
Hi Gunnar,

thanks for the reply!

Well why am I drawing without data.. There's lots of things to learn to get
the most out of Quick2. :-)

Your suggestion there solved it for me, i'm testing on Image.Ready now
and it also fixed my next issue of to prevent showing black textures before
the image was loaded. The message is gone from the log too :-)

Best regards,
Ola



2013/11/7 Sletta Gunnar gunnar.sle...@digia.com

  The error message has been quite helpful with tracking down errors in
 the past, but I guess we can at least remove it from release builds and
 limit it a bit :) Added
 https://bugreports.qt-project.org/browse/QTBUG-34676 to track this.

  But why are you showing ShaderEffects which lack their image data? That
 is just wasting GPU resources

  ShaderEffect {
 property variant source;
 visible: typeof source != 'undefined'  source.status == Ready
 ...
 }

  Should keep it hidden and also remove the warning...

  cheers,
 Gunnar

  --
 *Fra:* 
 interest-bounces+gunnar.sletta=digia@qt-project.org[interest-bounces+gunnar.sletta=
 digia@qt-project.org] på vegne av Ola Røer Thorsen [o...@silentwings.no
 ]
 *Sendt:* 7. november 2013 16:43
 *To:* interest@qt-project.org
 *Emne:* [Interest] Quick2 ShaderEffect: source or provider missing when
 binding textures

   Hi all,

  if I use a ShaderEffect on an image that is loaded asynchronously, I get
 the error/debug message on the console:

  ShaderEffect: source or provider missing when binding textures

  for every frame rendered until the image is completely loaded and the
 texture is complete.

  This means our system logs on the target system (embedded linux device)
 gets flooded whenever we load new images (a photo viewer). Would it be
 possible to at least limit the number of times this is written (once
 instead of every frame)? Or could the message be removed completely? It's
 not useful at all when ShaderEffect is used this way.

  Best regards,
 Ola


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


[Interest] Quick2 ShaderEffect: source or provider missing when binding textures

2013-11-07 Thread Ola Røer Thorsen
Hi all,

if I use a ShaderEffect on an image that is loaded asynchronously, I get
the error/debug message on the console:

ShaderEffect: source or provider missing when binding textures

for every frame rendered until the image is completely loaded and the
texture is complete.

This means our system logs on the target system (embedded linux device)
gets flooded whenever we load new images (a photo viewer). Would it be
possible to at least limit the number of times this is written (once
instead of every frame)? Or could the message be removed completely? It's
not useful at all when ShaderEffect is used this way.

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


[Interest] use custom fragment shader for Quick2 Image item

2013-10-22 Thread Ola Røer Thorsen
Hi all,

I want to use a custom fragment shader when rendering a Image item. Is it
possible to set the shader to use directly somehow? That is, I want to use
a custom shader instead of the passthrough fragment shader used in the
Image element.

I have tried using the QtGraphicalEffects (GammaAdjust), but the
performance is not good enough on my target platform (Omap 3530).
ShaderEffect elements work, but they also seem to render via another
render-texture, again with a performance loss.

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


Re: [Interest] use custom fragment shader for Quick2 Image item

2013-10-22 Thread Ola Røer Thorsen
Hi Sean, thanks for the reply! Yes I think I'll have to go for the second
option there, writing my own CustomImage based on the original Image source
code.

I'll post a feature request on the bug tracker, let's see what happens.

By the way, I browsed a bit through the Qt source tree for glsl shaders
(version 5.1.1). Seems like nearly every shader is only using the highp
precision setting for uniforms etc. In my experience on these low-end
mobile GPUs, highp is very slow. Texture coordinates can mostly be mediump,
and color calculations can be lowp most times (sometimes with extra care of
the order of multiplications etc, to stay within [-2,2]. Maybe this is
something that can be looked into for future performance optimizations.












2013/10/22 Sean Harmer s...@theharmers.co.uk

  The shader code is hard-wired into the relevant material in the
 qtdeclarative module and there is no way to replace it at present (that I
 know of) apart from altering the source and building a customised version.
 Maybe Gunnar knows of way?

 Another option would be to write yourself a custom material using the SG
 API and assigning that to a specialised CustomImage item.

 I agree that in some cases such a feature would indeed be useful to avoid
 having to do this.

 Cheers,

 Sean


 On 22/10/2013 14:20, Ola Røer Thorsen wrote:

 Hi all,

  I want to use a custom fragment shader when rendering a Image item. Is
 it possible to set the shader to use directly somehow? That is, I want to
 use a custom shader instead of the passthrough fragment shader used in
 the Image element.

  I have tried using the QtGraphicalEffects (GammaAdjust), but the
 performance is not good enough on my target platform (Omap 3530).
 ShaderEffect elements work, but they also seem to render via another
 render-texture, again with a performance loss.

  Best regards,
 Ola



 ___
 Interest mailing 
 listInterest@qt-project.orghttp://lists.qt-project.org/mailman/listinfo/interest



 ___
 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] Fwd: QT Quick Controls - Menu

2013-10-11 Thread Ola Røer Thorsen
 I agree that the documentation is slightly misleading. There is private
 API to position the menu at any position, but for the moment it’s still…
 private. We may make it public in a way or another if we see demand for
 that.

  BTW, what is your exact use case?


There is definitely a need for positioning the menu at a given position.
Just imagine target hardware without mouse (keyboard only).

I am developing for such a device (only cursor keys + return button), and
had to implement my own menu system instead of using Quick Controls Menu.

A second reason not to use Menu in this case the current lack of styling
options. So it would be really great to have popup with a position argument
+ styling :-)
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Custom Quick view to visualize a List-model of points on a map

2013-09-29 Thread Ola Røer Thorsen
Ah! Thank you, exactly what I was looking for! 

Best regards,
Ola

(Sendt fra mobiltelefon)

 Den 28. sep. 2013 kl. 16:47 skrev Дмитрий Козлов gni...@mail.ru:
 
 27.09.2013 17:22, Ola Røer Thorsen   пишет:
 Hi,
 
 I have a c++ list model that inherits QAbstractListModel. It contains a list 
 of waypoints that amongst other things have x,y screen coordinates. Points 
 are added, removed and values are changed runtime. 
 
 I want to visualize these in Quick2 on top of a map image. I need to create 
 Quick Items mapped to the items in the list model, bind properties, and 
 remove the items when they are removed from the list. Similar to a ListView, 
 just more for displaying something on a map. Any hints on how to do this? 
 
 
 
 
 You can add itemX, itemY roles to C++ list model items and then use them 
 in QtQuick Repeater's delegate.
 Something like this:
 
 Image {
   id: map
 }
 
 Repeater {
   anchors.fill: map
   model: myModel
   delegate: Rectangle {
 x: itemX
 y: itemY
 
   }
 }
 
 ___
 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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Custom Quick view to visualize a List-model of points on a map

2013-09-27 Thread Ola Røer Thorsen
Hi,

I have a c++ list model that inherits QAbstractListModel. It contains a
list of waypoints that amongst other things have x,y screen coordinates.
Points are added, removed and values are changed runtime.

I want to visualize these in Quick2 on top of a map image. I need to create
Quick Items mapped to the items in the list model, bind properties, and
remove the items when they are removed from the list. Similar to a
ListView, just more for displaying something on a map. Any hints on how to
do this?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Keyboard navigation in QtQuick.Controls ScrollView?

2013-09-25 Thread Ola Røer Thorsen
Hi Jens,

thanks for the explanation! Setting interactive to true solved for me (the
target platform has no mouse or touch anyway).

Best regards,
Ola



2013/9/25 Bache-Wiig Jens jens.bache-w...@digia.com


  On Sep 24, 2013, at 9:53 AM, Ola Røer Thorsen o...@silentwings.no wrote:

  Hi,

  I can't seem to get keyboard navigation working when I embed a ListView
 in a ScrollView

  ScrollView {
ListView {
   ...
}
 }

  just like in the documentation. I've tried enabling focus on both, or
 just one, and so on. Keyboard navigation works fine on the ListView when
 used without the ScrollView. Any hints on how to make this work?


  The issue is that the ScrollView intentionally sets the interactive flag
 to false on the ListView in order to disable flicking as that is not what
 you would expect when scroll bars are available.

  However, due to pending 
 QTBUG-17051https://bugreports.qt-project.org/browse/QTBUG-17051 this
 will also disable the built-in keyboard navigation.

  There are three possible work arounds to this issue though. One is to
 explicitly set flickableItem.interactive:true on the the ScrollView, which
 would re-enable _both_ flicking and keyboard. The other is to handle the
 interaction yourself by connecting Keys.onUpPressed to list
 view.decrementCurrentIndex() etc. The third is to use TableView instead of
 ListView that should already have keyboard interaction available.

  Regards,
 Jens



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


[Interest] Keyboard navigation in QtQuick.Controls ScrollView?

2013-09-24 Thread Ola Røer Thorsen
Hi,

I can't seem to get keyboard navigation working when I embed a ListView in
a ScrollView

ScrollView {
   ListView {
  ...
   }
}

just like in the documentation. I've tried enabling focus on both, or just
one, and so on. Keyboard navigation works fine on the ListView when used
without the ScrollView. Any hints on how to make this work?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Generate key press events in c++ for a Quick2-application?

2013-08-30 Thread Ola Røer Thorsen
I need to generate key press events in c++ (based on packets received 
via udp), so that these behave like regular key presses in a 
Quick2-based application. The target platform has a rather specialized 
non-standard keyboard.

I have found some examples on how to do this with widgets, but these 
don't seem to work with Quick2.

Is this possible at all? Does any of you know how to do it?

Thanks!


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


Re: [Interest] Generate key press events in c++ for a Quick2-application?

2013-08-30 Thread Ola Røer Thorsen

Brilliant, it works, thanks :-)


Den 2013-08-30 14:24, skrev Tomasz Olszak:
2013/8/30 Ola Røer Thorsen o...@silentwings.no 
mailto:o...@silentwings.no


I need to generate key press events in c++ (based on packets received
via udp), so that these behave like regular key presses in a
Quick2-based application. The target platform has a rather specialized
non-standard keyboard.

I have found some examples on how to do this with widgets, but these
don't seem to work with Quick2.

Is this possible at all? Does any of you know how to do it?

Thanks!


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


See for example:
https://qt.gitorious.org/qt/qtquickcontrols/source/c304d741a27b5822a35d1fb83f8f5e65719907ce:tests/auto/applicationwindow/tst_applicationwindow.cpp

--
regards / pozdrawiam, Tomasz Olszak
Qt for Tizen | http://qt-project.org/wiki/Tizen
Qt Certified Developer | http://qt-project.org http://qt-project.org/
http://linkedin.com/in/tolszak


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


Re: [Interest] Quick Controls Menu questions

2013-08-26 Thread Ola Røer Thorsen
Hi Gabriel,

thanks for the answers! I will be looking forward to 5.2 then.

I am not able to navigate the menus using the keybard at all, I tried 
both the MenuBar as well as a popup menu. I'll create an issue on the 
bugtracker. (Action shortcuts work fine though.)

Best regards,
Ola


Den 2013-08-23 16:10, skrev deDietrich Gabriel:
 Hi,

 On Aug 23, 2013, at 9:49 AM, Ola Røer Thorsen o...@silentwings.no wrote:

 - Is it possible to do complete styling of the Menu? There is some
 things in the source code it seems, but it's not documented. Maybe more
 features are planned in Qt 5.2?
 We plan to extend the set of styleable controls for 5.2, including menus.

 - Will the menu be drawn as a Item in the Quick2 scene on embedded Linux
 instead of using the window system's menu (like it does on Windows?).
 Yes. This is scheduled for 5.2 as part of supporting mobile environments.

 - Is keyboard navigation possible with the Menu? I can't seem to get it
 working on Windows, it will only follow the mouse.
 It should work. If it doesn’t with a recent version of Qt then report a bug 
 and assign it to me.

 - Is there a way to set the position when using the popup() function?
 (as there is no mouse)
 It’s currently private API, but we plan on making this more visible.

 - Is it possible to mix Widget-based menus on top of a Quick2 window
 using QtWayland? If so I can create the menus with QMenu instead.

 I can’t answer that. Other people may know better about wayland integration.

 Best regards,

 Dr. Gabriel de Dietrich
 Senior Software Developer
 qt.digia.com


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


[Interest] Quick Controls Menu questions

2013-08-23 Thread Ola Røer Thorsen
Hi,

I'm planning a Quick2-based application that will run on an embedded 
Linux device (similar to Raspberry PI) where the application is the only 
user of the framebuffer (no X11). The application will be controlled by 
keyboard cursor keys only. I have been doing some mockups on the desktop 
with the Quick Controls Menu items, but there seems to be some limitations:

- Is it possible to do complete styling of the Menu? There is some 
things in the source code it seems, but it's not documented. Maybe more 
features are planned in Qt 5.2?
- Will the menu be drawn as a Item in the Quick2 scene on embedded Linux 
instead of using the window system's menu (like it does on Windows?).
- Is keyboard navigation possible with the Menu? I can't seem to get it 
working on Windows, it will only follow the mouse.
- Is there a way to set the position when using the popup() function? 
(as there is no mouse)
- Is it possible to mix Widget-based menus on top of a Quick2 window 
using QtWayland? If so I can create the menus with QMenu instead.

Thanks!




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


Re: [Interest] Quick2 - animate sorting of listview, sorted with QSortFilerProxyModel

2013-08-16 Thread Ola Røer Thorsen
Hi again, thanks for all the replies!

Nils, thanks for pointing out the beginMoveRows functions and the sample
code. So the limitation isn't ListView at all, it's just the
QSortFilterProxyModel.

I can confirm that using this method the animations do work, as I've now
implemented my own sorting and filtering.

It would be great if QSortFilterProxyModel could handle this as well some
time in the future, that class is really convenient to use.





2013/8/15 André Somers an...@familiesomers.nl

 Op 14-8-2013 16:50, Nils Jeisecke schreef:
  Hi,
 
  On Wed, Aug 14, 2013 at 4:41 PM, André Somers an...@familiesomers.nl
 wrote:
  I think the root of the problem is that QAbstractItemModel does not have
  a concept of moving items, while the native QML model does.
  There's beginMoveRows and endMoveRows since 4.6. This also enables
  move animations in the Qml item views.
 
  Nils
 Oops! You're completely right. Sorry about that!

 André

 --
 You like Qt?
 I am looking for collegues to join me at i-Optics!

 ___
 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] QAbstractVideoSurface::present - videoframe start/endtime always -1 on windows

2013-06-13 Thread Ola Røer Thorsen
Hi,

I've created a custom video player using QMultimedia, that plays back 
certain video files that are to be post-processed frame-by-frame. The 
post-process depends on each video frame's start time. I'm using the Qt 
5.1 beta release (I use the new desktop QML features).

I've created a video surface class that inherits QAbstractVideoSurface, 
register this in QMediaplayer, and I get each frame in my own 
implementation of QAbstractVideoSurface::present.

On Linux, this works flawlessly, each QVideoFrame have proper values for 
QVideoFrame::startTime() and endTime(). However on windows, start- and 
endtimes are always -1 (invalid).

I try now to look up the current position in the mediaplayer each time 
present is called, but this is not really precise enough. Anyone know 
how to make this work? I've tried various video file formats but they 
all give the same -1 values.

Maybe there is a bug in the windows backend (WMF?). I tried looking into 
the source code - at first glance it looks allright (mftvideo.cpp at 
line 638), but while googling further into it I found this page here,
http://msdn.microsoft.com/en-us/library/windows/desktop/bb530107(v=vs.85).aspx 
http://msdn.microsoft.com/en-us/library/windows/desktop/bb530107%28v=vs.85%29.aspx
where further calculations are needed as the sample times are relative 
to a presentation clock, so maybe it can't work like it's implemented 
now?

Best regards
Ola


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