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 add style via setStyleSheet() without losing orignal style in Qt?
Convert QUrl with percent encoding into string
Qt ItemDelegate with a tool button: can't click
QWebView: linkClicked doesn't get emitted with certain page (javascript?)
How to update the QT Mainwindow at each loop in mainwindow.cpp
QGraphicsItemGroup to OpenGL texture
Deploy QML application with localstorage plugin
After by hiding its vertical header, can I let user resize the row of QTableWidget?
Optimizing QPainter drawing & Converting QVideoFrame straight to QPixMap
Can not create osgQt (OpenSceneGraph QT lib) library after osg 3.2 compile with cmake GUI
OpenGL QT 4 code does not display QLogo (helloworld example) in QT5
QLineEdit to accept only one character/digit
Qt development environment for Nucleus RTOS? [closed]
QML: update item of QSortFilterProxyModel when source item changed
can't compile Qt qextserialport library
How to optimize this Qt code (QByteArray conversion)?

Categories

HOME
automapper
freeradius
android-fragments
plpgsql
android-emulator
elk-stack
repair
clone
gprs
native-base
timber
lc3
fireloop
amazon-emr
amazon-elb
squirrel-sql
tomcat8
asciimath
string-formatting
activeadmin
intel
jpa-2.1
morris.js
hdmi
ruby-daemons
python-imageio
ccavenue
tsung
ibm-connections
unmarshalling
xenapp
netbios
publishing
universal
private-key
microsoft-certifications
cmis
pdfminer
installanywhere
django-crispy-forms
ng-repeat
sspi
grails-spring-security
cloudera-sentry
cyanogenmod
karabiner
node-apn
rcharts
polymaps
degrees
cognos-tm1
multi-touch
metabase
xcode6.4
dcount
jpda
meld
noclassdeffounderror
seadragon
apple
componentart
dbmigrate
microsoft-expression-web
thoughtworks-go
datagridcomboboxcolumn
cout
xml-signature
window-resize
multivariate-testing
treeline
jomsocial
acceptance-testing
tfs-sdk
cgrectmake
gamesalad
nsfont
dropshadow
background-repeat
odac
cleartype
dm
jboss-mdb
gui-designer

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile