本文整理汇总了Python中Qt.QtWidgets.QDialog方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QDialog方法的具体用法?Python QtWidgets.QDialog怎么用?Python QtWidgets.QDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qt.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QDialog方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: accept
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def accept(self):
"""Save settings when dialog is accepted"""
settings = QtCore.QSettings()
settings.setValue("smooth_length", self.windowLengthSpinBox.value())
settings.setValue("smooth_window", self.windowFunctionComboBox.currentText())
QtWidgets.QDialog.accept(self)
示例2: accept
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def accept(self):
"""Save settings when dialog is accepted"""
settings = QtCore.QSettings()
settings.setValue("backend", self.backendComboBox.currentText())
settings.setValue("executable", self.executableEdit.text())
settings.setValue("params", self.paramsEdit.text())
settings.setValue("device", self.deviceEdit.text())
settings.setValue("sample_rate", self.sampleRateSpinBox.value() * 1e6)
settings.setValue("bandwidth", self.bandwidthSpinBox.value() * 1e6)
settings.setValue("lnb_lo", self.lnbSpinBox.value() * 1e6)
settings.setValue("waterfall_history_size", self.waterfallHistorySizeSpinBox.value())
QtWidgets.QDialog.accept(self)
示例3: accept
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def accept(self):
"""Save settings when dialog is accepted"""
settings = QtCore.QSettings()
settings.setValue("baseline_file", self.baselineFileEdit.text())
QtWidgets.QDialog.accept(self)
示例4: accept
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def accept(self):
"""Save settings when dialog is accepted"""
settings = QtCore.QSettings()
settings.setValue("main_color", color_to_str(self.mainColorButton.color()))
settings.setValue("peak_hold_max_color", color_to_str(self.peakHoldMaxColorButton.color()))
settings.setValue("peak_hold_min_color", color_to_str(self.peakHoldMinColorButton.color()))
settings.setValue("average_color", color_to_str(self.averageColorButton.color()))
settings.setValue("persistence_color", color_to_str(self.persistenceColorButton.color()))
settings.setValue("baseline_color", color_to_str(self.baselineColorButton.color()))
QtWidgets.QDialog.accept(self)
示例5: accept
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def accept(self):
"""Save settings when dialog is accepted"""
settings = QtCore.QSettings()
settings.setValue("persistence_length", self.persistenceLengthSpinBox.value())
settings.setValue("persistence_decay", self.decayFunctionComboBox.currentText())
QtWidgets.QDialog.accept(self)
示例6: showPropertyEditor
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def showPropertyEditor(self):
tree = EditPropertiesTreeWidget()
count = self.contentLayout.count()
folders = {}
for i in range(count):
item = self.contentLayout.itemAt(i)
w = item.widget()
if w:
if w.title() in ["Inputs"]:
for key,group in w.groups.items():
if key not in folders:
folders[key] = {}
#for e in range(group.groupLayout.count()):
# w = group.groupLayout.itemAt(e).widget()
# folders[key][w.getLabel()] = group.groupLayout.itemAt(e).widget()
for fold in folders:
folder = tree.addFolder(fold)
#for widg in folders[fold]:
# child = tree.addNormal(widg,folder)
d = QtWidgets.QDialog()
d.setLayout(QtWidgets.QHBoxLayout())
d.layout().addWidget(tree)
d.exec_()
newOrder = tree.model_to_dict()
示例7: __init__
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def __init__(self, dock=False):
# First lets delete a dock if we have one so that we aren't creating more than we neec
deleteDock()
# Then if we have a UI called lightingManager, we'll delete it so that we can only have one instance of this
# A try except is a very important part of programming when we don't want an error to stop our code
# We first try to do something and if we fail, then we do something else.
try:
pm.deleteUI('lightingManager')
except:
logger.debug('No previous UI exists')
# <=Maya2016: For Maya 2016 and below we always put it inside a QDialog and only dock at the end of this __init__
# Then we create a new dialog and give it the main maya window as its parent
# we also store it as the parent for our current UI to be put inside
parent = QtWidgets.QDialog(parent=getMayaMainWindow())
# We set its name so that we can find and delete it later
# <=Maya2016: This also lets us attach the light manager to our dock control
parent.setObjectName('lightingManager')
# Then we set the title
parent.setWindowTitle('Lighting Manager')
# Finally we give it a layout
dlgLayout = QtWidgets.QVBoxLayout(parent)
# Now we are on to our actual widget
# We've figured out our parent, so lets send that to the QWidgets initialization method
super(LightingManager, self).__init__(parent=parent)
# We call our buildUI method to construct our UI
self.buildUI()
# Now we can tell it to populate with widgets for every light
self.populate()
# We then add ourself to our parents layout
self.parent().layout().addWidget(self)
# Finally if we're not docked, then we show our parent
parent.show()
# <=Maya2016: For Maya 2016 and below we need to create the dock after we create our widget's parent window
if dock:
getDock()
示例8: test_load_ui_dialog
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def test_load_ui_dialog():
"""Tests to see if the baseinstance loading loads a QDialog properly"""
import sys
from Qt import QtWidgets, QtCompat
app = QtWidgets.QApplication(sys.argv)
win = QtWidgets.QDialog()
QtCompat.loadUi(self.ui_qdialog, win)
assert hasattr(win, 'lineEdit'), \
"loadUi could not load instance to main window"
app.exit()
示例9: test_load_ui_existingLayoutOnDialog
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def test_load_ui_existingLayoutOnDialog():
"""Tests to see if loading a ui onto a layout in a Dialog works"""
import sys
from Qt import QtWidgets, QtCompat
msgs = 'QLayout: Attempting to add QLayout "" to QDialog ' \
'"Dialog", which already has a layout'
with ignoreQtMessageHandler([msgs]):
app = QtWidgets.QApplication(sys.argv)
win = QtWidgets.QDialog()
QtWidgets.QComboBox(win)
QtWidgets.QHBoxLayout(win)
QtCompat.loadUi(self.ui_qdialog, win)
app.exit()
示例10: __init__
# 需要导入模块: from Qt import QtWidgets [as 别名]
# 或者: from Qt.QtWidgets import QDialog [as 别名]
def __init__(self, dock=False):
# So first we check if we want this to be able to dock
if dock:
# If we should be able to dock, then we'll use this function to get the dock
parent = getDock()
else:
# Otherwise, lets remove all instances of the dock incase it's already docked
deleteDock()
# Then if we have a UI called lightingManager, we'll delete it so that we can only have one instance of this
# A try except is a very important part of programming when we don't want an error to stop our code
# We first try to do something and if we fail, then we do something else.
try:
pm.deleteUI('lightingManager')
except:
logger.debug('No previous UI exists')
# Then we create a new dialog and give it the main maya window as its parent
# we also store it as the parent for our current UI to be put inside
parent = QtWidgets.QDialog(parent=getMayaMainWindow())
# We set its name so that we can find and delete it later
parent.setObjectName('lightingManager')
# Then we set the title
parent.setWindowTitle('Lighting Manager')
# Finally we give it a layout
dlgLayout = QtWidgets.QVBoxLayout(parent)
# Now we are on to our actual widget
# We've figured out our parent, so lets send that to the QWidgets initialization method
super(LightingManager, self).__init__(parent=parent)
# We call our buildUI method to construct our UI
self.buildUI()
# Now we can tell it to populate with widgets for every light
self.populate()
# We then add ourself to our parents layout
self.parent().layout().addWidget(self)
# Finally if we're not docked, then we show our parent
if not dock:
parent.show()