Discussion:
QtQuick2 considerations
Adriano Rezende
2011-09-27 17:46:32 UTC
Permalink
Hi,

I didn't have time to play with QtQuick2 yet, but looking at the code
I think there are some points that should be reconsidered.

1. Naming conventions

QtQuick2 items adopts an abbreviation 'SG' to prefix their class
names, like QSGItem. Since SG is not a well know acronym, wouldn't be
better to have a more descriptive name without abbreviating? Like,
QQuickItem, QSceneItem or even QSceneGraphItem?

2. Multiple inheritance

Do we still need to have QDeclarativeParserStatus as a separate class?
For QtQuick1 I understand that was necessary, since the base class was
a QGraphicsItem; but for QtQuick2 the base class already inherits from
QObject. So in order to avoid multiple inheritance, which generally
it's a good thing, QSGItem could inherit from QSGObject (a new class)
which could already provide virtual methods to handle the parsing
phase. That would give us a flat hierarchical tree, providing all the
benefits/optimizations of not using multiple inheritance.

3. Loader component

I don't know if that was fixed in QtQuick2, but since QPixmap was
replaced by QImage, I think the Loader component can now implement
real async loading. In QtQuick1, the async operations is somewhat
fake, since it just handles the progress of the file transfer; the
item is still loaded in the main thread freezing the UI when loading
big components. This feature is done or addressed for QtQuick2?

4. Code duplication

QtQuick2 project seems like a fork of QtQuick1, just adding new
classes on top of it. It's basically duplicating some QtQuick1
classes, without placing them in a common path. That was intentional?
How contributions will be handled when a patch is landed for QtQuick1,
but it's also should be applied in QtQuick2?


Br,
Adriano
a***@nokia.com
2011-09-28 02:49:45 UTC
Permalink
Hi,
Post by Adriano Rezende
Hi,
I didn't have time to play with QtQuick2 yet, but looking at the code
I think there are some points that should be reconsidered.
1. Naming conventions
QtQuick2 items adopts an abbreviation 'SG' to prefix their class
names, like QSGItem. Since SG is not a well know acronym, wouldn't be
better to have a more descriptive name without abbreviating? Like,
QQuickItem, QSceneItem or even QSceneGraphItem?
"SG" is a placeholder. The plan is to rename QSGItem to QQuickItem.
Post by Adriano Rezende
2. Multiple inheritance
Do we still need to have QDeclarativeParserStatus as a separate class?
For QtQuick1 I understand that was necessary, since the base class was
a QGraphicsItem; but for QtQuick2 the base class already inherits from
QObject. So in order to avoid multiple inheritance, which generally
it's a good thing, QSGItem could inherit from QSGObject (a new class)
which could already provide virtual methods to handle the parsing
phase. That would give us a flat hierarchical tree, providing all the
benefits/optimizations of not using multiple inheritance.
What are the "benefits" of not using multiple inheritance (of an interface)?
Post by Adriano Rezende
3. Loader component
I don't know if that was fixed in QtQuick2, but since QPixmap was
replaced by QImage, I think the Loader component can now implement
real async loading. In QtQuick1, the async operations is somewhat
fake, since it just handles the progress of the file transfer; the
item is still loaded in the main thread freezing the UI when loading
big components. This feature is done or addressed for QtQuick2?
If only it were as simple as not using QPixmap ;) Still, we are attempting to accomplish the same thing with QTBUG-21151.
Post by Adriano Rezende
4. Code duplication
QtQuick2 project seems like a fork of QtQuick1, just adding new
classes on top of it. It's basically duplicating some QtQuick1
classes, without placing them in a common path. That was intentional?
How contributions will be handled when a patch is landed for QtQuick1,
but it's also should be applied in QtQuick2?
QtQuick1 is "Done". To maintain compatibility we will probably not accept non-crash related fixes for it.

Cheers,

Aaron
Thiago Macieira
2011-09-28 08:50:01 UTC
Permalink
Post by a***@nokia.com
Post by Adriano Rezende
2. Multiple inheritance
Do we still need to have QDeclarativeParserStatus as a separate class?
For QtQuick1 I understand that was necessary, since the base class was
a QGraphicsItem; but for QtQuick2 the base class already inherits from
QObject. So in order to avoid multiple inheritance, which generally
it's a good thing, QSGItem could inherit from QSGObject (a new class)
which could already provide virtual methods to handle the parsing
phase. That would give us a flat hierarchical tree, providing all the
benefits/optimizations of not using multiple inheritance.
What are the "benefits" of not using multiple inheritance (of an interface)?
It only makes sense if you have or plan on having another class which also
inherits from this interface. Like QPaintDevice, which is implemented by
QWidget, QImage, QPixmap and QPrinter. If you only have one class, it
increases the virtual table size and code size, since the compiler needs to
emit thunk functions for no good reason.

