Does Qt need a modern C++ GUI API?

Page  
8

Does Qt need a modern C++ GUI API?
No, I am perfectly happy with QML, JavaScript, interpreters, virtual machines, glue code, glue abstract and proxy object 80
Yes, I’d like the option of 100% native development without being left behind with a last century GUI API 184
Total Votes: 264
You must be a logged-in member to vote

May 5, 2012

capisce capisce
Lab Rat
32 posts

@Erik

In QML you would probably use a Repeater for that, see http://qt-project.org/doc/qt-4.8/qml-repeater.html

May 6, 2012

Erik Janssens Erik Janssens
Lab Rat
11 posts

@capisce

Ahah, thank you for the link. I’m trying to see the parallels between the QML data binding and the traditional model-view-delegate.

May 9, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

I’ve seen you’ve already taken the easy way out, but there are still some things that are worth beeing mentioned.

The SceneGraph is not an exclusive feature of QML, see QSG* classes. There is a hardware-accelerated painter interface, see QGL* classes. There is also a traditional QPainter interface to QML, see QQuickPaintedItem. QML can be easily extended with C++ code, see QQuickItem.

QML has got a canvas interface, which allows drawing of straight and curved lines, simple and complex shapes, graphs, and referenced graphic images. It can also add text, colors, shadows, gradients, and patterns, and do low level pixel operations, see Canvas item.

Images in QML can be supplied in any of the standard image formats supported by Qt, including bitmap formats such as PNG and JPEG, and vector graphics formats such as SVG. If you need to display animated images, use the AnimatedImage element. BorderImage provides automatically scaled raster images.

QML is at an advantage due to beeing an declarative, interpreted language (id est not beeing C++). An interpreted API has to maintain source code compatibility, whereas an native API has to additionally maintain binary compatibility, thus is usually less extensible, as there are binary contracts to be abode.

QObject, QObjectList, QStringList, QVariant, QVariantList, QVariantMap and QAbstractItemModel can be directly exported to QML without any additional glue code. qmlRegisterType() allows for registering custom types, which are then available in QML immediately. QML supports C++ inheritance hierarchies and can freely coerce between known, valid object types. The QtQuick engine takes advantage of the meta-object information already present for each object.

There already is an extensive list of professional, productivity-oriented applications created with QtQuick, see KDE, QtMediaHub, N9, mixd.tv, httvBOX, Ocean Blue, IP4.tv et al.

QML is a replacement to QtWidgets in the same way the Graphics View Framework is a replacement to QtWidgets. QtQuick stands for Qt User Interface Creation Kit, not Qt Application Creation Kit.

Nokia spent 150 million dollars to acquire Trolltech just to release the framework under the terms of the LGPL, so that everyone can use Qt for closed-source non-commercial and commercial applications for free. Since then, Qt has grown exponentially in number of features, users, applications, SDK downloads, full time developers and specialized companies. Although Qt beeing an Open Governance community project now, Nokia is still (by far) number one code contributor, main contributor of legal resources to define and protect the Qt trademark, licensing and Contributor License Agreement, main funder of Qt training courses and materials, the Qt Certification and Qt Ambassadors program and the Qt Project infrastructure, the Qt Contributors Summit, the Qt Developer Days and experimental activities around Qt5 such as the QtonPi, Qt5 for N9, Qt5 for PhoneGap or INdT.

Yes, we’ve still got a long way to go with QtQuick and QML and there is definitely room for improvement. Therefore we need a vivid discussion about the future development. But such a discussion is quite impossible as long as we have such a diverging perception and as long as most subsequent conclusions are based on it.

I do not presume to know what the majority of people thinks about QtQuick and QML, and you shouldn’t do that either. Especially as based on a biased poll with insignificant participation [the Qt SDK is downloaded by millions of people, 130 have participated in “your” poll, 85 of them have voted in favor of an (additional) native API], which doesn’t even allow for differentiation between a native API beeing a replacement or an additional, secondary option to QML. You must have missed that in the second poll you are referring to (which suffers from the same insignificant participation) two-thirds of the people have voted in favor of QML.

