Re: [Interest] Overriding list properties in QML at initialisation

2019-08-14 Thread Unai IRIGOYEN
Ulf,
I reported the bug here: https://bugreports.qt.io/browse/QTBUG-77529

I will try to propose a fix which has no side effect on Qt3D.

Best regards,

Unai

Le mer. 14 août 2019 à 11:25, Ulf Hermann  a écrit :

> Hello,
>
> > If I create a class with a QQmlListProperty and then initialise it with
> > an array in some QML file, then subclass the QML type in a second QML
> > file and try to override the array there, when creating an instance of
> > the child class, the list contains the arrays concatenated instead of
> > the overriding array.
>
> That's the expected behavior of the default property, e.g. children in
> QQuickItem. Arguably, it should not extend to explicitly setting any
> other list properties.
>
> > In the following example, I would expect the list to contain 2 elements
> > instead of 5. What are your thoughts? Should I fill a bug report and try
> > to provide a fix?
>
> Yes, that would be nice. Keep in mind that the default property should
> still behave the old way, but only if you actually use it as default
> property. The details can be discussed in the report, though.
>
> best regards,
> Ulf
> ___
> 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] Overriding list properties in QML at initialisation

2019-08-14 Thread Unai IRIGOYEN
Hi Giuseppe,
When you say the QML APIs for Qt3D depend on this behaviour, you are
talking about appending to the default property right? Or are the APIs
depending in the fact that every QQmlListProperty has its contents
concatenated (I can't recall an example where this could be used)?

Best regards,

Unai

Le mer. 14 août 2019 à 18:23, Giuseppe D'Angelo via Interest <
interest@qt-project.org> a écrit :

> Il 14/08/19 11:23, Ulf Hermann ha scritto:
> >> In the following example, I would expect the list to contain 2 elements
> >> instead of 5. What are your thoughts? Should I fill a bug report and try
> >> to provide a fix?
> > Yes, that would be nice. Keep in mind that the default property should
> > still behave the old way, but only if you actually use it as default
> > property. The details can be discussed in the report, though.
>
> This behaviour cannot be changed in a source-compatible way, so it's a
> no-go, unless we also add additional C++/QML syntax for opting in to the
> new behaviour. E.g. the QML APIs for Qt3D massively depend on this.
>
> My 2 c,
> --
> Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
> KDAB - The Qt, C++ and OpenGL Experts
>
> ___
> 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


[Interest] Overriding list properties in QML at initialisation

2019-08-13 Thread Unai IRIGOYEN
Hello,
I'm using QML for some years now but recently I have found a behaviour
which may be a bug or at least makes list property initialisation
inconsistent with the way other types are handled.
The behaviour can be traced back to (at least) Qt 5.2 and is still present
in Qt 5.13.
If I create a class with a QQmlListProperty and then initialise it with an
array in some QML file, then subclass the QML type in a second QML file and
try to override the array there, when creating an instance of the child
class, the list contains the arrays concatenated instead of the overriding
array.
In the following example, I would expect the list to contain 2 elements
instead of 5. What are your thoughts? Should I fill a bug report and try to
provide a fix?

Best regards,

Unai Irigoyen

Example:
// containedtype.h //

#ifndef CONTAINEDTYPE_H

#define CONTAINEDTYPE_H

#include 

class ContainedType : public QObject

{

   Q_OBJECT

};

#endif // CONTAINEDTYPE_H

// mytype.h //

#ifndef MYTYPE_H

#define MYTYPE_H

#include 

#include 

#include "containedtype.h"


class MyType : public QObject

{

   Q_OBJECT

   Q_PROPERTY(QQmlListProperty myList READ myList)


   QQmlListProperty myList(){

  return QQmlListProperty(this, 0,

   _list_append,

   _list_count,

   _list_at,

   _list_clear);

   }


   private:

   QList m_myList;


   static inline void my_list_append(QQmlListProperty *
property,ContainedType * value)

   {

  MyType * instance = qobject_cast(property->object);

  if(instance)

  {

 instance->m_myList.append(value);

  }

   }

   static inline int my_list_count(QQmlListProperty * property)

   {

  MyType * instance = qobject_cast(property->object);

  if(instance)

  {

 return instance->m_myList.count();

  }

  else

  {

 return 0;

  }

   }

   static inline ContainedType *
my_list_at(QQmlListProperty * property, int index)

   {

  MyType * instance = qobject_cast(property->object);

  if(instance)

  {

 return instance->m_myList.at(index);

  }

  else

  {

 return nullptr;

  }

   }

   static inline void my_list_clear(QQmlListProperty * property)

   {

  MyType * instance = qobject_cast(property->object);

  if(instance)

  {

 instance->m_myList.clear();

  }

   }

};

#endif // MYTYPE_H

// main.cpp //

#include 

#include 

#include "mytype.h"


int main(int argc, char *argv[])

{

   QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);


   QGuiApplication app(argc, argv);


   qmlRegisterType("array.override.test", 1, 0, "ContainedType");

   qmlRegisterType("array.override.test", 1, 0, "MyType");


   QQmlApplicationEngine engine;

   const QUrl url(QStringLiteral("qrc:/main.qml"));

   QObject::connect(, ::objectCreated,

, [url](QObject *obj, const QUrl ) {

   if (!obj && url == objUrl)

  QCoreApplication::exit(-1);

}, Qt::QueuedConnection);

   engine.load(url);


   return app.exec();

}


