qt


Appropriate technique to create new object by user on front end in Qt


I'm creating an app that uses qml in the front end to create a new object onclicked. Is the appropriate way to go about this is to create a QOBJECT helper class that will solely serve to instantiate new objects of my other class?
Edit: I am wanting to create a C++ object from the front end with qml. I am not creating a qml object. So, if I click my button, C++ instantiates a new object. That is why I ask if I need to create a specialized QOBJECT class that has a public signal method solely to create new objects of my other class.
Or should I only have one class that can instantiate new objects of itself using a pointer?
The most efficient solution is to employ a singleton. It will avoid to overhead of the factory object lookup, and it will not associate the created object with any particular state, which is known to play tricks with object lifetime.
Additionally, if you create the QML object from C++, you can avoid a fair amount of memory usage bloat. You can also have a C++ object as a singleton:
qmlRegisterSingletonType<YourSingleton>("Module", 1, 0, "Singleton", singletonFactoryCallback);

Related Links

Fixed sized scroll area with layout.
qt rotated image -> polygon
selectedRows() in Qml TreeView with ExtendedSelection is one step behind
ComboBoxStyle QML QT Label not working
Connection of pure virtual signal of interface class
Retain focus of QtWidget on close of QFrame
How to set tab order with promoted widgets?
Windows 10 h264 videos with QMediaPlayer
codesign gives no identity found error
Automator & ffmpeg: Create video from .png image sequence in folder
PyQt: Add icon to right side of QListWidget item
Qt. Rotation objects
What 'model' am I getting in my ListView delegate?
How to manage Focus with States in my custom QML component?
in QT I Can't create project with a Kit
Youtube video not playing in qt webview

Categories

HOME
php
android-espresso
functional-programming
livecode
workflow
apk
nsis
web2py
cryptography
qooxdoo
tfs2015
ipv6
firebase-database
stack-overflow
scrape
rangy
webstore
sql-injection
mahout-recommender
cocos2d-android
gravity
office-ui-fabric
node-webkit
sqlplus
exchange-server-2010
web-config-transform
password-generator
hdmi
amazon-cloudtrail
docx4j
numerics
love2d
aurelia-cli
google-now
assemblies
spring-restcontroller
flowchart
newtons-method
vb.net-to-c#
flipkart
httphandler
virtual-memory
axis
icecast
nothing
brightscript
nusoap
winmerge
popen
glassfish-4.1
boost-compute
ternary-operator
portal
xcode6.4
mathjs
livecycle
cdo.message
oci
verisign
trust
univocity
nastran
dsa
netdatacontractserializer
apple
hmisc
modern.ie
android-handler
clarion
quercus
debug-symbols
tkx
kognitio-wx2
symja
object-code
quantify
communicate
windows-messages
cidr
map
typesafe-stack
pbkdf2
eclim
iirf
virtual-channel
apportable
ldif
ui-design
office-app
cgrectmake
differentiation
glassfish-esb
sql-parametrized-query
qcar-sdk
dip
git-log
oracle-pro-c
zend-test
ppc
source-code-protection
eai
xap
autobench
icon-language
twitter-feed
datagridcolumn
objectinstantiation
downloadfile

Resources

Encrypt Message