Runtime impact should be minimal to negligible though, unless you start using
virtual inheritance.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
Adriano Rezende
2011-09-28 14:37:35 UTC
Permalink
Hi,
Post by Adriano Rezende
1. Naming conventions
QtQuick2 items adopts an abbreviation 'SG' to prefix their class
names, like QSGItem. Since SG is not a well know acronym, wouldn't be
better to have a more descriptive name without abbreviating? Like,
QQuickItem, QSceneItem or even QSceneGraphItem?
"SG" is a placeholder.  The plan is to rename QSGItem to QQuickItem.
Sorry, I thought that name would be the final one. QQuickItem seems much nicer.
Post by Adriano Rezende
2. Multiple inheritance
Do we still need to have QDeclarativeParserStatus as a separate class?
For QtQuick1 I understand that was necessary, since the base class was
a QGraphicsItem; but for QtQuick2 the base class already inherits from
QObject. So in order to avoid multiple inheritance, which generally
it's a good thing, QSGItem could inherit from QSGObject (a new class)
which could already provide virtual methods to handle the parsing
phase. That would give us a flat hierarchical tree, providing all the
benefits/optimizations of not using multiple inheritance.
What are the "benefits" of not using multiple inheritance (of an interface)?
As Thiago said, it just worth it when we have two different classes
using it as mixin.
I can only see one advantage of using it in this way, which is to be
used by other QObject-derived classes, which actually makes sense
regarding code reusage, but I don't know if it worth it.
Post by Adriano Rezende
3. Loader component
I don't know if that was fixed in QtQuick2, but since QPixmap was
replaced by QImage, I think the Loader component can now implement
real async loading. In QtQuick1, the async operations is somewhat
fake, since it just handles the progress of the file transfer; the
item is still loaded in the main thread freezing the UI when loading
big components. This feature is done or addressed for QtQuick2?
If only it were as simple as not using QPixmap ;)  Still, we are attempting to accomplish the same thing with QTBUG-21151.
I don't know all the blocking issues, but QPixmap was a big one :).
But it's good to know that it's been addressed.
Post by Adriano Rezende
4.  Code duplication
QtQuick2 project seems like a fork of QtQuick1, just adding new
classes on top of it. It's basically duplicating some QtQuick1
classes, without placing them in a common path. That was intentional?
How contributions will be handled when a patch is landed for QtQuick1,
but it's also should be applied in QtQuick2?
QtQuick1 is "Done".  To maintain compatibility we will probably not accept non-crash related fixes for it.
I was talking about bug fixes specifically. Since, the code is very
similar, it's easy to find a bug fix that should be applied in both
projects.


Br,
Adriano
Kent Hansen
2011-10-20 12:16:03 UTC
Permalink
Post by a***@nokia.com
Hi,
Post by Adriano Rezende
Hi,
I didn't have time to play with QtQuick2 yet, but looking at the code
I think there are some points that should be reconsidered.
1. Naming conventions
QtQuick2 items adopts an abbreviation 'SG' to prefix their class
names, like QSGItem. Since SG is not a well know acronym, wouldn't be
better to have a more descriptive name without abbreviating? Like,
QQuickItem, QSceneItem or even QSceneGraphItem?
"SG" is a placeholder. The plan is to rename QSGItem to QQuickItem.
An update on this: The renaming will happen shortly. In particular:

QSGItem --> QQuickItem
QSGView --> QQuickView
QSGCanvas --> QQuickCanvas
QSGPaintedItem --> QQuickPaintedItem

Header files will be renamed accordingly (e.g. qsgitem.h --> qquickitem.h).

Regards,
Kent
Kent Hansen
2011-10-21 11:18:09 UTC
Permalink
Post by a***@nokia.com
Hi,
Post by Adriano Rezende
Hi,
I didn't have time to play with QtQuick2 yet, but looking at the code
I think there are some points that should be reconsidered.
1. Naming conventions
QtQuick2 items adopts an abbreviation 'SG' to prefix their class
names, like QSGItem. Since SG is not a well know acronym, wouldn't be
better to have a more descriptive name without abbreviating? Like,
QQuickItem, QSceneItem or even QSceneGraphItem?
"SG" is a placeholder. The plan is to rename QSGItem to QQuickItem.
QSGItem --> QQuickItem
QSGView --> QQuickView
QSGCanvas --> QQuickCanvas
QSGPaintedItem --> QQuickPaintedItem
Header files will be renamed accordingly (e.g. qsgitem.h --> qquickitem.h).
It's done.

Kent
Michael Hasselmann
2011-10-21 11:53:13 UTC
Permalink
QSGItem --> QQuickItem
QSGView --> QQuickView
QSGCanvas --> QQuickCanvas
QSGPaintedItem --> QQuickPaintedItem
Header files will be renamed accordingly (e.g. qsgitem.h --> qquickitem.h).
Thanks, but don't you think that the QQ prefix looks rather silly now?

You basically say "Qt Qt User Interface Creation Kit Item", no?
I'd argue that the Q of Quick is already the regular prefix.

regards,
Michael
Kent Hansen
2011-10-24 08:34:55 UTC
Permalink
Hi,
Post by Michael Hasselmann
QSGItem --> QQuickItem
QSGView --> QQuickView
QSGCanvas --> QQuickCanvas
QSGPaintedItem --> QQuickPaintedItem
Header files will be renamed accordingly (e.g. qsgitem.h --> qquickitem.h).
Thanks, but don't you think that the QQ prefix looks rather silly now?
You basically say "Qt Qt User Interface Creation Kit Item", no?
No, I've never uttered those words. The technology is called Qt Quick
(http://qt.nokia.com/qtquick). It may be redundant/silly, but at least
it should be consistently silly across our APIs.
Post by Michael Hasselmann
I'd argue that the Q of Quick is already the regular prefix.
QuickItem isn't consistent with Qt class naming. To me it reads like "Qt
uick Item". We have QQueue (http://doc.trolltech.com/4.7/qqueue.html),
not Queue. "Quick" and "Queue" are plain English words, we can't have Qt
hijacking them.

Unless you were suggesting it should be called QItem, which I think is a
tad too generic.

Historical trivia: A few years back, the C++ QML classes were all called
Qml*, before they were renamed to QDeclarative*.

Regards,
Kent

Loading...