{"id":363,"date":"2011-07-31T12:17:14","date_gmt":"2011-07-31T19:17:14","guid":{"rendered":"http:\/\/www.lothlorien.com\/kf6gpe\/?p=363"},"modified":"2011-07-31T12:17:14","modified_gmt":"2011-07-31T19:17:14","slug":"yet-more-qt-tips","status":"publish","type":"post","link":"https:\/\/www.lothlorien.com\/kf6gpe\/yet-more-qt-tips\/","title":{"rendered":"Yet more Qt tips&#8230;"},"content":{"rendered":"<p>Two more for you! <\/p>\n<p><strong>Shared Data<\/strong><br \/>\nLike Qt&#8217;s copy-on-write shared data semantics? Want to do the same for your own class? It&#8217;s easier than you think. Simply inherit from <code>QSharedData<\/code>, which provides the necessary reference-counting semantics. See <a href=\"http:\/\/doc.qt.nokia.com\/latest\/implicit-sharing.html#implicitly-shared\">here<\/a> for more info.<\/p>\n<p><strong>Running a Slot on a Different Thread<\/strong><br \/>\nSometimes you want to schedule a single operation on a different thread; you can do this using <code>QObject::moveToThread<\/code> to move an object&#8217;s thread affinity to a different thread, and then trigger the slot as a queued connection. See <a href=\"http:\/\/doc.qt.nokia.com\/latest\/threads-qobject.html\">here<\/a> for a discussion of how Qt&#8217;s threads and Qt&#8217;s object system cooperate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Two more for you! Shared Data Like Qt&#8217;s copy-on-write shared data semantics? Want to do the same for your own class? It&#8217;s easier than you think. Simply inherit from QSharedData, which provides the necessary reference-counting semantics. See here for more info. Running a Slot on a Different Thread Sometimes you want to schedule a single &hellip; <a href=\"https:\/\/www.lothlorien.com\/kf6gpe\/yet-more-qt-tips\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Yet more Qt tips&#8230;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,9],"tags":[],"class_list":["post-363","post","type-post","status-publish","format-standard","hentry","category-mobile","category-programming"],"_links":{"self":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/363"}],"collection":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":3,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"predecessor-version":[{"id":366,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/posts\/363\/revisions\/366"}],"wp:attachment":[{"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lothlorien.com\/kf6gpe\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}