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

Qml ListView empty rows placeholders like in TableView
How can I resize the window after a widget is hidden while still allowing the window to be resized?
How can I dynamically filter rows in a QTableView while also using 'lazy loading'?
Unknown module(s) in QT
Normal HTTP request vs TCP connection + HTTP header
adjust size of QDialog make it to shrink everything
Qt How to set background color for QTabBar content?
Why QIcon / QPixmap loaded image format should be png (and not svg) to be displayed in binary?
rcc: File does not exist
Qt.labs.controls: TabButtons don't click
Qt 5 : Mouse Wheel event behaviour for zooming image
Get properties of QML ListElement
Where should Qt style sheet code be placed?
How to check if qmake project is under 'subdirs' template?
QML tutorial: Directory is not a type
How to draw line between folded blocks in QPlainTextEdit?

Categories

HOME
seedstack
redmine
odata
implicit-conversion
u-boot
angular2-template
roku
swarm
twitter-oauth
colors
watch-os-3
dma
async-await
wsf
unity-container
qa
sipp
environment
cube
ibm-connections
basic-authentication
locks
phpstorm-2016.1
objectmapper
publishing
wampsharp
lxml
cucumber-junit
shapeless
devtools
markov-chains
jslint
twilio-php
uivisualeffectview
strapi
ng-repeat
django-smart-selects
llvm-ir
extbase
swfupload
web-inspector
autorelease
directwrite
karabiner
htmlspecialchars
algebra
portability
apache-modules
hmmlearn
email-injection
nitrousio
e
s-function
xmlbeans
jsonix
bbc-micro
fdt
mnesia
as3-api
univocity
apache-commons-digester
android-studio-import
canopy
supercomputers
supersocket.net
compositetype
domino-designer-eclipse
embeddedwebserver
tidyr
device-admin
global-scope
dmake
flipboard
jomsocial
pbkdf2
visual-c++-2005
insertion
arel
multiscaleimage
playorm
chronometer
java.lang.class
kobold2d
autosize
wcf-callbacks
groovy-console
mediacontroller
channelfactory
turbine
multiple-users
data-retrieval
jquery-effects
fuzzy-comparison
rendering-engine
community-server
service-factory

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App