c++ - Qt/OO best practices: connecting signals and slots -


i'm relatively light on qt experience, though it. 1 thing i'm uncertain of best place connect signals slots. here's example small device touchscreen:

i have class called radiomodel owned qapplication. qapplication owns call viewcontroller. viewcontroller owns view - i.e. of widgets make user interface. there hierarchy ui widgets, of course. top-level widget qhboxlayout, has indicator labels @ top, , qtabwidget @ bottom. qtabwidget has 3 screens, each things qlabels, qgroupboxes, qcomboboxes, etc.

the model needs signaled when values in qgroupboxes , qcomboboxes change. initial thought have chain this:

qradiobutton (part of qgroupbox) signals clicked(), goes slot of current tab of qtabwidget, looks @ sender determine value (which radio button) clicked, emits own signal radiochanged. radiochanged signal connected viewcontroller's radiochanged signal, in turn connected model's updateradio slot.

generally speaking, when widget isolated model emits signal of interest, fair have long chain of signals , slots value change model? better pass model viewcontroller , possibly of objects signals can connected shorter path?

thanks - hope understandable , not subjective..

i implement mine 'the controller controls flow of data'. gets signals view. updates model needed. view knows nothing model , vice versa.

i notice said you're signaling each user input change. can inefficient , makes difficult cancel half made changes. let user change fields , update model when ok button pressed.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -