O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading an existing picture into a panel

Another useful feature would be to be able to choose an existing image (for example, from the local filesystem) instead of taking a camera picture:

Given there is a pageAnd the page has one or more panelsAnd I select one panelWhen I add an existing picture to the selected panelThen the picture shows up in the selected panel

Also, in this case, supporting the use case does not require much extra work. We start by adding two Button instances from Qt Quick Controls 2 to the panel, instead of the MouseArea, and creating two separate signals (cameraClicked and existingClicked), rather than the single clicked:

// ComicPanel.qmlimport QtQuick 2.9import QtQuick.Controls 2.2Item {    id: panel    signal cameraClicked() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required