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

The second addMapping() can not work using QDataWidgetMapper
How to delete content from QPixMap
Creating Window That Has No Close Button in Qt
How To Insert Data which is generated From Qt App into MySQL Database through PHP?
Sqlite for client server program
How to get NavigationKey.up value in qml and c++?
Qt and Boost (installed through Homebrew) result in Qt compile errors
How record Qt Widgets StyleSheet in a sepatated file
How to get a activeFocusItem property in qml from main.cpp?
Impementation of QListView with MouseDoubleClick Event
QNetworkAccessManager: Associate response with request
How can I open second qml page on button click
QT5.5.1 nmake - unknown flag '-' For usage error
Adding custom properties to QML type
How do I run clean from qmake?
Pass QModelIndex instead of QString when QCompleter highlighted

Categories

HOME
jboss
magento2
firebase
protocol-buffers
macos-sierra
mc
d3.js
qc
systemd
devexpress
iverilog
bing-search
ipv6
bittorrent
impala
capistrano
swarm
game-maker
squirrel-sql
complexity-theory
nest-api
string-formatting
codefluent
yii2-basic-app
akka-persistence
tableview
uislider
generator
animated-gif
environment
hdmi
ruby-daemons
boolean-logic
fatfs
docx4j
dotcms
quick-nimble
wampsharp
epplus
overwrite
cloveretl
transform
stackpanel
jslint
cloudera-quickstart-vm
gitolite
classnotfoundexception
pyttsx
elasticsearch-aggregation
nuclio
viewmodel
icecast
libreoffice-writer
brightscript
simple-schema
line-intersection
glimpse
lvalue
alertify
d3v4
email-injection
yargs
ogg
dcount
system.net.mail
jtag
groovyfx
perforce-integrate
flush
voronoi
outlook.com
perceptron
msgpack
stack-smash
screen-orientation
supercomputers
darwin
ipod
physicsjs
python-c-extension
rebar
zend-mail
webmethod
box2dweb
siena
radius-protocol
visual-c++-2005
django-filebrowser
contextswitchdeadlock
getopt-long
jdom
jzmq
prefuse
flymake
fbml
groovy-console
getopts
jmenu
servlet-container
git-log
yahoo-maps
3270
tso
efs
service-factory
parentid

Resources

Encrypt Message