在使用QtDesigner生成的窗口小部件optim_plotting_frame.py时,我在QWidget上看到了慢速旋转和网格覆盖曲面的问题。以下是小部件的代码:
import sys
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_optim_plotting_frame(object):
def setupUi(self, optim_plotting_frame):
optim_plotting_frame.setObjectName(_fromUtf8("optim_plotting_frame"))
optim_plotting_frame.setWindowModality(QtCore.Qt.ApplicationModal)
optim_plotting_frame.resize(700, 580)
optim_plotting_frame.setWindowTitle(QtGui.QApplication.translate("optim_plotting_frame", "Plotting", None, QtGui.QApplication.UnicodeUTF8))
self.verticalLayout_2 = QtGui.QVBoxLayout(optim_plotting_frame)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label_function = QtGui.QLabel(optim_plotting_frame)
self.label_function.setMinimumSize(QtCore.QSize(111, 16))
self.label_function.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.label_function.setToolTip(QtGui.QApplication.translate("optim_plotting_frame", "defines radial basis function for interpolation", None, QtGui.QApplication.UnicodeUTF8))
self.label_function.setText(QtGui.QApplication.translate("optim_plotting_frame", "\n"
"\n"
"p, li { white-space: pre-wrap; }\n"
"\n"
"Interpolation function:", None, QtGui.QApplication.UnicodeUTF8))
self.label_function.setObjectName(_fromUtf8("label_function"))
self.verticalLayout.addWidget(self.label_function)
self.cmb_function = QtGui.QComboBox(optim_plotting_frame)
self.cmb_function.setMinimumSize(QtCore.QSize(111, 22))
self.cmb_function.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.cmb_function.setToolTip(QtGui.QApplication.translate("optim_plotting_frame", "defines radial basis function for interpolation", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.setObjectName(_fromUtf8("cmb_function"))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(0, QtGui.QApplication.translate("optim_plotting_frame", "multiquadric", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(1, QtGui.QApplication.translate("optim_plotting_frame", "inverse", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(2, QtGui.QApplication.translate("optim_plotting_frame", "gaussian", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(3, QtGui.QApplication.translate("optim_plotting_frame", "linear", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(4, QtGui.QApplication.translate("optim_plotting_frame", "cubic", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(5, QtGui.QApplication.translate("optim_plotting_frame", "quintic", None, QtGui.QApplication.UnicodeUTF8))
self.cmb_function.addItem(_fromUtf8(""))
self.cmb_function.setItemText(6, QtGui.QApplication.translate("optim_plotting_frame", "thin_plate", None, QtGui.QApplication.UnicodeUTF8))
self.verticalLayout.addWidget(self.cmb_function)
self.label_alpha = QtGui.QLabel(optim_plotting_frame)
self.label_alpha.setMinimumSize(QtCore.QSize(111, 16))
self.label_alpha.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.label_alpha.setToolTip(QtGui.QApplication.translate("optim_plotting_frame", "Defines transparency: 0 - transparent, 1 - not transparent", None, QtGui.QApplication.UnicodeUTF8))
self.label_alpha.setText(QtGui.QApplication.translate("optim_plotting_frame", "Alpha:", None, QtGui.QApplication.UnicodeUTF8))
self.label_alpha.setObjectName(_fromUtf8("label_alpha"))
self.verticalLayout.addWidget(self.label_alpha)
self.dspb_alpha = QtGui.QDoubleSpinBox(optim_plotting_frame)
self.dspb_alpha.setMinimumSize(QtCore.QSize(111, 0))
self.dspb_alpha.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.dspb_alpha.setToolTip(QtGui.QApplication.translate("optim_plotting_frame", "Defines transparency: 0 - transparent, 1 - not transparent", None, QtGui.QApplication.UnicodeUTF8))
self.dspb_alpha.setMaximum(1.0)
self.dspb_alpha.setSingleStep(0.1)
self.dspb_alpha.setProperty("value", 0.7)
self.dspb_alpha.setObjectName(_fromUtf8("dspb_alpha"))
self.verticalLayout.addWidget(self.dspb_alpha)
self.label_smooth = QtGui.QLabel(optim_plotting_frame)
self.label_smooth.setMinimumSize(QtCore.QSize(111, 16))
self.label_smooth.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.label_smooth.setToolTip(QtGui.QApplication.translate("optim_plotting_frame", "Smoothness of the approximation", None, QtGui.QApplication.UnicodeUTF8))
self.label_smooth.setText(QtGui.QApplication.translate("optim_plotting_frame", "Smoothness:", None, QtGui.QApplication.UnicodeUTF8))
self.label_smooth.setObjectName(_fromUtf8("label_smooth"))
self.verticalLayout.addWidget(self.label_smooth)
self.dspb_smooth = QtGui.QDoubleSpinBox(optim_plotting_frame)
self.dspb_smooth.setMinimumSize(QtCore.QSize(111, 0))
self.dspb_smooth.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.dspb_smooth.setToolTip(QtGui.QApplication.translate("optim_plotting_frame", "Smoothness of the approximation", None, QtGui.QApplication.UnicodeUTF8))
self.dspb_smooth.setSingleStep(0.1)
self.dspb_smooth.setObjectName(_fromUtf8("dspb_smooth"))
self.verticalLayout.addWidget(self.dspb_smooth)
self.chb_normxy = QtGui.QCheckBox(optim_plotting_frame)
self.chb_normxy.setText(QtGui.QApplication.translate("optim_plotting_frame", "normalized x,y ticks", None, QtGui.QApplication.UnicodeUTF8))
self.chb_normxy.setChecked(True)
self.chb_normxy.setObjectName(_fromUtf8("chb_normxy"))
self.verticalLayout.addWidget(self.chb_normxy)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.horizontalLayout.addLayout(self.verticalLayout)
self.widget = QtGui.QWidget(optim_plotting_frame)
self.widget.setFocusPolicy(QtCore.Qt.StrongFocus)
self.widget.setObjectName(_fromUtf8("widget"))
self.horizontalLayout.addWidget(self.widget)
self.horizontalLayout.setStretch(1, 10)
self.verticalLayout_2.addLayout(