But what I do know is that a lot of the argumentation against QML is based on denial, prejudice and personal opinions. It would help me a lot if I would actually see all the excessive amount of glue code that is obviously somewhere, if I would see the huge performance impact of QML on our applications, if I would see all those, or at least one, applications that have been made quite impossible due the way QtQuick works and if I would see that perfect native C++98 API, which has all the advantages of QML without its disadvantages. Where is all this?

May 13, 2012

d3fault d3fault
Lab Rat
5 posts

Lukas Geyer, you keep stating that we need to keep to fact-based arguing… so I’ll keep this short:

Hardware Accelerated C++ GUI API with bindings does not require a JavaScript Interpreter, a Virtual Machine, or a brand new declarative language.

There, that’s it. There is no fact-based argument to defeat that. Please try as it will be amusing to read. Now please stop with the same old tired push of “use the QtQuick back-end directly” (QSG* classes) HURRRR you troll. We can both agree that there’s a reason QML exists: to serve as a front-end to drive the back-end that you’re proposing we manually drive. If it’s so easy, why was QML invented to drive it? We want a purely C++ front-end to drive the QtQuick back-end, get it?

May 14, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

I do. And if you would have followed the discussion you would have seen that I’ve never had a problem with people demanding it, but rather how the gave reasons; and you would know that I’ve explicitly mentioned that Qt should have a native QtQuick API.

But I do have a spot of bother with it, and it is to be feared that your are most probably not amused with it, as it is quite of a killer argument: it is practically impossible to express the requirements for such an API in C++98.

But I’m quite sure you bring an idea, a sketch, a paradigm or possibly even an early implementation of such an API with you, which supports at least automatically re-evaluable expressions, or bindings as you call it, which substantiates your demand and in further consequence disproves my assumption, don’t you?

May 14, 2012

jdavet jdavet
Lab Rat
20 posts
d3fault wrote:
Hardware Accelerated C++ GUI API with bindings does not require a JavaScript Interpreter, a Virtual Machine, or a brand new declarative language.

It does not theoretically “require” them, no. But then again, no computing task theoretically “requires” anything more high-level and productive than assembler code. And not even that, why not go one step further and design a new hardware chip for each computing task?

Yes, there would have been different possibilities for solving the task that QtQuick/QML tries to solve. The Qt developers made a design decision. They gave higher value to maximizing productivity for application developers/designers, than to making diehard “C++ for the sake of C++” purists happy. A good choice.

May 14, 2012

d3fault d3fault
Lab Rat
5 posts
jdavet wrote:
They gave higher value to maximizing productivity for application developers/designers, than to making diehard “C++ for the sake of C++” purists happy. A good choice.

Wrong. They gave higher value to creating a NeW eXtreMe eXper1mentaL “Designer Friendly” AppLiCatiOn pr0gr4mming LaNguaGe in hopes that it would earn them more moneys in the mobile market. They’re pissing a lot of us C++ devs off by forcing the use of this NEW BITCHIN PROGRAMMING LANGUAGE [if we want to use up-to-date UI]. We already know how to code and we don’t need a javascript interpreter thank you very much.

If I was a C++ purist I’d be using Boost, not Qt. Qt’s use of MOC makes C++ purists cringe.

Lukas Geyer wrote:
But I do have a spot of bother with it, and it is to be feared that your are most probably not amused with it, as it is quite of a killer argument: it is practically impossible to express the requirements for such an API in C++98.

I agree. A lot of the previous examples included the use of lambdas and C++11 features. Here is one that is C++98…. though it is uglier because of it. (best case scenario: support both)

What you type:

  1. m_SomeDeclaredView.somePropertyToBeUpdatedWhenTheBindingPropertiesChange = Q_BINDING((Q_BIND(m_SomeOtherObject.someProperty1) + Q_BIND(m_AnotherObject.someProperty2)) /Q_BIND(m_YetAnotherObject.someProperty3) + aConstantInteger);

