Python PySide.QtGui 模块,QSizePolicy() 实例源码

我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用PySide.QtGui.QSizePolicy()

项目:onionSkinRenderer    作者:Viele    | 项目源码 | 文件源码
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
项目:onionSkinRenderer    作者:Viele    | 项目源码 | 文件源码
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)
项目:XAFSmass    作者:kklmn    | 项目源码 | 文件源码
def __init__(self, parent, compound, E, table):
        super(PlotDlg, self).__init__(parent)
        bl = QVBoxLayout(self)
        self.plotCanvas = MyMplCanvas(self)
        self.plotCanvas.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.toolbar = ToolBar(self.plotCanvas, self)
        bl.addWidget(self.toolbar)
        bl.addWidget(self.plotCanvas)
        pg = parent.frameGeometry()
        self.move(parent.x()+pg.width(), parent.y())
        pg = parent.geometry()
        self.resize(pg.width()*1.5, pg.height())
        self.setWindowTitle("plots of f''")
        self.setWindowFlags(QtCore.Qt.Window)
        self.show()
        self.plotCanvas.plot(compound, E, table)

#    def closeEvent(self, event):  # is not invoked by esc. press
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(224, 117)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setSpacing(1)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.translateLabel = QtGui.QLabel(Form)
        self.translateLabel.setObjectName("translateLabel")
        self.verticalLayout.addWidget(self.translateLabel)
        self.rotateLabel = QtGui.QLabel(Form)
        self.rotateLabel.setObjectName("rotateLabel")
        self.verticalLayout.addWidget(self.rotateLabel)
        self.scaleLabel = QtGui.QLabel(Form)
        self.scaleLabel.setObjectName("scaleLabel")
        self.verticalLayout.addWidget(self.scaleLabel)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.mirrorImageBtn = QtGui.QPushButton(Form)
        self.mirrorImageBtn.setToolTip("")
        self.mirrorImageBtn.setObjectName("mirrorImageBtn")
        self.horizontalLayout.addWidget(self.mirrorImageBtn)
        self.reflectImageBtn = QtGui.QPushButton(Form)
        self.reflectImageBtn.setObjectName("reflectImageBtn")
        self.horizontalLayout.addWidget(self.reflectImageBtn)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(224, 117)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setSpacing(1)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.translateLabel = QtGui.QLabel(Form)
        self.translateLabel.setObjectName("translateLabel")
        self.verticalLayout.addWidget(self.translateLabel)
        self.rotateLabel = QtGui.QLabel(Form)
        self.rotateLabel.setObjectName("rotateLabel")
        self.verticalLayout.addWidget(self.rotateLabel)
        self.scaleLabel = QtGui.QLabel(Form)
        self.scaleLabel.setObjectName("scaleLabel")
        self.verticalLayout.addWidget(self.scaleLabel)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.mirrorImageBtn = QtGui.QPushButton(Form)
        self.mirrorImageBtn.setToolTip("")
        self.mirrorImageBtn.setObjectName("mirrorImageBtn")
        self.horizontalLayout.addWidget(self.mirrorImageBtn)
        self.reflectImageBtn = QtGui.QPushButton(Form)
        self.reflectImageBtn.setObjectName("reflectImageBtn")
        self.horizontalLayout.addWidget(self.reflectImageBtn)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:TACTIC-Handler    作者:listyque    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(self.__class__, self).__init__(parent=parent)
        self.setObjectName('TacticDock')
        self.setLayout(QtGui.QVBoxLayout())
        self.window = lib.ui_main_classes.Ui_Main()
        env.Inst.ui_standalone = self.window
        self.layout().addWidget(self.window)
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
项目:CyclopsVFX-Unity    作者:geoffroygivry    | 项目源码 | 文件源码
def setupUi(self, type_widget):
        type_widget.setObjectName("type_widget")
        type_widget.resize(248, 78)
        self.horizontalLayout_2 = QtGui.QHBoxLayout(type_widget)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.type_icon = QtGui.QLabel(type_widget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.type_icon.sizePolicy().hasHeightForWidth())
        self.type_icon.setSizePolicy(sizePolicy)
        self.type_icon.setObjectName("type_icon")
        self.horizontalLayout_2.addWidget(self.type_icon)
        spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.line = QtGui.QFrame(type_widget)
        self.line.setFrameShape(QtGui.QFrame.VLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName("line")
        self.horizontalLayout_2.addWidget(self.line)
        spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.type_label = QtGui.QLabel(type_widget)
        font = QtGui.QFont()
        font.setFamily("Cantarell")
        font.setPointSize(10)
        font.setWeight(75)
        font.setBold(True)
        self.type_label.setFont(font)
        self.type_label.setObjectName("type_label")
        self.horizontalLayout_2.addWidget(self.type_label)

        self.retranslateUi(type_widget)
        QtCore.QMetaObject.connectSlotsByName(type_widget)
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def _add_pane_3(self):
        """
        Add pane 3, an intermediate pane while we are sampling the posterior.
        """

        self.p3 = QtGui.QWidget()
        self.layout.addWidget(self.p3)

        # Pane 3
        p3_layout = QtGui.QGridLayout()
        self.p3.setLayout(p3_layout)

        p3_layout.addItem(QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, 
            QtGui.QSizePolicy.Expanding), 0, 1, 1, 1)
        self.p3_progressbar = QtGui.QProgressBar(self)
        self.p3_progressbar.setFocusPolicy(QtCore.Qt.NoFocus)
        p3_layout.addWidget(self.p3_progressbar, 2, 1, 1, 1)

        p3_layout.addItem(QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Minimum), 2, 2, 1, 1)
        p3_layout.addItem(QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Minimum), 2, 0, 1, 1)
        self.p3_label = QtGui.QLabel(self)
        self.p3_label.setText("Sampling posterior")
        self.p3_label.setAlignment(QtCore.Qt.AlignCenter)
        p3_layout.addWidget(self.p3_label, 1, 1, 1, 1)
        p3_layout.addItem(QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, 
            QtGui.QSizePolicy.Expanding), 3, 1, 1, 1)


        return None
