are you ring is very ok?
2010-09-03
liaoyong_idmt
发件人: Christian Akesson
发送时间: 2010-09-01 06:38:36
收件人: python_inside_maya
抄送:
主题: Re: [Maya-Python] PyQt collapsible GroupBox or Layout
Thanks for the replies guys.
Judah, I would be interested in this approach for a more complete approach, but
I am not quite sure how to go about this or where to start. Would you have any
good pointers?
I ended up with an interim solution for the time being using the checkbox of
the QGroupBox. I found that object.sizeHint() is really nice as it tells you
what width, height the object should be. I ended up setting the height so that
it would work for anything inside the groupBox.
Added code example below...a bit hacky, but it works.
/Thanks
Christian
# Signal Connection
self.connect(self.aGroupBox, SIGNAL("clicked()"), lambda gBox =
"self.aGroupBox": self.collapse(gBox))
def collapse(self, gBox):
""" Collapses a QGroupBox """
# Find out if the state is on or off
gbState = eval(gBox + '.isChecked()')
if not gbState:
eval (gBox + '.setFixedHeight(15)')
# Set window Height
self.setFixedHeight(self.sizeHint().height())
else:
oSize = eval(gBox + '.sizeHint()')
eval(gBox + '.setFixedHeight(oSize.height())')
# Set window Height
self.setFixedHeight(self.sizeHint().height())
/Christian
On Mon, Aug 30, 2010 at 5:45 PM, James Robison <[email protected]> wrote:
You can create a signal between the value 'toggled(bool)' of the checkbox from
a QGroupBox to the 'setVisible(bool)' of a QFrame, which will function like a
collpasible area.
example attached.
cheers
James
On Tue, Aug 31, 2010 at 4:37 AM, Christian Akesson <[email protected]> wrote:
Really sorry to hit this group with a question regarding PyQt, but I know there
is a lot of skillz in here that does not only pertains to pyMel.
I have grown very accustomed to Maya's collapsible frame layout functionality
and having the collapse action recalculating and setting the window size.
Transitioning over to (py)Qt, I was disappointed to find that nothing seems to
be collapsible in Qt land (at least not according to my Google searches).
I actually need this functionality outside of Maya as well as in Maya, so I
need to find a Qt solution and not a Maya solution.
Has anyone managed to get PyQt layouts, GroupBox (preferred) or anything to
collapse and give space in the UI for more functionality?
Would really appreciate any pointers.
Thanks,
/Christian
--
http://groups.google.com/group/python_inside_maya
--
http://groups.google.com/group/python_inside_maya
--
http://groups.google.com/group/python_inside_maya
--
http://groups.google.com/group/python_inside_maya<<FoxmailIcon2: [email protected]>>
