def __init__(self, parent, uifilepath): QDialog.__init__(self, parent) # load ui file self.ui = loadUi(uifilepath, self) # this is for PySide only # create a layout, add the loaded ui # this is to make sure the widget doesn't # get garbaged collected self.centralLayout = QGridLayout(self) self.centralLayout.setContentsMargins(9, 9, 9, 9) self.centralLayout.addWidget(self.ui) # since PySide doesn't load the ui like PyQt # lets get some properties from the ui file that are still relevant... # the size of the dialog set in QtDesigner self.resize(self.ui.size()) # the window title set in QtDesigner self.setWindowTitle(self.ui.windowTitle()) # connect to the createCube function self.ui.uiCreateCube.clicked.connect(self.createCube)
def __init__( self, parent, uifilepath ): QDialog.__init__( self, parent ) # load ui file self.ui = loadUi( uifilepath, self ) # this is for PySide only # create a layout, add the loaded ui # this is to make sure the widget doesn't # get garbaged collected self.centralLayout = QGridLayout( self ) self.centralLayout.setContentsMargins( 9, 9, 9, 9 ) self.centralLayout.addWidget( self.ui ) # since PySide doesn't load the ui like PyQt # lets get some properties from the ui file that are still relevant... # the size of the dialog set in QtDesigner self.resize( self.ui.size() ) # the window title set in QtDesigner self.setWindowTitle( self.ui.windowTitle() ) # connect to the createCube function self.ui.uiCreateCube.clicked.connect( self.createCube )
def __init__(self, parent): QDialog.__init__(self, parent) # enable minimize button # testing to make sure key events are processed # correctly when minimized self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowMinimizeButtonHint) self.setGeometry(100, 100, 200, 100) self.setWindowTitle("Hello World") self.setToolTip("This is a <b>QWidget</b> widget") self.btn = QPushButton("Log Text", self) self.btn.setToolTip("This is a <b>QPushButton</b> widget") self.btn.resize(self.btn.sizeHint()) self.btn.clicked.connect(self.logText) self.lineedit = QLineEdit("Hello World", self) self.lineedit.setToolTip("Type Something") layout = QVBoxLayout(self) layout.addWidget(self.lineedit) layout.addWidget(self.btn)
def __init__( self, parent ): QDialog.__init__( self, parent ) # enable minimize button # testing to make sure key events are processed # correctly when minimized self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowMinimizeButtonHint ) self.setGeometry( 100, 100, 200, 100 ) self.setWindowTitle( "Hello World" ) self.setToolTip( "This is a <b>QWidget</b> widget" ) self.btn = QPushButton( "Log Text", self ) self.btn.setToolTip( "This is a <b>QPushButton</b> widget" ) self.btn.resize( self.btn.sizeHint() ) self.btn.clicked.connect( self.logText ) self.lineedit = QLineEdit( "Hello World", self ) self.lineedit.setToolTip( "Type Something" ) layout = QVBoxLayout( self ) layout.addWidget( self.lineedit ) layout.addWidget( self.btn )