Post-MOC result:

  1. //Auto-Generated
  2. autoGeneratedEvaluateFunction()
  3. {
  4.   return (m_SomeOtherObject.someProperty1 + m_AnotherObject.someProperty2) / m_YetAnotherObject.someProperty3 + aConstantInteger;
  5. }
  6. connect(m_SomeOtherObject.someProperty1, SIGNAL(changed()), this, SLOT(autoGeneratedEvaluateFunction());
  7. connect(m_AnotherObject.someProperty2, SIGNAL(changed()), this, SLOT(autoGeneratedEvaluateFunction());
  8. connect(m_YetAnotherObject.someProperty3, SIGNAL(changed()), this, SLOT(autoGeneratedEvaluateFunction());
  9.  
  10. //Your original binding, wherever you typed it
  11. m_SomeDeclaredView.somePropertyToBeUpdatedWhenTheBindingPropertiesChange = autoGeneratedEvaluateFunction();

in the precompiler stage,
each Q_BIND evaluates it’s contents to ensure it is being pointed to a proper Q_PROPERTY
each Q_BIND ‘makes note of (somewhere)’ the property it points to
the contents of Q_BINDING are stored in some “autoGeneratedEvaluateFunction” function, with the Q_BIND macros removed (since we’ve already processed them)
the right hand side of the equals sign points to autoGeneratedEvaluateFunction() to get the initial state
each of the Q_BIND’d properties we ‘made note of’ have a slot connected to their NOTIFY Q_PROPERTY signal. this connection is disconnected when the view is no longer seen.
the slot that the NOTIFY signals is the autoGeneratedEvaluateFunction function. there could also be some: if(new != old) { old = new; emit changed(); } protection in the property’s setter.

since aConstantInteger is not surrounded by Q_BIND (and since it’s constant!), there are no signals/slots to set up. Q_BINDING might (idktbh) also need compiler optimization-prevention so it doesn’t get rid of aConstantInteger

I pulled this example out of my ass. I’m sure others could come up with a better solution. Do you also need to be shown how to declare a GUI in C++?

jdavet wrote:
It does not theoretically “require” them, no. But then again, no computing task theoretically “requires” anything more high-level and productive than assembler code. And not even that, why not go one step further and design a new hardware chip for each computing task?

Any solution is not the best solution. Qt strives for the best solution. There are plenty of overly expensive languages that provide the exact same functionality as Qt… usually incurring a run-time cost (JIT etc) where Qt requires none. Java/.Net/any-interpretted-scripting-environment… are all inferior to Qt…. for the same reasons QML will be inferior to a Hardware Accelerated C++ GUI API with Bindings: Native and/or Not Interpretted. (give me QML compiled down to byte code in my executable and don’t force the use (includes simple loading without using (a lot of people saying: don’t like js? don’t use it!)) of a JavaScript Interpreter/VM at runtime and I will consider it a ‘good-enough’ compromise sadface)

May 15, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

Yes, using a preprocessor is a possibility.

But let’s take a look at the idea behind: we are adding specific language extensions because the requested functionality is not supported, which are then translated by a seperate tool into native code.

If we now extend your example to the correct use of properties (which require the use of property() and setProperty(), as there is no such thing as a property in C++) or a more declarative way to describe a hierarchy of components using key-value assignment (as requested and suggested on the mailing list), basically everything on the list for an advanced GUI API (and everything that distincts QtQuick from the already existing, hardware-accelerated Graphics View API) we end up adding specific extensions and then, although having a native API, in creating and implementing our QtQuick components using those language extensions – a specific meta-programming language front-end – which is then translated into native back-end code by a seperate tool. What we implement in native code is the required supporting code, like constructors, destructors, operators, memory management and so forth.

If you bring this to a head, you’ll end up exactly where we are right now. We have a specific meta-programming front-end language, QML, which is then translated by a seperate tool, the declarative engine, into a native representation (no, QML is not interpreted, it is translated into a native representation and no, V8 does not interpret JavaScript, beeing a just-in-time compiler it produces run-time optimized machine code, which is then executed). In both cases you will have to (learn and) use a specific front-end language (with different aesthetics) which is not C++.

You’ve already been told that a byte-code compiler for QML is possible, partially done and possibly integrated in Qt 5.1 if there is a strong momentum from the community.

May 26, 2012

Raul Raul
Ant Farmer
105 posts

Just food for thought….

Someone mentioned here the BlackBerry 10 Cascades framework based on Qt/QML as non toy app development, well, RIM seems to think that having a C++ alternative interface for Cascades as well (and not just QML only) is actually a good idea and looks like an implementation like that is very viable (as opposed as some people here seem to think), check this link for an example:

BB10 developer documentation [developer.blackberry.com]

Also, a while ago I contributed to a declarative language and API that was very controversial as well called JavaFX with the very cool and infamous FX Script, well, if history has something to teach us, by version 2 they ended up adding a java interface for it because there were too many developers complaining that had to forcefully use FX Script instead of the language everyone knew. At the end, FX Script died, java interface prevaled, and even ended up adding an XML declarative interface (go figure) instead of FX Script.

 Signature 

Raul Guerrero
http://jimi.mx

May 31, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

Well, its basically a fluent interface wrapper around the proprietary Cascades elements and the Animation Framework for constructing objects, but there is no support for states, bindings or anything else we are used to know from QML (which doesn’t mean having a fluent interface is not a viable idea).

June 2, 2012

utcenter utcenter
Gene Splicer
759 posts

@Lukas – you are aware in the manner surveys are done, aren’t you? When probing about the public opinion, usually only like a thousand random people are being questioned and that gives an adequately accurate representation of what hundreds of millions are thinking.

This poll has kept a steady 2:1 ratio from the moment I first checked it with only 50 votes to now – over 150 votes. At this point I think it is safe to assume this is an accurate representation of what people think in general, and considering the claimed figure of about 500 000 Qt developers, about 333 333 of them would want to see efforts invested in a modern, customizable, hardware accelerated GUI API that is pure C++.

Or do you imply all the people who didn’t find this thread or have no forum registration would vote against a C++ API? If so on what grounds? Because you think it is the right thing to do and value your opinion above that of hundreds and potentially hundreds of thousands people?

And furthermore, what do you imply about all the people who voted in favor of a C++ API? That they are clueless fools that don’t know what’s best for them?

With the risk of repeating what’s already been said, if a new GUI API was conceived with the idea of being public and native above all to begin with, and extend QML functionality out of it – this issue wouldn’t even be at hand. Alas, Nokia chose to offer the candy result of development efforts through their own language like so many other corporations before that, so at this point it becomes a burden to reshape the API in a native form, so may as well be better to create a new API focused at C++ nativity rather than modify the existing, QML/JS focused API.

As of the matter of stuff that is not technically possible with C++ – C++11 already provides solutions and I think it is about time Qt begins taking advantage of them, incorporating a compiler that is not ancient history and whatnot. BUT even without C++11 – Qt already heavily relies on code generation and the MOC and I cannot shake the feeling it would have been much easier to extend the MOC to generate some more boilerplate code from a nice and clean syntax that describes property binding in C++ source than reinventing the wheel and throwing in the mix a pile of new and avoidable tools in some ill conceived attempt to be “cool” and trendy in the philosophy of “monkey see, monkey do” and follow in the steps of other companies that work hard to make the excellent language that C++ is into the new assembler in both area of application and usage frequency, to push forward another “our way of doing things” like development is not fragmented enough already.

I get the feeling of C++ as well as Qt itself being neglected by Nokia, surely, no one argues they spent good (too good IMO) money on it, they made it LGPL which is a great thing, making adoption easier and usage of Qt higher, however the effort to morph Qt from a purely C++ application framework to a mostly QML application framework, extendable through C++, combined with the decision to NOT support the actual major mobile platforms and all the (potential) Qt supporting mobile platforms being pretty much dead, dying or stillborn – somehow it doesn’t seem those decisions are in Qt’s or its developer base best interests. And with all the yapping that despite being owned by Nokia, Qt is a community framework, where are the platform support and features this community obviously wants? And no, I don’t think the community CAN or SHOULD even try to push against the bulk of the development effort that is in the hands of Nokia, it is Nokia that should direct that bulk of development effort to address the needs of is developer base, not protect its preposterous corporate interests that have already inflicted billions of dollars of damage and cost thousands of people their jobs.

And surely, C++ classes are still there, no one denies that, the problem at hand is not with old native stuff being gone, the problem is it is all DONE and there is NO new native stuff being developed, QML absorbs almost completely the development efforts, whereas other new promising technologies and platforms are being completely neglected and this has been going ever since the acquisition. Is this really “progress” or is Qt being sent on a wild goose chase, pimped to appear progress-like?

June 5, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

utcenter wrote:
@Lukas – you are aware in the manner surveys are done, aren’t you? When probing about the public opinion, usually only like a thousand random people are being questioned and that gives an adequately accurate representation of what hundreds of millions are thinking.
Yes, statistics uses samples to infer about a population, but this requires a certain sample size which is (for a common confidence level and interval) too low for the projected population size, which means that the result is not adequetly accurate. In addition, passively recruited or self-selective surveys are generally never representative, due to the erronous nature of sampling (and questioning in this case).

utcenter wrote:
At this point I think it is safe to assume this is an accurate representation of what people think in general, and considering the claimed figure of about 500 000 Qt developers, about 333 333 of them would want to see efforts invested in a modern, customizable, hardware accelerated GUI API that is pure C++.
No, because this poll answers a different question (should there be an optional C++ API) than the one you’ve raised (should resources be spent on creating one). The latter question is answered in this poll [qt-project.org], and for the vast majority of voters improving QML is more important than creating an optional C++ API.

utcenter wrote:
Or do you imply all the people who didn’t find this thread or have no forum registration would vote against a C++ API? If so on what grounds? Because you think it is the right thing to do and value your opinion above that of hundreds and potentially hundreds of thousands people? And furthermore, what do you imply about all the people who voted in favor of a C++ API? That they are clueless fools that don’t know what’s best for them?
No, that’s your implication, not mine.

utcenter wrote:
With the risk of repeating what’s already been said …
Yes, you are repeating what’s already been said, discussed, disproved and clarified.

June 5, 2012

utcenter utcenter
Gene Splicer
759 posts

The sample size of the poll has varied and increased with the ratio remaining constant, that is an indication the poll results are accurate. Other than that, I can see bias and arrogance heavily influencing the direction of your arguments. I still didn’t catch the reason for your claim probing more developers will dramatically sway the outcome in the opposite direction?

In that other poll, the “full C++ API”, albeit not really a viable solution, still has plenty of votes, certainly more than “I am happy with QtQuick”.

And in case you noticed, that other thread is about the direction of QtQuick, not the direction of Qt itself. And a modern C++ GUI API is the subject of the latter. It should be no surprise even to you it is not prevailing in a topic it is not the subject of.

Furthermore, in case you noticed, the title of this thread is not “Should QtQuck get a public C++ API?” but “Does Qt need a modern C++ GUI API?” and even thou this was somewhat addressed here, due to the design of the very foundations of QtQuick would be about as cumbersome as designing a new one.

No, that’s your implication, not mine.

Indulge me of yours then, I am really curious about the motivation of your opinion being put over those of many people.

Yes, you are repeating what’s already been said, discussed, disproved and clarified.

Repeated – sure, discussed – extensively, other than that you are now making things up. No one disproved the need of a modern C++ API for UI and I am sure those poll results are inconvenient enough for you to do your best to downplay them, but here is a news flash for you – other people have opinions too, and many of those are just as valid as yours, only more in count and with less bias.

June 6, 2012

Lukas Geyer Lukas Geyer
Gene Splicer
2074 posts

I think we talk past each other.

The result of a vote is absolutely irrelevant for its representativity (and my personal well-beeing). We don’t know what the vast majority of Qt developers think; we indisputably know what 158 people think (and that’s what I’ve said). An extrapolation to the population is only valid if qualitative (a representative sample) and quantitative requirements (sufficient participation) are fulfilled. This has nothing to do with a personal opinion or downplaying, that’s a statistical fact.

Even if the poll might sway to a different result it is still not representative, the same way the other poll is not representative for the population of Qt developers (but on the suppostition that a majority of people who have voted in this poll also have voted in the other poll – which is, of course, up to discussion – it is representative for the population of people that have voted in this poll).

I do not take part for or against, but I do correct people who try to affect the discussion in their favor with improper rationales. I do want to have Qt a prosper future, but this future has to be decided on comprehensible technical reflections, not sentiments or animosities. So I will correct people and ask for proof from both sides of the aisle. The impression, that I am the declarative envangelist, is pure and simple created from the fact that there is a disproportional high amount of subjectivity on the part of the native proponents.

Having a meritocratic consensus-based development model, which implies having discussions about the further development, is a good thing. Meta-discussions about objectively insufficient arguments aren’t.

Every opinion is as valid as mine (and yours). But there are ones that prove themselves true and become facts, and there are ones that simply stay opinions.

In addition, I would like to encourage you to continue this discussion in a reasonable manner. If you think that I’m wrong just bring your own comprehensible reasoning and disprove; there is no need to constantly discredit and misrepresent me (or anyone else).

June 6, 2012

utcenter utcenter
Gene Splicer
759 posts

Why exactly isn’t this poll representing the mind of Qt developers? It is found in a place that is supposed to be visited by Qt developers, so my bet is those current 158 votes come from Qt developers. If 50 random people think the same as 100 random people, who think the same as 150 random people, well, I’d say we have a very obvious, distinctive projection for what 200, 500, 1000, 5000 and so on people will be thinking. I don’t think all the people whose vote will bring representativeness to this poll are hiding somewhere, and if I recall correctly, there was a suggestion to post the poll at the Qt project front page, which would have caused a significantly higher amount of participants, hopefully depriving you of your argument the current number is insufficient, although it retained a literally constant ratio as it grew.

As for the merits of meritocracy – just look at what it did to Nokia’s overall business. I am not one of those people who consider the general population to be stupid enough to be told what it wants by the industry, and I bet Nokia would not suffer this tremendous blow if the direction of the company was not determined by those smart-a$$e$ which drove it into the ground, potentially the same management that does the direction picking for Qt after the acquisition. Ever considered that the decision makers have not become decision makers for being exceptionally good at decision making? Ever considered whether the priorities of those decision makers may not be in the interest of Qt? After all, they deliberately avoid making the ONE DECISION to make Qt a rousing success, and geez, I really “wonder” what is their motivation for it???

I hope you realize that acting as if you present facts and your opposition doesn’t – that doesn’t really materialize into reality, it is common tactic to appear as having the upper hand in the eyes of what you assume is incompetent public without really having it. There is only one noteworthy fact in the bulk of those 120 replies, and that is the result of that poll you are hasty to dismiss right away. A modern, native, cross-platform, hardware accelerated C++ GUI API is not what I or any other individual want, it is what the world needs, because there is no such animal in existence. On the other hand, declarative, interpreted, VM centered GUI APIs are already too many to count. It is only obvious that the focus of Qt should be on what doesn’t exist and users demand, instead of arriving late to an area already crowded with more attractive, open and widespread solutions. Pioneering innovation should take precedence to giving your own twist on clichéd ideas you arrive late to.

On a side note, I really admire how you claim this poll means nothing and in the same time point to the other poll as having meaning, ironically, the other poll is lower in both participants and rating, which doesn’t sit well with your argument on why this one is devoid of representativeness. And YOU talk about OBJECTIVITY – you are further from objective than obesity from sub-Saharan Africans :)


  ‹‹ Rumour: Nokia to be split?      Egyptian Qt developer Wanted ››

You must log in to post a reply. Not a member yet? Register here!