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

Understand when qthread finish
QtMobility Several QMediaplyers in one applications
Group QRadioButtons in rows from a QTableWidget
QAbstactTableModel insert at top
What's the right way to apply stylesheet on a class derived from QPushButton?
can’t debug in qt sdk 1.2-during startup program exited with code 0x0
How to map a combobox with static items to database field?
Is it possible to emit a signal from the baseclass of a derived object using “this”
iter with foreach
QRadioButton Array issue
Error during compiling the Qt libraries
CMake CPack debian packages
DELETE with qsqlquery
QTableView - sort headers
QDialog with transparent background color
Qt creator Screen navigation

Categories

HOME
extjs
blast
cucumber
workflow
windows-10
braintree
biztalk
celery
liferay-7
drag-and-drop
clone
fedora
sharepoint-online
stack-overflow
siesta
yeoman-generator-angular
locationmanager
android-externalstorage
distributed-computing
bnf
significance
parceler
jest
bsd
amazon-sns
channel
restier
vuforia
list-comprehension
social-networking
docx4j
kendo-listview
subclassing
strapi
reset
ejml
bit-shift
deployd
lightning-workbench
ilrepack
lvalue
predicates
okio
livereload
dcount
dmarc
wininet
carmen
seccomp
raw-sockets
jeasyui
urbit
accessibilityservice
i2b2
phpquery
android-studio-import
swagger-maven-plugin
mgwt
incron
cakephp-2.2
object-code
webautomation
refit
webaii
property-injection
lsa
xsd2code
notifyjs
system-requirements
viewpagerindicator
websphere-6.1
prefuse
autosize
fbml
mmc3
delphi-prism
upshot
regression-testing
solandra
zend-test
yahoo-maps
gtktextview
downloadfile

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