项目:TiltBrushConverter    作者:DrHibbitts    | 项目源码 | 文件源码
def createWidgets(self):
        self.item_list_model = QtGui.QStandardItemModel(self)
        self.item_list_model.setSortRole(QtCore.Qt.DisplayRole)
        self.item_list_model.dataChanged.connect(self.handleDataChange)
        self.setModel(self.item_list_model)
        self.item_selection_model = self.selectionModel()
        self.setMinimumHeight(60)
        self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred))
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def chat_image_view_ui(self, button):
        if not button.img_path:
            return
        # make widjet
        ui_path = G.MW.chat_img_viewer_path
        # widget
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile(ui_path)
        #file.open(QtCore.QFile.ReadOnly)
        img_window = G.MW.chatImgViewer = loader.load(file, G.MW)
        file.close()


        # SHOW IMAGE
        image = QtGui.QImage(button.img_path)
        img_window.setWindowTitle(button.img_path)

        img_window.image_label.setBackgroundRole(QtGui.QPalette.Base)
        img_window.image_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        img_window.image_label.setScaledContents(True)

        img_window.image_label.setPixmap(QtGui.QPixmap.fromImage(image))

        # connect button
        img_window.cansel_button.clicked.connect(partial(G.MW.close_window, img_window))

        img_window.show()
项目:lineyka-b3d    作者:volodya-renderberg    | 项目源码 | 文件源码
def chat_image_view_ui(self, button):
        if not button.img_path:
            return
        # make widjet
        ui_path = G.MW.chat_img_viewer_path
        # widget
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile(ui_path)
        #file.open(QtCore.QFile.ReadOnly)
        img_window = G.MW.chatImgViewer = loader.load(file, G.MW)
        file.close()


        # SHOW IMAGE
        image = QtGui.QImage(button.img_path)
        img_window.setWindowTitle(button.img_path)

        img_window.image_label.setBackgroundRole(QtGui.QPalette.Base)
        img_window.image_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        img_window.image_label.setScaledContents(True)

        img_window.image_label.setPixmap(QtGui.QPixmap.fromImage(image))

        # connect button
        img_window.cansel_button.clicked.connect(partial(G.MW.close_window, img_window))

        img_window.show()
项目:XAFSmass    作者:kklmn    | 项目源码 | 文件源码
def __init__(self, parent=None, width=5, height=0.4):
        fig = mpl.figure.Figure(figsize=(width, height), dpi=96)
        self.fig = fig
        Canvas.__init__(self, fig)
        bg = self.palette().window().color()
        cl = (bg.redF(), bg.greenF(), bg.blueF())
#        fig.set_edgecolor(cl)
        fig.set_facecolor(cl)
        self.setParent(parent)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.updateGeometry()
        fm = QtGui.QFontMetrics(self.font())
        self.fontsize = int(fm.height()) / 1.25
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def __init__(self, session, **kwargs):
        """
        A widget to show solve options when determining the stellar parameters.

        :param session:
            A session.
        """

        super(SolveOptionsDialog, self).__init__(**kwargs)

        self.session = session

        # Display dialog in center and set size policy.
        self.setGeometry(640, 480, 640, 480)
        self.move(QtGui.QApplication.desktop().screen().rect().center() \
            - self.rect().center())
        self.setWindowTitle("Solve options for stellar parameter determination")

        sp = QtGui.QSizePolicy(
            QtGui.QSizePolicy.MinimumExpanding, 
            QtGui.QSizePolicy.MinimumExpanding)
        sp.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sp)

        vbox = QtGui.QVBoxLayout(self)

        self.check_use_uncertainties_in_line_fits = QtGui.QCheckBox(self)
        self.check_use_uncertainties_in_line_fits.setText(
            "Use abundance uncertainties in line fits")
        vbox.addWidget(self.check_use_uncertainties_in_line_fits)

        vbox.addItem(QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, 
            QtGui.QSizePolicy.Expanding))

        hbox = QtGui.QHBoxLayout()
        self.btn_save_as_default = QtGui.QPushButton(self)
        self.btn_save_as_default.setText("Save settings as default")
        self.btn_save_as_default.clicked.connect(self.save_as_default)
        hbox.addWidget(self.btn_save_as_default)


        hbox.addItem(QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, 
            QtGui.QSizePolicy.Minimum))

        self.btn_apply = QtGui.QPushButton(self)
        self.btn_apply.setText("Apply")
        self.btn_apply.setDefault(True)
        self.btn_apply.clicked.connect(self.apply)
        hbox.addWidget(self.btn_apply)


        self.btn_cancel = QtGui.QPushButton(self)
        self.btn_cancel.setText("Cancel")
        self.btn_cancel.clicked.connect(self.close)
        hbox.addWidget(self.btn_cancel)
        vbox.addLayout(hbox)

        self.populate_widgets()

        return None
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def __init_ui__(self):
        """
        Set up the primary user interface (not the stuff in tabs).
        """

        # Create the central widget with a vertical layout.
        cw = QtGui.QWidget(self)
        cw_vbox = QtGui.QVBoxLayout(cw)
        cw_vbox.setContentsMargins(10, 20, 10, 10)



        # Create the primary widget for all the main tabs.
        self.tabs = QtGui.QTabWidget(cw)
        self.tabs.setTabPosition(QtGui.QTabWidget.North)
        self.tabs.setUsesScrollButtons(False)

        sp = QtGui.QSizePolicy(
            QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.MinimumExpanding)
        sp.setHorizontalStretch(0)
        sp.setVerticalStretch(0)
        sp.setHeightForWidth(self.tabs.sizePolicy().hasHeightForWidth())
        self.tabs.setSizePolicy(sp)

        # Create summary tab.
        self.summary_tab = summary.SummaryTab(self)
        self.tabs.addTab(self.summary_tab, "Summary")

        # Create radial velocity tab
        self.rv_tab = rv.RVTab(self)
        self.tabs.addTab(self.rv_tab, "Radial velocity")

        # Create normalization tab.
        self.normalization_tab = normalization.NormalizationTab(self)
        self.tabs.addTab(self.normalization_tab, "Normalization")

        # Create stellar parameters tab.
        self.stellar_parameters_tab \
            = stellar_parameters.StellarParametersTab(self)
        self.tabs.addTab(self.stellar_parameters_tab, "Stellar parameters")

        # Create chemical abundances tab
        # BUT IT'S XBOX HUGE
        self.chemical_abundances_tab \
            = chemical_abundances.ChemicalAbundancesTab(self)
        self.tabs.addTab(self.chemical_abundances_tab, "Chemical abundances")

        # Disable all tabs except the first one.
        for i in range(self.tabs.count()):
            self.tabs.setTabEnabled(i, i == 0)

        cw_vbox.addWidget(self.tabs)
        self.setCentralWidget(cw)

        self.tabs.setCurrentIndex(0)
        self._update_window_title()