Daily Archives: 07.08.2017

Link

The program for CppCon 2017 is now published!

CppCon is the annual conference for the C++ community: five days packed with over 100 talks, as well as inspiring keynotes, panel discussions, hallway chats, fun evening events and much more. CppCon is a project of the Standard C++ Foundation, a not-for-profit organization whose purpose is to support the C++ software developer community and promote the understanding and use of modern, standard C++ on all compilers and platforms.

It’s our pleasure to announce that Qt will be a huge presence at this year’s CppCon, with a training, a keynote speech, two talks and other open content:

  • On September 23-24, KDAB’s Giuseppe D’Angelo will deliver a pre-conference training on programming with QtWidgets. This course focuses entirely on QtWidgets, the set of C++ APIs offered by Qt to build cross-platform desktop applications, running on Windows, Linux and Mac.
  • On September 27, Giuseppe will also talk about how to use Qt C++ Core APIs effectively in the 2017 update of the Effective Qt session.
  • On September 29, Simon Hausmann from The Qt Company will explore what’s under the hood of the Qt object model and its features (signals, slots, properties) in his Inside the Qt Object Model session.
  • Last but not least, Lars Knoll (Qt Project Chief Maintainer, CTO of The Qt Company) will deliver a keynote speech. The details have yet to be announced, but it’s great to see the C++ community acknowledging the importance of the Qt framework in the C++ ecosystem.

This isn’t everything — stay tuned for more info about other Qt-related content at CppCon, including BOFs, panels and lightning talks. Also, don’t forget that on September 30 and October 1, KDAB’s Thomas McGuire will explain in his post-conference training how to Debug and Profile C++ Code on Linux.

You can register to CppCon here.

See you in Bellevue!

[training_callout] continue reading

The post Qt talks at CppCon 2017 appeared first on KDAB.

…read more

Source:: https://www.kdab.com/qt-talks-cppcon-2017/

      

Link

Property bindings are one of the most interesting features of the QML language. In QML, when we set a value on a property, the right hand side expression isn’t evaluated just once to produce a value, like in a ordinary imperative language.

In particular, if the expression involves other properties, then the property we’re setting becomes bound to the properties in the expression: whenever they change their values, then the expression is automatically evaluated again, and the target property value updated.

For instance:

[sourcecode]
import QtQuick 2.0

Rectangle {
width: 100; height: 100

// this is a binding:
color: mouseArea.containsMouse ? “red” : “blue”

MouseArea { id: mouseArea; anchors.fill: parent; hoverEnabled: true }
}
[/sourcecode]

In the snippet above, the color property of the Rectangle is the target of a binding: it is bound to the containsMouse property of the internal MouseArea. When the mouse moves inside or outside of the mouse area, its containsMouse property will change, causing the expression for color to be re-evaluated.

In layman’s terms: the rectangle will be red if the mouse cursor is hovering over it, and blue otherwise.

Property bindings allow to build our UIs in a very declarative way: we don’t need to write boilerplate “slots” to update our UI elements when some other property changes value. The expression that we can write on the right hand side can be as complex as we want, even involving function calls; the engine will do all the work for us, and will make the binding work as expected.

Breaking property bindings

Sounds too good to be true? Well, property bindings have a limitation: if we use an imperative assignment to set a value on a property, its binding will be lost. For instance, suppose we want the rectangle to turn green when we click over it. This is a possible implementation:

[sourcecode]
import QtQuick 2.0

Rectangle {
width: 100; height: 100

// this is still a binding
color: mouseArea.containsMouse ? “red” : “blue”

MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
parent.color = “green” // oops! breaks binding
}
}
}
[/sourcecode]

In the onClicked signal handler we set the color property to green using an ordinary assignment from imperative JavaScript code. With this code, if we click on the rectangle, and then move the mouse over it and outside it, we’ll see that the rectangle doesn’t change color any more — it stays green. This happens because the imperative assignment destroyed the binding, and set the color property to one specific value.

Are broken bindings a problem?

In general, the above example is 100% correct QML …read more

Source:: https://www.kdab.com/new-qt-5-10-diagnostics-breaking-qml-bindings/