<div dir="ltr">Where is the QML code that is not working? I think you might just be having a problem with layout in QML. One thing to note is that by default components don't have a width and a height so you need to either specify them directly or with Layout.fillWidth: true </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 22, 2016 at 9:58 PM, Louis Simons <span dir="ltr"><<a href="mailto:lousimons@gmail.com" target="_blank">lousimons@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I've been learning (mostly trial and error) PyQt5 with a project at <a href="https://github.com/superlou/snowman-qt-client" target="_blank">https://github.com/<wbr>superlou/snowman-qt-client</a>.  I've tried to do the view layer in QML, with components that need a model backend defined in Python and registered.  For example, the MainBus QML type is registered as a MainBus Python class.  The MainBus Python object then handles some business logic communication to the backend server.  The only gotcha I'm running into is that it seems like the custom QML items extending QtQuickItems don't get positioned properly using layouts or anchors.  I can set x and y positions on them, but that's about it.<div><br></div><div>Is this expected behavior?  I'm starting to think that maybe the intent of registering types is not to directly link a QML "view" to a Python "model."  Is there a more appropriate way to create this kind of architecture?  Would it be more appropriate to create a MainBusModel class, that's used purely as a property of a QML MainBus view?  Another part of me is thinking that I missed the boat altogether, and that my registered type should really be the ManagerConnection (<a href="https://github.com/superlou/snowman-qt-client/blob/master/manager_connection.py" target="_blank">https://github.com/superlou/<wbr>snowman-qt-client/blob/master/<wbr>manager_connection.py</a>), which is really what the Python object is interacting with, and almost all of my logic could be handled in QML.</div><div><br></div><div>I apologize if this is a basic question.  I've been reading the C++ documentation, and while it says "how" to do things, it doesn't really recommend how you structure these kinds of apps.</div></div>
<br>______________________________<wbr>_________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a><br></blockquote></div><br></div>