Loading Model into a QHBoxLayout

29 views
Skip to first unread message

Bay

unread,
Oct 15, 2013, 3:23:57 PM10/15/13
to python_in...@googlegroups.com
Been continuing to do Yasin's tutorials on PyQT, a problem I've been running into now is that I can't seemed to be able to get my gui to display properly. What I'm trying to get is something similar to http://rowinggolfer.blogspot.com/2010/05/qtreeview-and-qabractitemmodel-example.html

However, I haven't had much luck in trying in achieving that. Could anyone possibly point out what I've been doing wrong? 

Thank you
Gann Boon Bay
selectorGUI.py
Message has been deleted

Bay

unread,
Oct 15, 2013, 7:23:27 PM10/15/13
to python_in...@googlegroups.com
Hi,
 
        just want to explain better the problem I'm having. While I'm getting my selection list showing up properly(Staying a fixed size, and leaving room for the buttons) I have not been able to get my buttons to display below the list, or the QHBoxLayout that I've used. Would appreciate any help. Attached is an updated script. 
selectorGUI.py

dgovil

unread,
Oct 15, 2013, 7:29:49 PM10/15/13
to python_in...@googlegroups.com

hey Bay,
Can you post a picture of what your ui looks like right now or share the testtree file too? It’s hard to run the code without it.

Anyway, the easiest thing I can see is that you probably need a widget to apply your button_layout for.

# Line 64
button_widget = QtGui.QWidget()
button_layout = QtGui.QHBoxLayout(button_widget) 

# Line 72
self.layout.addWidget(button_layout)

dgovil

unread,
Oct 15, 2013, 7:31:46 PM10/15/13
to python_in...@googlegroups.com
Sorry, correction, my code should be: 
self.layout.addWidget(button_widget)


Similarly, you can do the same for the treeview_layout. 
Message has been deleted

Bay

unread,
Oct 15, 2013, 7:47:32 PM10/15/13
to python_in...@googlegroups.com
Hi thanks for the response. Attached is also the test scene that I used just to make sure the inputs are displaying properly. 
testscene1.ma
testtree.py
selectorGUI.py

Bay

unread,
Oct 16, 2013, 5:00:12 AM10/16/13
to python_in...@googlegroups.com
Thanks for the offer dgovil but I was able to get it working. It seems my mistake was not putting all my layouts and widgets on a main layout/widget then using setCentralWidget()

dgovil

unread,
Oct 16, 2013, 5:05:49 PM10/16/13
to python_in...@googlegroups.com
Here you go. Had to make some changes to your code to make it work.
You had set your central layout to the treeview layout. You actually need to set it to the layout that contains everything you need.


bay.py

Bay

unread,
Oct 16, 2013, 6:04:23 PM10/16/13
to python_in...@googlegroups.com
Hi dgovil, 
             Aye that's what I ended up discovering. Thanks however!
Reply all
Reply to author
Forward
0 new messages