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

How to render a cubic bezier curve in QML?
Emacs C++ indentation confused by Qt macros
Cannot move to next page to print HTML content with QPrinter
Qt terrain example doesn't work
qt - decimals and round up to whole numbers
Qt error , libtiff.so.4 not found
Qt on i.MX6 with -platform eglfs -> Segmentation fault
How can i show Windows processes in for example textEdit in Qt Creator?
How do I use Qt to display custom video stream?
Is there a IconMode for a listview in qml?
QAxWidget don’t display
Can someone explain size hint, size policy, size constraint in QT?
QVideoWidget inside a GraphicsView
How to do that when the mouse pointer hovor QListWidgetItem, then the QListWidgetItem emit a signal?
Applying animation to all images in a grid layout in QML, instead of animating each one
Leave event not called when hiding a widget

Categories

HOME
xcode
postgresql-9.4
scroll
operating-system
devexpress
plaid
whmcs
typeerror
yql
hyperledger
native-base
phpseclib
sharepoint-online
mutation-testing
driver
solution
slide
spring-amqp
smartgwt
squirrel-sql
uima
error-logging
activeadmin
stackexchange.redis
channel
opentext
managed-c++
uri
spreadsheetgear
list-comprehension
miniprofiler
unmarshalling
windows2012
microsoft-certifications
des
landscape
ng-repeat
hidden-markov-models
extbase
widestring
windows-store
grails3.2.0
fiware-wirecloud
1wire
contactless-smartcard
password-hash
sharpdx
openstack-glance
webvtt
finder
gawk
e
visual-studio-monaco
pyaudio
p6spy
zynq
system.net.mail
gcloud-node
odp.net-managed
django-redis
preferenceactivity
django-validation
godeps
auto-generate
canopy
scala-macros
nsmutabledata
htmltidy
cakephp-2.2
jquery-mobile-flipswitch
quantify
lmax
oracle-adf-mobile
coding-efficiency
android-2.3-gingerbread
jchartfx
saga
acitree
sly-scroller
dibs
gitx
nsmutablestring
server-name
hardcode
series-40
uploading
qtextbrowser
delphi-prism
representation
dip
resharper-5.1
sscli
self-tracking-entities
resharper-5.0
browser-based
external-sorting
regioninfo
word-automation

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile