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

Qt query execution error
Qt 4.7.4: Is there a way to find out the status of CAPS LOCK?
Qt connect two signals together using QueuedConnection
QScrollArea's elements aren't redrawn
SetRootPath with QT, QFileSystemModel on Mac OS X
Does QTimer keep counting once it's timedout?
Another Window over QMainWindow in Qt
How to QDialog semi-transparent?
cmake not finding Qt4
I want to know about how to draw a line between two nodes. .
How to add extra menu item while tapping for long time on a contact of phonebook?
Can I use open-source version of Qt for commercial applications? [duplicate]
how to imitate the button in QML
Qt Designer Shortcut to another tab
QObject::deleteLater() when pointer is zero
Qt: How to get mounted drives

Categories

HOME
office365
ionic2
angular-ui-grid
couchdb
haproxy
command-prompt
dry
ios-simulator
azure-mobile-services
facebook-android-sdk
responsive-design
anchor
lc3
amazon-emr
jquery-file-upload
bundler
nest-api
web-deployment
multiple-tables
jitsi
sqlplus
fido-u2f
kaggle
cell
react-dnd
opentext
xdebug
gravity-forms-plugin
sales
ibm-connections
fatfs
rust-cargo
lxml
cloudera-manager
cloveretl
pdfminer
testlink
djcelery
best-buy-api
system-on-chip
web-inspector
webalizer
case-when
business-rules
email-injection
ternary-operator
p6spy
always-on-top
raw-sockets
openseadragon
qtcpsocket
apache-pig-grunt
maximize
webgrind
google-maps-api-2
compositetype
kefir.js
azure-xplat-cli
shell-extensions
baseadapter
tkx
iplimage
mobile-country-code
rpg
xmi
principalcontext
xsd2code
iirf
virtual-channel
tnt4j
objective-c-runtime
ntlmv2
contextswitchdeadlock
user-forums
arrow
system-information
struts2-s2hibernate
kobold2d
mvcrecaptcha
infopath-2007
asio
fragment-identifier
jmenu
mygeneration
chunking
resharper-5.1
outlook-2007-addin
tessellation
html-components
bucket
tso
rakudo

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