本文整理匯總了Python中PyQt4.QtGui.QScrollArea方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QScrollArea方法的具體用法?Python QtGui.QScrollArea怎麽用?Python QtGui.QScrollArea使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QScrollArea方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: quickMsg
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例2: quickMsg
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例3: handler
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def handler(self, event, scrollarea):
modifiers = QtGui.QApplication.keyboardModifiers()
if modifiers != QtCore.Qt.ControlModifier:
QtGui.QScrollArea.wheelEvent(scrollarea, event)
else:
event.ignore()
pass
示例4: about
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def about(self):
QtGui.QMessageBox.about(self, "About Image Viewer",
"<p>The <b>Image Viewer</b> example shows how to combine "
"QLabel and QScrollArea to display an image. QLabel is "
"typically used for displaying text, but it can also display "
"an image. QScrollArea provides a scrolling view around "
"another widget. If the child widget exceeds the size of the "
"frame, QScrollArea automatically provides scroll bars.</p>"
"<p>The example demonstrates how QLabel's ability to scale "
"its contents (QLabel.scaledContents), and QScrollArea's "
"ability to automatically resize its contents "
"(QScrollArea.widgetResizable), can be used to implement "
"zooming and scaling features.</p>"
"<p>In addition the example shows how to use QPainter to "
"print an image.</p>")
示例5: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def __init__(self, parent=None):
QtGui.QScrollArea.__init__(self, parent=parent)
self.setWidgetResizable(True)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
示例6: quickMsg
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def quickMsg(self, msg, block=1, ask=0):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
if ask==0:
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
else:
tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
if block:
value = tmpMsg.exec_()
if value == QtWidgets.QMessageBox.Ok:
return 1
else:
return 0
else:
tmpMsg.show()
return 0
示例7: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def __init__(self,ip='192.168.0.1',port=80,timeout=1000,folder_local='.',
folder_remote='/', instant_run=False, recursive=False, debug_image=None):
super(ImageViewer, self).__init__()
self.folder_local=folder_local
self.folder_remote=folder_remote
self.timeout=timeout
self.ipAddr=ip
self.port=port
self.recursive=False
self.printer = QtGui.QPrinter()
self.scaleFactor = 0.0
self.imageLabel = MyLabel()
self.imageLabel.setBackgroundRole(QtGui.QPalette.Base)
self.imageLabel.setSizePolicy(QtGui.QSizePolicy.Ignored,
QtGui.QSizePolicy.Ignored)
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.wheelEvent = lambda event: self.saeh.handler(event, self.scrollArea)
self.scrollArea.setBackgroundRole(QtGui.QPalette.Dark)
self.scrollArea.setWidget(self.imageLabel)
self.setCentralWidget(self.scrollArea)
self.createActions()
self.createMenus()
self.setWindowTitle("Image Viewer")
self.resize(500, 400)
self.connect(self,QtCore.SIGNAL("load_image(QImage)"),self.load_image)
self.run=True
self.fitToWindowAct.setEnabled(True)
self.fitToWindowAct.setChecked(True)
if(debug_image!=None):
image=QtGui.QImage(debug_image)
self.emit(QtCore.SIGNAL('load_image(QImage)'), image)
return
if(instant_run):
print("Intant running...")
threading.Thread(target=self.image_get).start()
示例8: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def setupUi(self, frmComposerSpatialColumnEditor):
frmComposerSpatialColumnEditor.setObjectName(_fromUtf8("frmComposerSpatialColumnEditor"))
frmComposerSpatialColumnEditor.resize(334, 320)
self.gridLayout = QtGui.QGridLayout(frmComposerSpatialColumnEditor)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.tabWidget = QtGui.QTabWidget(frmComposerSpatialColumnEditor)
self.tabWidget.setTabPosition(QtGui.QTabWidget.South)
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.style = QtGui.QWidget()
self.style.setObjectName(_fromUtf8("style"))
self.gridLayout_3 = QtGui.QGridLayout(self.style)
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
self.styleScrollArea = QtGui.QScrollArea(self.style)
self.styleScrollArea.setWidgetResizable(True)
self.styleScrollArea.setObjectName(_fromUtf8("styleScrollArea"))
self.scrollAreaWidgetContents = QtGui.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 290, 257))
self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
self.gridLayout_5 = QtGui.QGridLayout(self.scrollAreaWidgetContents)
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
self.styleLayout = QtGui.QGridLayout()
self.styleLayout.setObjectName(_fromUtf8("styleLayout"))
self.gridLayout_5.addLayout(self.styleLayout, 0, 0, 1, 1)
self.styleScrollArea.setWidget(self.scrollAreaWidgetContents)
self.gridLayout_3.addWidget(self.styleScrollArea, 0, 0, 1, 1)
self.tabWidget.addTab(self.style, _fromUtf8(""))
self.label = QtGui.QWidget()
self.label.setObjectName(_fromUtf8("label"))
self.labelLayout = QtGui.QVBoxLayout(self.label)
self.labelLayout.setSpacing(10)
self.labelLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
self.labelLayout.setContentsMargins(-1, -1, -1, 9)
self.labelLayout.setObjectName(_fromUtf8("labelLayout"))
self.label_2 = QtGui.QLabel(self.label)
self.label_2.setMaximumSize(QtCore.QSize(16777215, 30))
self.label_2.setWordWrap(True)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.labelLayout.addWidget(self.label_2)
self.cboLabelField = QtGui.QComboBox(self.label)
self.cboLabelField.setMinimumSize(QtCore.QSize(0, 30))
self.cboLabelField.setObjectName(_fromUtf8("cboLabelField"))
self.labelLayout.addWidget(self.cboLabelField)
self.tabWidget.addTab(self.label, _fromUtf8(""))
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
self.retranslateUi(frmComposerSpatialColumnEditor)
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(frmComposerSpatialColumnEditor)
示例9: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QScrollArea [as 別名]
def setupUi(self, DetailsDock):
DetailsDock.setObjectName(_fromUtf8("DetailsDock"))
DetailsDock.resize(400, 300)
DetailsDock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self.dockWidgetContents = QtGui.QWidget()
self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.edit_btn = QtGui.QToolButton(self.dockWidgetContents)
self.edit_btn.setMinimumSize(QtCore.QSize(23, 22))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/edit.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.edit_btn.setIcon(icon)
self.edit_btn.setIconSize(QtCore.QSize(16, 16))
self.edit_btn.setObjectName(_fromUtf8("edit_btn"))
self.horizontalLayout.addWidget(self.edit_btn)
self.delete_btn = QtGui.QToolButton(self.dockWidgetContents)
self.delete_btn.setMinimumSize(QtCore.QSize(23, 22))
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/remove.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.delete_btn.setIcon(icon1)
self.delete_btn.setIconSize(QtCore.QSize(16, 16))
self.delete_btn.setObjectName(_fromUtf8("delete_btn"))
self.horizontalLayout.addWidget(self.delete_btn)
self.view_document_btn = QtGui.QToolButton(self.dockWidgetContents)
self.view_document_btn.setMinimumSize(QtCore.QSize(23, 22))
self.view_document_btn.setMaximumSize(QtCore.QSize(16777215, 16777215))
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/document.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.view_document_btn.setIcon(icon2)
self.view_document_btn.setIconSize(QtCore.QSize(16, 16))
self.view_document_btn.setObjectName(_fromUtf8("view_document_btn"))
self.horizontalLayout.addWidget(self.view_document_btn)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout)
self.tree_scrollArea = QtGui.QScrollArea(self.dockWidgetContents)
self.tree_scrollArea.setMinimumSize(QtCore.QSize(70, 70))
self.tree_scrollArea.setFrameShape(QtGui.QFrame.NoFrame)
self.tree_scrollArea.setFrameShadow(QtGui.QFrame.Plain)
self.tree_scrollArea.setLineWidth(0)
self.tree_scrollArea.setWidgetResizable(True)
self.tree_scrollArea.setObjectName(_fromUtf8("tree_scrollArea"))
self.scrollAreaWidgetContents = QtGui.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 378, 221))
self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.tree_scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout.addWidget(self.tree_scrollArea)
DetailsDock.setWidget(self.dockWidgetContents)
self.retranslateUi(DetailsDock)
QtCore.QMetaObject.connectSlotsByName(DetailsDock)