qt


QML - Capture all UI events of children objects


In my QML project, I need an object to capture all the UI events of its children objects. So, if any of its children register a click or something, the parent object needs to know about it. The issue here is that all of the children objects are pre-defined classes such as MyButton or MyComboBox. These classes all have defined MouseAreas and onClicked() functions that can't be overridden. Therefore, I need the parent object to capture all the events of its children WITHOUT modifying the MouseAreas of the children. Please let me know the best way to accomplish this.
You can try to overlay your items with a MouseArea. In the event handlers you can check the position and call the event handlers of the underlying items.
Item {
MyButton { id: mybutton
/* set the anchors */
}
MyMouseComboBox { id: myMouseComboBox
/* set the anchors */
}
MouseArea {
anchros.fill: parent
onClicked: {
// mouse.accepted = false
// Check whether clicked point is within mybutton
// on true, call mybutton.doSomething()
// or call mybotton.onPressed(mouse)
}
}

Related Links

PyQt: QTableView + QSqlTableModel - Copy and Paste Alll Selected Rows or Columns into Notepad or Excel
Gstreamer Pause/Resume pipeline issue
How to use a GridLayout in combination with exposing data property
Possible to update/refresh Flow QML component when item has been removed?
Qt Quick: Putting Repeater and standalone item in GridLayout leads to weird behavior
After anaconda upgrade --all anaconda-navigator does not launch
Show shortcut in tooltip of QToolBar
Qt Creator IDE AutoTest plugin
Using QCustomPlot trying to create animation like effect
QMenuBar's height has suddenly changed - bug?
QT 5.7 video element freezing when device using high CPU or RAM
How can I make a QT app displaying very large amount of data with low memory usage?
Qt Quick Window Minimize Event
installing pyotherside fails
Building Qt 5.x from Source with MSYS2 / MinGW 64 - ICU unicode header missing
SSL Error with QML Map Viewer (Qt)

Categories

HOME
artificial-intelligence
nsview
gallery
liferay-7
cypher
material-components
video-streaming
gprs
onvif
telegraf
amazon-emr
spring-jpa
corona
tomcat8
exec-maven-plugin
nose
jest
akka-persistence
bosun
gollum-wiki
backendless
router
morris.js
history.js
iwebbrowser2
ninject
envoy
toad
memory-fences
seafile-server
overwrite
microsoft-certifications
nest
bootstrap-sass
busboy
formsauthenticationticket
android-n
google-now
swfupload
netapp
klee
distributed-caching
yoast
contactless-smartcard
apache-toree
adblock
roracle
sigsegv
test-data
mpmovieplayercontroller
http4s
coovachilli
adjacency-list
i2b2
wikimedia-commons
miniconda
android-studio-import
supercomputers
uitest
wicked-gem
mxe
xml-signature
qt5.4
nodeload
xmi
lsa
armv6
cloo
jmenubar
xsd2code
blobstorage
unicoins
onconfigurationchanged
viewpagerindicator
exponent
fbml
microblogging
mvcrecaptcha
delphi-prism
vows
django-pagination
projectpier

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App