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 TextView change scroll-bar style?
expand qgraphicsrectitem to cover complete scene and expand all children's in same proportion
QML: Cannot read property 'xxx' of undefined
Trouble of mutating QList which is actually QVariant without copying it
How to set the position of QMainWindow?
QAudioRecorder detect user not speaking and stop
BB10 Cascades ListView is jittering / shaking
Drop caps in Qt rich text
Transmit QMap by QMimeData
Zoom feature for QWebEngine does not work
How to prevent QWebEngineView to grab focus on setHtml(…) and load(…) calls?
How to use QPainter in QOpenGlWidget's paintGL
QFile error : device not open
QSplitter - When hiding an element contained in a splitter section, resize the section to fit only visible content
Selenium qtwebdriver Example
Qt - How to connect signal from loader item, if loader source changes dynamically

Categories

HOME
ionic2
ontouchlistener
code-formatting
openlayers-3
biztalk
clone
capistrano
joomla3.2
roku
gtk
lc3
xamarin-zebble
lapack
chromecast
vimeo
android-externalstorage
freertos
cloudsim
renderscript
akka-persistence
unity-container
pst
conda
generator
pyopencl
ruby-daemons
php-5.3
django-import-export
audit
copy-protection
windows2012
publishing
python-2.x
adminer
bean-validation
variable-variables
gitolite
praat
jgrapht
android-mediarecorder
lvalue
mechanicalturk
hmmlearn
rational-performance-test
xcode6.4
okio
svnserve
zynq
urbit
swiffy
mercurial-extension
fanotify
ora-04091
knife
featuretoggle
espresso
domino-designer-eclipse
embeddedwebserver
componentart
flow-js
ildasm
qt5.4
storing-data
full-text-indexing
nachos
.htpasswd
radius-protocol
django-sites
lsa
xsd2code
application-server
sql-view
pacman
unicoins
mongo-jackson-mapper
jbox2d
tfs-sdk
ckeditor.net
gitx
sfinae
voice-recording
viewpagerindicator
telerik-ajax
asio
mediacontroller
aggregator
pinax
getimagesize
sqlsitemapprovider

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