本文整理汇总了Python中qt.QWidget类的典型用法代码示例。如果您正苦于以下问题:Python QWidget类的具体用法?Python QWidget怎么用?Python QWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
QWidget.__init__(self)
self.textBrowser = QTextBrowser(self)
self.textBrowser.setTextFormat(QTextBrowser.LogText)
self.lineEdit = QLineEdit(self)
self.startButton = QPushButton(self.tr("Start"), self)
self.stopButton = QPushButton(self.tr("Stop"), self)
self.stopButton.setEnabled(False)
self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.startCommand)
self.connect(self.startButton, SIGNAL("clicked()"), self.startCommand)
self.connect(self.stopButton, SIGNAL("clicked()"), self.stopCommand)
layout = QGridLayout(self, 2, 3)
layout.setSpacing(8)
layout.addMultiCellWidget(self.textBrowser, 0, 0, 0, 2)
layout.addWidget(self.lineEdit, 1, 0)
layout.addWidget(self.startButton, 1, 1)
layout.addWidget(self.stopButton, 1, 2)
self.process = QProcess()
self.connect(self.process, SIGNAL("readyReadStdout()"), self.readOutput)
self.connect(self.process, SIGNAL("readyReadStderr()"), self.readErrors)
self.connect(self.process, SIGNAL("processExited()"), self.resetButtons)
示例2: closeEvent
def closeEvent( self, event ):
"""Redefinicion del closeEvent de qt"""
QWidget.closeEvent( self, event )
if not self.parent.vprincipal.isVisible():
qApp.exit(0)
else:
self.hide()
示例3: __init__
def __init__(self, parent, umlmachines, name="InstallerWidget"):
QWidget.__init__(self, parent, name)
self.resize(600, 600)
self.app = get_application_pointer()
self.conn = self.app.conn
self.umlmachines = umlmachines
self.machine = self.umlmachines.current
self.current_machine_process = "start"
self.current_profile = None
self.current_trait = None
self.traitlist = []
self.curenv = CurrentEnvironment(self.conn, self.machine)
self.curenv["current_profile"] = "None"
self.curenv["current_trait"] = "None"
self.curenv["current_machine_process"] = self.current_machine_process
self.timer = QTimer(self)
self.connect(self.timer, SIGNAL("timeout()"), self.update_progress)
self.timer.startTimer(1000)
self.grid = QGridLayout(self, 4, 1, 5, 7)
self.main_label = QLabel(self)
self.main_label.setText(self._msg())
self.grid.addWidget(self.main_label, 0, 0)
self.profile_progress_lbl = QLabel(self)
self.grid.addWidget(self.profile_progress_lbl, 1, 0)
self.profile_progress = KProgress(self)
self.grid.addWidget(self.profile_progress, 2, 0)
self.logview = LogBrowser(self, "/tmp/uml-installer.log")
self.grid.addWidget(self.logview, 3, 0)
# self.console_view = StdOutBrowser(self)
# self.console_view = KTextBrowser(self)
# self.grid.addWidget(self.console_view, 4, 0)
self.console_text = ""
示例4: __init__
def __init__(self, interfazdato, cajadisponible):
"""Caja disponible son los elementos que aparecen a la izquierda en el selector"""
#VARIABLES PUBLICAS
QWidget.__init__(self, None, "selector", 0)
image1 = QPixmap(IMAGE1DATA)
image2 = QPixmap(IMAGE2DATA)
selectorsimplelayout = QHBoxLayout(self, 11, 6, "WSelectorSimpleLayout")
layout2 = QVBoxLayout(None, 0, 6, "layout2")
widgetstack1 = QWidgetStack(self, "staaack")
widgetstack1.addWidget(cajadisponible)
widgetstack1.raiseWidget(cajadisponible)
widgetstack1.setSizePolicy(QSizePolicy(\
QSizePolicy.Expanding, QSizePolicy.Expanding, \
0, 0, widgetstack1.sizePolicy().hasHeightForWidth()))
self._cajadisponible = cajadisponible
layout2.addWidget(widgetstack1)
selectorsimplelayout.addLayout(layout2)
layout1 = QVBoxLayout(None, 0, 6, "layout1")
self.__pushbutton1 = QPushButton(self, "pushButton1")
self.__pushbutton1.setMaximumSize(QSize(30, 30))
self.__pushbutton1.setPixmap(image1)
layout1.addWidget(self.__pushbutton1)
spacer1 = QSpacerItem(30, 122, QSizePolicy.Minimum, QSizePolicy.Expanding)
layout1.addItem(spacer1)
self.__pushbutton2 = QPushButton(self,"pushButton2")
self.__pushbutton2.setMaximumSize(QSize(30, 30))
self.__pushbutton2.setPixmap(image2)
self.__pushbutton2.setAccel("Del")
layout1.addWidget(self.__pushbutton2)
selectorsimplelayout.addLayout(layout1)
layout3 = QVBoxLayout(None, 0, 6, "layout3")
self._textlabel2 = QLabel(self, "textLabel2")
layout3.addWidget(self._textlabel2)
self._cajaseleccion = QListBox(self,"cajaseleccion")
self._cajaseleccion.setMinimumSize(QSize(0, 60))
layout3.addWidget(self._cajaseleccion)
selectorsimplelayout.addLayout(layout3)
self._cajaseleccion.setSizePolicy(QSizePolicy(\
QSizePolicy.Expanding,QSizePolicy.Expanding, 0, 0, \
self._cajaseleccion.sizePolicy().hasHeightForWidth()))
self.setCaption("Form1")
self._textlabel2.setText(u"Selección")
self.resize(QSize(294, 240).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.__conexiones()
#Miembros !qt
self.seleccion = []
self._dato = interfazdato
示例5: __init__
def __init__(self, parent, name='TestConfigTab'):
QWidget.__init__(self, parent, name)
self.grid = QGridLayout(self, 2, 1, 0, 1, 'TestConfigTabLayout')
self.textbrowser = KTextBrowser(self)
self.grid.addWidget(self.textbrowser, 0, 0)
self.button = KPushButton(self)
self.button.setText('test get_config')
self.grid.addWidget(self.button, 1, 0)
示例6: __init__
def __init__(self, parent, text='', name='LabeledProgress'):
QWidget.__init__(self, parent, name)
self.grid = QGridLayout(self, 2, 1, 5, 7)
self.label = QLabel(self)
if text:
self.label.setText(text)
self.progressbar = SimpleProgress(self)
self.grid.addWidget(self.label, 0, 0)
self.grid.addWidget(self.progressbar, 1, 0)
示例7: set_board_widget
def set_board_widget(self, board_widget):
self.board_widget = board_widget
layout = QHBoxLayout()
layout.addWidget(board_widget, 2)
layout.addWidget(self.create_sidebar_widget())
central_widget = QWidget(self)
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)
self.repaint()
示例8: __init__
def __init__(self, parent, name="SoundBlasterHardwareOptions"):
QWidget.__init__(self, parent, name)
numrows = 2
numcols = 1
margin = 0
space = 1
self.grid = QGridLayout(self, numrows, numcols, margin, space, "SoundBlasterHardwareOptionsLayout")
self._default_oplmodes = ["auto", "cms", "opl2", "dualopl2", "opl3"]
self.oplmode_box = ConfigComboBoxWidget(self, "OPL mode", self._default_oplmodes)
self.grid.addWidget(self.oplmode_box, 0, 0)
self.oplrate_box = SampleRateOption(self, "OPL sample rate")
self.grid.addWidget(self.oplrate_box, 1, 0)
示例9: __init__
def __init__(self, parent, fields=[], data={}, name='VariablesEditor'):
QWidget.__init__(self, parent, name)
self.initPaellaCommon()
self.grid = QGridLayout(self, len(fields), 2, 1, -1, 'VariablesEditorLayout')
self.fields = fields
self.fields.sort()
self._data = data
self.entries = {}
self._labels = {}
if fields:
self._setup_grid()
self.grid.setSpacing(7)
self.grid.setMargin(10)
示例10: setupInputFrame
def setupInputFrame(self, parent=None):
if not parent:
parent = self.layout
self.bgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
self.bgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
self.bgMultiVolumeSelector.addEnabled = 0
self._bgMultiVolumeSelectorLabel = QLabel('Input multivolume')
inputFrameWidget = QWidget()
self.inputFrameLayout = QFormLayout()
inputFrameWidget.setLayout(self.inputFrameLayout)
self.inputFrameLayout.addRow(self._bgMultiVolumeSelectorLabel, self.bgMultiVolumeSelector)
parent.addWidget(inputFrameWidget)
示例11: __init__
def __init__(self, app, parent, dtype='trait', name='BaseDiffer'):
QWidget.__init__(self, parent, name)
dbwidget(self, app)
self.dtype = dtype
if dtype == 'trait':
boxtype = SuiteTraitCombo
elif dtype == 'family':
boxtype = FamilyList
self.leftBox = boxtype(self.app, self, 'leftBox')
self.rightBox = boxtype(self.app, self, 'rightBox')
self.vbox = QVBoxLayout(self)
self.list_hbox = QHBoxLayout(self.vbox, 5)
self.list_hbox.addWidget(self.leftBox)
self.list_hbox.addWidget(self.rightBox)
示例12: setup
def setup(self):
self.widget = QWidget()
layout = QGridLayout()
self.widget.setLayout(layout)
self.layout.addWidget(self.widget)
self.widget.show()
self.layout = layout
self.setupInputFrame()
self.setupFrameControlFrame()
self.setupAdditionalFrames()
self.setupPlottingFrame()
self.setFramesEnabled(False)
self.timer = QTimer()
self.timer.setInterval(50)
self.setupConnections()
# initialize slice observers (from DataProbe.py)
# keep list of pairs: [observee,tag] so they can be removed easily
self.styleObserverTags = []
# keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic
self.sliceWidgetsPerStyle = {}
self.refreshObservers()
示例13: create_sidebar_widget
def create_sidebar_widget(self):
self.lcd_widget = QLCDNumber(self)
self.lcd_widget.setFixedHeight(100)
self.set_score(0, 0)
self.log_widget = QPlainTextEdit(self)
sidebar = QWidget(self)
sidebar_layout = QVBoxLayout()
sidebar_layout.addWidget(self.lcd_widget)
sidebar_layout.addWidget(self.log_widget)
sidebar.setLayout(sidebar_layout)
sidebar.setFixedWidth(250)
return sidebar
示例14: sizeHint
def sizeHint(self):
"""we never want a horizontal scrollbar for player names,
we always want to see them in full"""
result = QWidget.sizeHint(self)
available = KApplication.kApplication().desktop().availableGeometry()
height = max(result.height(), available.height() * 2 // 3)
width = max(result.width(), available.width() // 2)
return QSize(width, height)
示例15: __init__
def __init__(self, parent, umlmachines, name='RunnerWidget'):
QWidget.__init__(self, parent, name)
self.app = get_application_pointer()
self.umlmachines = umlmachines
self.proc = self.umlmachines.run_machine()
self._mainbox = QVBoxLayout(self, 5, 7)
# add label
self.mainlabel = QLabel(self)
self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current)
self._mainbox.addWidget(self.mainlabel)
# add stdout viewer
logfile = self.umlmachines.stdout_logfile.name
self.logbrowser = LogBrowser(self, logfile)
self._mainbox.addWidget(self.logbrowser)
self.timer = QTimer(self)
self.connect(self.timer, SIGNAL('timeout()'), self.update_progress)
self.timer.startTimer(1000)