// BaseType.qml //

import array.override.test 1.0

MyType {

myList: [

ContainedType{},

ContainedType{},

ContainedType{}

]

}


// OverridenType.qml //

import array.override.test 1.0

BaseType {

myList: [

ContainedType{},

ContainedType{}

]

}

// main.qml //

import array.override.test 1.0

OverridenType {

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


[Interest] Qt3D SceneLoader and TechniqueFilter

2016-02-23 Thread Unai IRIGOYEN
Hi,
I import some objects into my scene via qgltf tool from project file and they 
are correctly rendered with Qt3D native materials (-S option) into the scene.
Now, I want to add a technique to the default material effect to alter visual 
appearance of the objects without defining a whole new material (keeping 
default material parameters intact and just inject more parameters and change 
shaders).
For this I recursively add a technique to the material effect of each entity of 
the loaded objects. However, the renderer (altered forward renderer) keeps 
using the default material despite the annotation I set on the technique 
(renderingStyle: myforward) and the TechniqueFilter I put on the framegraph 
matching the annotation. If instead of adding the technique I replace the 
previous ones by removing them prior to addition, the right technique is used 
but I lose the ability to filter to the previous technique.

Now my questions are: 
How does TechniqueFilter process annotations in order to get the right one? 
What am I doing wrong?
In case of multiple annotations in TechniqueFilter, do it have to match all 
annotations or one of the provided ones?
In case of multiple annotations on Technique, does the TechniqueFilter have to 
match one of them or all of them?

As a side note, RenderPassFilter seems to filter properly, at least with a 
single annotation.

Thank you for your help.
-- 


Unai IRIGOYEN

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


Re: [Interest] What about this simple QML is broken?

2015-06-10 Thread Unai IRIGOYEN
Le mercredi 10 juin 2015 23:01:33, Jason H a écrit :
 Ah, true. That was something I added in to test the width of the text.
 But that doesn't explain why the text is not centered in it's parent, aka
 something. At the level of the Text, parent and something should be
 equal, and both should work. 

If you look closely at the documentation of Window and QuickWindow, you will 
notice 
that at the level of text parent equals something.contentItem.
This contentItem property holds the invisible Item to which all Window child 
items are 
appended.

  
 Sent: Wednesday, June 10, 2015 at 4:52 PM
 From: Jérôme Godbout jer...@bodycad.com
 To: Jason H jh...@gmx.com
 Cc: interest@qt-project.org interest@qt-project.org
 Subject: Re: [Interest] What about this simple QML is broken?
 The Rectangle is not a direct parent or sibling of id something, there's
 Text in between. 
 On Wed, Jun 10, 2015 at 4:48 PM, Jason H jh...@gmx.com wrote:
 I sat down today to teach someone QML and it didn't work as expected. I'm on
 Linux usually, this person was on Windows 8, using a 32 bit Mingw. I'm
 pretty confident in my QML abilities, now with mobile apps on both App
 stores, and many other utilities not published.
 
 At issue is the simple property of using ids. When using parent, it works,
 but anything using the id (something in this example) fails. We tried
 ApplicationWindow, Window, Rectangle as the root element. When using the
 Window, we get Unable to assign QQuickWindowQmlImpl to QQuickItem. In all
 other root elements it fails silently.
 
 Am I losing my mind? Code below -
 
 import QtQuick 2.4
 import QtQuick.Controls 1.3
 import QtQuick.Window 2.2
 import QtQuick.Dialogs 1.2
 
 Window {
   id: something
   width: 500;
   height: 200
   color: lightgray
   visible: true
 
   Text {
   id: helloText
   text: Hello world!
   y: 30
   anchors.horizontalCenter: something.horizontalCenter // won't be
 horizontally centered unless parent font.pointSize: 24;
   font.bold: true
   Rectangle{
   anchors.fill:something // won't appeat unless parent
   color:red
 
   }
   }
 }
 
 -
 Starting
 C:\Projects\build-Tutorial-Desktop_Qt_5_4_1_MinGW_32bit-Debug\debug\Tutoria
 l.exe...
 
 QML debugging is enabled. Only use this in a safe environment.
 
 qrc:/main.qml:21:26: Unable to assign QQuickWindowQmlImpl to QQuickItem
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
-- 


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


[Interest] Entity sub-tree opacity in Quick3D 2.0

2015-03-31 Thread Unai IRIGOYEN
Hi,
I have been playing with the upcoming Qt3D those days and especially the QML 
APIs.
I was wondering if there is a means of changing the opacity of an entity and 
all children at the same time (same behavior as in QtQuick). At the moment I 
must change the opacity in the material color of each entity in the tree which 
results in verbose code. I have been trying to see if I can apply an effect to 
the sub-tree using alpha composition or shaders but I'm out of luck.

As a side note, I'm also interested in particles for Qt3D. I understand it's 
not priority number 1 but just take this as a vote for the feature.

Best regards.
-- 


Unai IRIGOYEN

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


Re: [Interest] custom qtquick c++ component text rendering

2014-02-19 Thread Unai IRIGOYEN
Hi,
You can use QQuickItem::polish() and QQuickItem::updatePolish() to instantiate 
and maintain QML Text elements. That's the way I do and it works pretty well.

Best regards.

-- 


Unai IRIGOYEN

Le mercredi 19 février 2014 21:51:06, Railway Coder a écrit :
 Hello,
 
 I've made my own QtQuick component by sub classing QtQuickItem.
 Rendering lines, rectangles and so on with QSGNode works fine.
 
 Now, I want to add some text rendering. I don't want to use qpainteditem
 for that.
 I think there must be a new QSG related way to do this.
 
 Any ideas? I've searched the documentation of Qt5.2 without luck.
 
 Thanks and Best Regards,
 railwaycoder
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt Installer Framework

2013-06-18 Thread Unai IRIGOYEN
Hi,
 So I created an installer using Qt installer framework and it runs on my PC.
 So I copied it to a USB stick to install on a different PC but when I run it 
 I get an error dialog stating that it is not a valid win32 application.
 If I run the installer from the USB stick on my PC I get the same error 
 Does anyone know the reason for this?
 Is your machine 64bit? Did you build for 64bit and try to run on 32bit?
 TIA
  
Best regards.

Unai IRIGOYEN


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


Re: [Interest] Qt5.1+, custom QQuickItem with text, not using QPainter?

2013-05-20 Thread Unai IRIGOYEN
Hello,

I'm also interested in using text in custom QQuickItem derived classes (text is 
only a part of the whole item view).
As both tasks metioned are marked as merged, what is the new status of text in 
custom QQuickItem derived classes? Is there already a doc explaining the 
process of adding text in scenegraph?

Regards.

-- 

Unai IRIGOYEN


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