本文整理汇总了Python中PyQt4.QtCore.qSwap方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.qSwap方法的具体用法?Python QtCore.qSwap怎么用?Python QtCore.qSwap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore
的用法示例。
在下文中一共展示了QtCore.qSwap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rescale
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qSwap [as 别名]
def rescale(self):
"""
Redefine zoomer to set scale major ticks to one .
see qwt_plot_zoomer.cpp line 343
"""
plt = self.plot()
if not plt:
return
rect = self.zoomStack()[self.zoomRectIndex()]
if rect != self.scaleRect():
doReplot = plt.autoReplot()
plt.setAutoReplot(False)
x1 = rect.left()
x2 = rect.right()
if plt.axisScaleDiv(self.xAxis()).lowerBound() > plt.axisScaleDiv(self.xAxis()).upperBound():
QtCore.qSwap(x1, x2)
# re-implemented axis so that there are only major ticks with step 1.0
# original CPP code: plt.setAxisScale(self.xAxis(), x1, x2)
plt.setAxisScale(self.xAxis(), x1, x2, 1.0)
y1 = rect.top()
y2 = rect.bottom()
if plt.axisScaleDiv(self.yAxis()).lowerBound() > plt.axisScaleDiv(self.yAxis()).upperBound():
QtCore.qSwap(y1, y2)
plt.setAxisScale(self.yAxis(), y1, y2)
plt.setAutoReplot(doReplot)
plt.replot()