本文整理汇总了Python中PyQt4.Qt.QSplitter.moveSplitter方法的典型用法代码示例。如果您正苦于以下问题:Python QSplitter.moveSplitter方法的具体用法?Python QSplitter.moveSplitter怎么用?Python QSplitter.moveSplitter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QSplitter
的用法示例。
在下文中一共展示了QSplitter.moveSplitter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_PartWindow
# 需要导入模块: from PyQt4.Qt import QSplitter [as 别名]
# 或者: from PyQt4.Qt.QSplitter import moveSplitter [as 别名]
#.........这里部分代码省略.........
self.pwProjectTabWidget.addTab(
self.propertyManagerScrollArea,
geticon("ui/modeltree/Property_Manager.png"),
"")
self.pwProjectTabWidget.setCurrentIndex(
self.pwProjectTabWidget.indexOf(self.propertyManagerScrollArea))
return
def KLUGE_current_PropertyManager(self):
#bruce 070627; revised 070829 as part of fixing bug 2523
"""
Return the current Property Manager widget (whether or not its tab is
chosen, but only if it has a tab), or None if there is not one.
@warning: This method's existence (not only its implementation)
is a kluge, since the right way to access that would be by asking
the "command sequencer";
but that's not yet implemented, so this is the best we can do for now.
Also, it would be better to get the top command and talk to it, not
its PM (a QWidget). Also, whatever calls this will be making
assumptions about that PM which are really only the command's business.
So in short, every call of this is in need of cleanup once we have a
working "command sequencer". (That's true of many things related to
PMs, not only this method.)
@warning: The return values are (presumably) widgets, but they can
also be mode objects and generator objects, due to excessive use of
multiple inheritance in the current PM code. So be careful what you
do with them -- they might have lots of extra methods/attrs,
and setting your own attrs in them might mess things up.
"""
res = self.propertyManagerScrollArea.widget()
if not hasattr(res, 'done_btn'):
# not sure what widget this is otherwise, but it is a widget
# (not None) for the default mode, at least on startup, so just
# return None in this case
return None
# Sometimes this PM remains present from a prior command, even when
# there is no longer a tab for the PM. As part of fixing bug 2523
# we have to avoid returning it in that case. How we do that is a kluge,
# but hopefully this entire kluge function can be dispensed with soon.
# This change also fixes bug 2522 on the Mac (but not on Windows --
# for that, we needed to intercept removeTab in separate code above).
index = self.pwProjectTabWidget.indexOf(
self.propertyManagerScrollArea)
if index == -1:
return None
# Due to bugs in other code, sometimes the PM tab is left in place,
# though the PM itself is hidden. To avoid finding the PM in that case,
# also check whether it's hidden. This will fix the CC part of a new bug
# just reported by Keith in email (when hitting Ok in DNA Gen).
if res.isHidden(): # probably a QWidget method [bruce 080205 comment]
return None
return res
def dismiss(self):
self.parent.removePartWindow(self)
return
def setSplitterPosition(self, pos = PM_DEFAULT_WIDTH, setDefault = True):
"""
Set the position of the splitter between the left area and graphics area
so that the width of the container holding the model tree (and
property manager) is I{pos} pixels wide.
@param pos: The splitter position (in pixel units).
@type pos: int
@param setDefault: If True (the default), I{pos} becomes the new default
position.
@type setDefault: boolean
"""
self.pwSplitter.moveSplitter(pos, 1)
if _DEBUG:
print "New Splitter Position: %d (setDefault=%d)" \
% (pos, setDefault)
if setDefault:
self.splitterPosition = pos
return
def resizeEvent(self, event):
"""
This reimplementation of QWidget.resizeEvent is here to deal with the
undesired behavior of the splitter while resizing the part window.
Normally, the splitter will drift back and forth while resizing
the part window. This forces the splitter to stay fixed during
resize operations.
"""
# When self.resizeTimer.isActive() = True, the partwindow is being
# resized. This is checked by the resizeEvent handler in LeftFrame
# to determine if the splitter is being moved by the user or
# programmably by self's resizeEvent.
if self.resizeTimer.isActive():
self.resizeTimer.stop() # Stop the timer.
self.resizeTimer.start( 500 ) # (Re)strand a .5 second singleshot timer.
self.setSplitterPosition(self.splitterPosition, setDefault = False)
QWidget.resizeEvent(self, event)
return