Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deactivate (?) QML Item to avoid overlapping of action areas

Tags:

qt

qt5

qml

qtquick2

first question on Stack Oveflow here, so don't be evil! :)

Down to business: How to proceed if one has stacked elements with stacked action areas to make sure that you acton what you see and not on underlying elements?

I'm following a tutorial on Qt Quick 2.0 programming for desktop, where one makes a post-it like application with several pages to switch on.

So in the main.qml I have a "PagePanel.qml", where one have 3 "Page.qml" one on top of the other. Each one has opacity 0.0 until opacity 1.0 is forced by clicking a corresponding marker, to visualize the selected page. In the page are linked (and created) Items "Note.qml" that are sticker-notes with an area for dragging the item around and an area for writing on top.

Problem is that if I have on different pages two notes overlapping, if I try to drag or to write on a note there can be that I'm actually (without seeing it) dragging and writing on the underlying note. In other words the action regions of the different pages remain active when switching from a page to the other.

How can one make inactive the hidden pages and act only on the visualized one?

Thank you in advance, A.

like image 780
Dr.Raghnar Avatar asked Nov 12 '13 10:11

Dr.Raghnar


1 Answers

As I said in the comments, if you have 3 Page elements on top of each other. The easiest would be to set visible: false to the one you want to disable and visible: true to the active one. This will disable all the MouseArea and DropArea in the elements that are not visible.

like image 186
koopajah Avatar answered Sep 21 '22 11:09

koopajah