当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QScrollArea方法代码示例

本文整理汇总了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() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:26,代码来源:universal_tool_template_1115.py

示例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() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:24,代码来源:universal_tool_template_1112.py

示例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 
开发者ID:C-X1,项目名称:PyFlashAero,代码行数:9,代码来源:ImageViewer.py

示例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>") 
开发者ID:C-X1,项目名称:PyFlashAero,代码行数:17,代码来源:ImageViewer.py

示例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) 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:7,代码来源:GUIElements.py

示例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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:34,代码来源:universal_tool_template_1116.py

示例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() 
开发者ID:C-X1,项目名称:PyFlashAero,代码行数:51,代码来源:ImageViewer.py

示例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) 
开发者ID:gltn,项目名称:stdm,代码行数:50,代码来源:ui_composer_spcolumn_styler.py

示例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) 
开发者ID:gltn,项目名称:stdm,代码行数:58,代码来源:ui_feature_details.py


注:本文中的PyQt4.QtGui.QScrollArea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。