我们从Python开源项目中,提取了以下43个代码示例,用于说明如何使用PySide.QtCore.QSize()。
def chat_add_img_to_line(self, button): rand = hex(random.randint(0, 1000000000)).replace('0x', '') img_path = os.path.join(G.MW.db_chat.tmp_folder, ('tmp_image_' + rand + '.png')).replace('\\','/') clipboard = QtGui.QApplication.clipboard() img = clipboard.image() if img: img.save(img_path) else: G.MW.message('Cannot Image!', 2) return(False, 'Cannot Image!') button.setIcon(QtGui.QIcon(img_path)) button.setIconSize(QtCore.QSize(100, 100)) button.setText('') button.img_path = img_path return(True, 'Ok!')
def setupUi(self, Instructions): Instructions.setObjectName("Instructions") Instructions.setEnabled(True) Instructions.resize(400, 300) Instructions.setMinimumSize(QtCore.QSize(400, 300)) Instructions.setMaximumSize(QtCore.QSize(400, 300)) self.label = QtGui.QLabel(Instructions) self.label.setGeometry(QtCore.QRect(20, 10, 361, 271)) self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label.setWordWrap(True) self.label.setObjectName("label") self.pushButton_OK = QtGui.QPushButton(Instructions) self.pushButton_OK.setGeometry(QtCore.QRect(300, 260, 75, 23)) self.pushButton_OK.setObjectName("pushButton_OK") self.retranslateUi(Instructions) QtCore.QMetaObject.connectSlotsByName(Instructions)
def __init__(self, filename=None): QtGui.QApplication.__init__(self, ['Talpa']) splash_img = QtGui.QPixmap( get_resource('talpa_splash.png'))\ .scaled(QtCore.QSize(400, 250), QtCore.Qt.KeepAspectRatio) self.splash = QtGui.QSplashScreen( splash_img, QtCore.Qt.WindowStaysOnTopHint) self.updateSplashMessage('') self.splash.show() self.processEvents() self.talpa_win = TalpaMainWindow(filename=filename) self.splash.finish(self.talpa_win) self.aboutToQuit.connect(self.splash.deleteLater) self.aboutToQuit.connect(self.deleteLater) self.talpa_win.show() rc = self.exec_() sys.exit(rc)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.horizontalLayout = QtGui.QHBoxLayout(Form) self.horizontalLayout.setObjectName("horizontalLayout") self.tableLayout = QtGui.QVBoxLayout() self.tableLayout.setObjectName("tableLayout") self.horizontalLayout.addLayout(self.tableLayout) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.addAttr_btn = QtGui.QPushButton(Form) self.addAttr_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.addAttr_btn.setObjectName("addAttr_btn") self.verticalLayout.addWidget(self.addAttr_btn) self.removeAttr_btn = QtGui.QPushButton(Form) self.removeAttr_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.removeAttr_btn.setObjectName("removeAttr_btn") self.verticalLayout.addWidget(self.removeAttr_btn) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout.setStretch(0, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def addRemoveButton(self): self.frame_remove_btn = QtGui.QPushButton('rm') sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.frame_remove_btn.sizePolicy().hasHeightForWidth()) self.frame_remove_btn.setSizePolicy(sizePolicy) self.frame_remove_btn.setMinimumSize(QtCore.QSize(16, 16)) self.frame_remove_btn.setMaximumSize(QtCore.QSize(16, 16)) self.frame_widget_layout.addWidget(self.frame_remove_btn) # ---------------------- # OBJECT WIDGET # the widget for displaying an object in a list
def setupUi(self, onionSkinObject_layout): onionSkinObject_layout.setObjectName("onionSkinObject_layout") onionSkinObject_layout.resize(204, 38) self.horizontalLayout = QtGui.QHBoxLayout(onionSkinObject_layout) self.horizontalLayout.setSpacing(3) self.horizontalLayout.setContentsMargins(4, 2, 4, 2) self.horizontalLayout.setObjectName("horizontalLayout") self.object_label = QtGui.QLabel(onionSkinObject_layout) self.object_label.setObjectName("object_label") self.horizontalLayout.addWidget(self.object_label) self.object_remove_btn = QtGui.QPushButton(onionSkinObject_layout) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.object_remove_btn.sizePolicy().hasHeightForWidth()) self.object_remove_btn.setSizePolicy(sizePolicy) self.object_remove_btn.setMinimumSize(QtCore.QSize(16, 16)) self.object_remove_btn.setMaximumSize(QtCore.QSize(16, 16)) self.object_remove_btn.setObjectName("object_remove_btn") self.horizontalLayout.addWidget(self.object_remove_btn) self.retranslateUi(onionSkinObject_layout) QtCore.QMetaObject.connectSlotsByName(onionSkinObject_layout)
def setupUi(self, Manual): Manual.setObjectName(_fromUtf8("Manual")) Manual.resize(740, 450) Manual.setMinimumSize(QtCore.QSize(740, 450)) Manual.setMaximumSize(QtCore.QSize(740, 450)) self.textBrowser = QtGui.QTextBrowser(Manual) self.textBrowser.setGeometry(QtCore.QRect(10, 40, 721, 371)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.label = QtGui.QLabel(Manual) self.label.setGeometry(QtCore.QRect(10, 10, 271, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.manual_bn = QtGui.QPushButton(Manual) self.manual_bn.setGeometry(QtCore.QRect(650, 420, 75, 23)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) self.manual_bn.setFont(font) self.manual_bn.setObjectName(_fromUtf8("manual_bn")) self.retranslateUi(Manual) QtCore.QMetaObject.connectSlotsByName(Manual)
def minimumSizeHint(self): x_points = round((self._high_frequency - self._low_frequency) / self._frequency_step) y_points = round(self._high_dbm - self._low_dbm) return QtCore.QSize(x_points * 4, y_points * 1)
def sizeHint(self): return QtCore.QSize(480, 160)
def sizeHint(self): return QtCore.QSize(self.parentWidget().width(), self.parentWidget().height()/6)
def minimumSizeHint(self): return (QtCore.QSize(50,25))
def __init__(self, parent=None): super(StatusWidgetPie, self).__init__(parent) self.setToolTip('status (click to edit)') self.addItems(['waiting', 'in progress', 'finished']) self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) self.size = QtCore.QSize(20, 20)
def __init__(self, parent=None): super(DeleteWidget, self).__init__(parent) self.size = QtCore.QSize(20, 20) self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) self.setToolTip('permanently delete this task') self.padding = 7 self.active = False self.inactiveColor = QtGui.QColor(180, 50, 0) self.activeColor = self.inactiveColor.lighter()
def sizeHint(self): #return QtCore.QSize(240,100) return QtCore.QSize(125,100)
def minimumSizeHint(self): return QtCore.QSize(125,0)
def sizeHint(self): return QtCore.QSize(100,100)
def minimumSizeHint(self): return QtCore.QSize(100,0)
def SignalForWebViewE(self, Start, End, Slice): self.Start = Start self.End = End StartSlice = Start/self.Electrode.slices EndSlice = End/self.Electrode.slices gettingSmallMultipleNumber = (End-Start)/Slice self.LayoutChangesOnSliceChange(self.Electrode.slices) if not(self.PutAllLayout): if EndSlice - StartSlice > -1: q = StartSlice IterationNo = EndSlice-StartSlice if IterationNo ==0: IterationNo = 1 for i in range(IterationNo): WidgetTemp=self.Electrode.SmallMultipleElectrode[q] WidgetTemp.show() WidgetTemp.setMinimumSize(QtCore.QSize(SliceSizes,SliceSizes)) WidgetTemp.setMaximumSize(QtCore.QSize(SliceSizes,SliceSizes)) if i < 5: self.layout.addWidget(WidgetTemp, 0, i ,QtCore.Qt.AlignCenter) else: self.layout.addWidget(WidgetTemp, 2, (i-5) ,QtCore.Qt.AlignCenter) q=q+1 C = self.layout.itemAtPosition(0, (EndSlice-StartSlice)+1) while (C is not None): Widget = C.widget() self.layout.removeWidget(Widget) Widget.hide() i = i + 1 C = self.layout.itemAtPosition(0, i) A = QtGui.QWidget() A.setMinimumSize(QtCore.QSize(SliceSizes,SliceSizes)) A.setMaximumSize(QtCore.QSize(SliceSizes,SliceSizes)) for i in range(5): self.layout.addWidget(A, 2, i)
def __init__(self, Electrode, smallMultiples, x_interval, y_interval): super(LayoutForSmallMultiples, self).__init__() self.smallMultiples = smallMultiples # self.TrackingGraphView = TrackingGraphView self.Electrode = Electrode self.x_interval = x_interval self.y_interval = y_interval self.setMinimumSize(QtCore.QSize(701,561)) self.initUI()
def setupUi(self, ViewDialog): ViewDialog.setObjectName("ViewDialog") ViewDialog.resize(640, 480) self.gridLayout = QtGui.QGridLayout(ViewDialog) self.gridLayout.setSpacing(0) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.view = ViewWidget(ViewDialog) self.view.setMaximumSize(QtCore.QSize(16777214, 16777214)) self.view.setObjectName("view") self.gridLayout.addWidget(self.view, 0, 0, 1, 1) self.retranslateUi(ViewDialog) QtCore.QMetaObject.connectSlotsByName(ViewDialog)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(680, 403) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.labelVersion = QtGui.QLabel(Dialog) self.labelVersion.setObjectName("labelVersion") self.gridLayout.addWidget(self.labelVersion, 0, 0, 1, 1) self.labelSupport = QtGui.QLabel(Dialog) self.labelSupport.setObjectName("labelSupport") self.gridLayout.addWidget(self.labelSupport, 1, 0, 1, 1) self.labelLicense = QtGui.QLabel(Dialog) self.labelLicense.setObjectName("labelLicense") self.gridLayout.addWidget(self.labelLicense, 2, 0, 1, 1) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/mpowertcx icon flat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(256, 256)) self.pushButton.setFlat(True) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.licenseEdit = QtGui.QPlainTextEdit(Dialog) self.licenseEdit.setFrameShape(QtGui.QFrame.Box) self.licenseEdit.setReadOnly(True) self.licenseEdit.setObjectName("licenseEdit") self.gridLayout.addWidget(self.licenseEdit, 3, 0, 2, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(756, 395) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName("gridLayout") self.labelVersion = QtGui.QLabel(Dialog) self.labelVersion.setObjectName("labelVersion") self.gridLayout.addWidget(self.labelVersion, 0, 0, 1, 1) self.labelSupport = QtGui.QLabel(Dialog) self.labelSupport.setObjectName("labelSupport") self.gridLayout.addWidget(self.labelSupport, 1, 0, 1, 1) self.labelLicense = QtGui.QLabel(Dialog) self.labelLicense.setObjectName("labelLicense") self.gridLayout.addWidget(self.labelLicense, 2, 0, 1, 1) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/mpowertcx icon flat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(256, 256)) self.pushButton.setFlat(True) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 3, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.licenseEdit = QtGui.QPlainTextEdit(Dialog) self.licenseEdit.setFrameShape(QtGui.QFrame.NoFrame) self.licenseEdit.setReadOnly(True) self.licenseEdit.setObjectName("licenseEdit") self.gridLayout.addWidget(self.licenseEdit, 3, 0, 2, 1) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def sizeHint(self, option, index): options = QtGui.QStyleOptionViewItemV4(option) self.initStyleOption(options, index) doc = QtGui.QTextDocument() doc.setHtml(options.text) doc.setTextWidth(options.rect.width()) return QtCore.QSize(doc.idealWidth(), doc.size().height())
def __init__(self, scene=None, import_data=None, load_file=None): QtGui.QApplication.__init__(self, ['Spool']) # self.setStyle('plastique') splash_img = QtGui.QPixmap(get_resource('spool_splash.png'))\ .scaled(QtCore.QSize(400, 250), QtCore.Qt.KeepAspectRatio) self.splash = QtGui.QSplashScreen( splash_img, QtCore.Qt.WindowStaysOnTopHint) self.updateSplashMessage('Scene') self.splash.show() self.processEvents() self.spool_win = SpoolMainWindow() self.spool_win.sigLoadingModule.connect(self.updateSplashMessage) self.spool_win.actionExit.triggered.connect(self.exit) self.aboutToQuit.connect(self.spool_win.model.worker_thread.quit) self.aboutToQuit.connect(self.spool_win.model.deleteLater) self.aboutToQuit.connect(self.splash.deleteLater) self.aboutToQuit.connect(self.deleteLater) if scene is not None: self.addScene(scene) if import_data is not None: self.importScene(import_data) if load_file is not None: self.loadScene(load_file) self.splash.finish(self.spool_win) self.spool_win.show() rc = self.exec_() sys.exit(rc)
def __init__(self, app, hub, debug): window_size = qt_core.QSize(810, 560) BaseWebUI.__init__(self, newwallet.html, app, hub, window_size, debug) self.setWindowFlags(qt_core.Qt.FramelessWindowHint) self.show()
def __init__(self, app, hub, debug): window_size = qt_core.QSize(800, 600) BaseWebUI.__init__(self, index.html, app, hub, window_size, debug) self.agent = '%s v.%s' % (USER_AGENT, '.'.join(str(v) for v in VERSION)) log("Starting [%s]..." % self.agent, LEVEL_INFO) self.app = app self.debug = debug self.hub = hub self.app.aboutToQuit.connect(self._handleAboutToQuit) self.sumokoind_daemon_manager = None self.wallet_cli_manager = None self.wallet_rpc_manager = None self.new_wallet_ui = None self.wallet_info = WalletInfo(app) # load app settings self.app_settings = AppSettings() self.app_settings.load() ## Blockchain height self.target_height = self.app_settings.settings['blockchain']['height'] self.current_height = 0
def readSettings(self): ''' Read position and size from QSettings ''' settings = QtCore.QSettings('PH5', 'pforma') pos = settings.value('pos', QtCore.QPoint(200, 200)) size = settings.value('size', QtCore.QSize(400, 400)) self.move(pos) self.resize(size)
def sizeHint(self): size = super(ThetaLineEdit, self).sizeHint() return QtCore.QSize(2.5 * size.height(), size.height())
def sizeHint(self): return QtCore.QSize(0, 0) # set to minimum possible
def setupUi(self, About): About.setObjectName(_fromUtf8("About")) About.resize(378, 342) About.setMinimumSize(QtCore.QSize(378, 342)) About.setMaximumSize(QtCore.QSize(378, 342)) self.label = QtGui.QLabel(About) self.label.setGeometry(QtCore.QRect(10, 10, 191, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(About) self.label_2.setGeometry(QtCore.QRect(10, 30, 181, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_2.setFont(font) self.label_2.setObjectName(_fromUtf8("label_2")) self.label_3 = QtGui.QLabel(About) self.label_3.setGeometry(QtCore.QRect(10, 50, 211, 16)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(8) font.setItalic(False) self.label_3.setFont(font) self.label_3.setObjectName(_fromUtf8("label_3")) self.label_4 = QtGui.QLabel(About) self.label_4.setGeometry(QtCore.QRect(10, 60, 261, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(8) font.setItalic(False) self.label_4.setFont(font) self.label_4.setObjectName(_fromUtf8("label_4")) self.textBrowser = QtGui.QTextBrowser(About) self.textBrowser.setGeometry(QtCore.QRect(10, 90, 361, 211)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.about_bn = QtGui.QPushButton(About) self.about_bn.setGeometry(QtCore.QRect(290, 310, 75, 23)) self.about_bn.setObjectName(_fromUtf8("about_bn")) self.retranslateUi(About) QtCore.QMetaObject.connectSlotsByName(About)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(186, 154) Form.setMaximumSize(QtCore.QSize(200, 16777215)) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 7, 0, 1, 2) self.linkCombo = QtGui.QComboBox(Form) self.linkCombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.linkCombo.setObjectName("linkCombo") self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2) self.autoPercentSpin = QtGui.QSpinBox(Form) self.autoPercentSpin.setEnabled(True) self.autoPercentSpin.setMinimum(1) self.autoPercentSpin.setMaximum(100) self.autoPercentSpin.setSingleStep(1) self.autoPercentSpin.setProperty("value", 100) self.autoPercentSpin.setObjectName("autoPercentSpin") self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2) self.autoRadio = QtGui.QRadioButton(Form) self.autoRadio.setChecked(True) self.autoRadio.setObjectName("autoRadio") self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2) self.manualRadio = QtGui.QRadioButton(Form) self.manualRadio.setObjectName("manualRadio") self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2) self.minText = QtGui.QLineEdit(Form) self.minText.setObjectName("minText") self.gridLayout.addWidget(self.minText, 1, 2, 1, 1) self.maxText = QtGui.QLineEdit(Form) self.maxText.setObjectName("maxText") self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1) self.invertCheck = QtGui.QCheckBox(Form) self.invertCheck.setObjectName("invertCheck") self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4) self.mouseCheck = QtGui.QCheckBox(Form) self.mouseCheck.setChecked(True) self.mouseCheck.setObjectName("mouseCheck") self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4) self.visibleOnlyCheck = QtGui.QCheckBox(Form) self.visibleOnlyCheck.setObjectName("visibleOnlyCheck") self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2) self.autoPanCheck = QtGui.QCheckBox(Form) self.autoPanCheck.setObjectName("autoPanCheck") self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)