def __init__(self, parent=None, flags=Qt.WindowFlags(0), model=None, **kwargs): QDialog.__init__(self, parent, flags, **kwargs) self.__setupUi() if model is not None: self.setModel(model)
def createWidgets(self): """ Create all widgets """ self.setWindowIcon(QIcon(':/plugin.png')) self.mainTab = QTabWidget() self.aboutPage = AboutPage(parent=self) self.debugPage = DebugPage(parent=self) self.mainTab.addTab(self.aboutPage, "About") self.mainTab.addTab(self.debugPage, "Debug") mainLayout = QVBoxLayout() mainLayout.addWidget(self.mainTab) self.setLayout(mainLayout) self.setWindowTitle("%s - %s - %s" % (Settings.instance().readValue(key='Common/name'), self.pluginName, self.pluginVersion)) flags = Qt.WindowFlags() if not self.debugMode: flags |= Qt.WindowStaysOnTopHint self.setWindowFlags(flags)
def createDialog(self): """ Create qt dialog """ self.setWindowTitle("%s" % self.name) layout = QVBoxLayout() self.loadingLabel = QLabel("Loading...") self.imageLabel = QLabel() layout2 = QHBoxLayout() layout2.addWidget(self.imageLabel) layout2.addWidget(self.loadingLabel) self.progressBar = QProgressBar(self) self.progressBar.setMaximum(0) self.progressBar.setProperty("value", 0) self.progressBar.setAlignment(Qt.AlignCenter) self.progressBar.setObjectName("progressBar") layout.addLayout(layout2) layout.addWidget(self.progressBar) self.setLayout(layout) flags = Qt.WindowFlags() flags |= Qt.MSWindowsFixedSizeDialogHint self.setWindowFlags(flags)
def __init__(self, root_object, parent=None, f=Qt.WindowFlags()): QDialog.__init__(self, parent, f) self.resize(480, 640) self.vertical_layout = QVBoxLayout(self) self.tree_view = ObjectTreeWidget(self) self.tree_view.set_root_object(root_object) self.tree_view.expand_top_level() self.vertical_layout.addWidget(self.tree_view)
def get_modeless_dialog_flags(default=Qt.WindowFlags(0)): # FIXME: on macOS (at least since 10.10) modeless QDialogs don't work # properly anymore. they don't show up if the programs is run from an .app # container. Setting the tool window flag for such dialogs works around this if sys.platform == 'darwin': return Qt.Tool else: return default
def __init__(self, parent=None, ontop=True): QMainWindow.__init__(self, parent) self.setupUi(self) self.setWindowTitle( QtGui.QApplication.translate("MainWindow", TITLE_NAME, None, QtGui.QApplication.UnicodeUTF8)) self.input_line.setText(u'请输入题目的首字母...') self.ans_txt.setText(WELCOME_TXT) self.flags = Qt.WindowFlags() if self.action_ontop.isChecked(): self.setWindowFlags(self.flags | Qt.WindowStaysOnTopHint)
def __init__(self, parent=None, flags=0): if not isinstance(flags, Qt.WindowFlags): flags = Qt.WindowFlags(int(flags)) QMainWindow.__init__(self, parent, flags) # Set up the children components to display. self.scrollArea = QScrollArea(self) self.canvas = QDomElement(self.scrollArea) self.scrollArea.setWidget(self.canvas) self.scrollArea.setAlignment(Qt.AlignHCenter) self.setCentralWidget(self.scrollArea)
def bring_to_front_all_figures(): from PyQt4.QtCore import Qt all_figures = get_all_figures() for i, fig in enumerate(all_figures): qtwin = fig.canvas.manager.window if not isinstance(qtwin, matplotlib.backends.backend_qt4.MainWindow): raise NotImplemented('need to add more window manager handlers') qtwin.raise_() qtwin.activateWindow() qtwin.setWindowFlags(Qt.WindowStaysOnTopHint) qtwin.show() qtwin.setWindowFlags(Qt.WindowFlags(0)) qtwin.show()
def __init__(self, parent=None, flags=Qt.WindowFlags(0)): QWidget.__init__(self, parent, flags) self.settings = QSettings() self.setupUi() self.currentUser = self.settings.value('/CartoDBPlugin/selected') if self.currentUser: self.currentApiKey = self.settings.value('/CartoDBPlugin/%s/api' % self.currentUser) self.currentMultiuser = self.settings.value( '/CartoDBPlugin/%s/multiuser' % self.currentUser, False) else: self.currentApiKey = None self.currentMultiuser = None self.click = None
def createDialog(self): """ Create qt dialog """ self.setWindowTitle( "%s" % self.name ) layout = QVBoxLayout() self.loadingLabel = QLabel("Loading...") self.imageLabel = QLabel() layout2 = QHBoxLayout() layout2.addWidget( self.imageLabel ) layout2.addWidget( self.loadingLabel ) self.progressBar = QProgressBar(self) self.progressBar.setMaximum(0) self.progressBar.setProperty("value", 0) self.progressBar.setAlignment(Qt.AlignCenter) self.progressBar.setObjectName("progressBar") buttonLayout = QHBoxLayout() buttonLayout.addStretch() self.okButton = QPushButton("Ok", self) self.downloadButton = QPushButton("Download", self) self.cancelButton = QPushButton("Cancel", self) buttonLayout.addWidget(self.okButton) buttonLayout.addWidget(self.downloadButton) buttonLayout.addWidget(self.cancelButton) self.okButton.clicked.connect(self.accept) self.downloadButton.clicked.connect(self.download) self.cancelButton.clicked.connect(self.onReject) self.okButton.hide() layout.addLayout(layout2) layout.addWidget( self.progressBar ) layout.addLayout(buttonLayout) self.setLayout(layout) flags = Qt.WindowFlags() flags |= Qt.WindowCloseButtonHint flags |= Qt.MSWindowsFixedSizeDialogHint self.setWindowFlags(flags)
def createDialog(self): """ Create qt dialog """ self.setWindowTitle("Realtime Results") flags = Qt.WindowFlags() flags |= Qt.WindowMinimizeButtonHint flags |= Qt.WindowMaximizeButtonHint self.setWindowFlags(flags) self.secondTab = QTabWidget() self.secondTab.tabBar().setContextMenuPolicy(Qt.CustomContextMenu) self.secondTab.setDocumentMode(True) self.secondTab.setTabPosition(QTabWidget.South) layout = QVBoxLayout() layout.addWidget(self.secondTab) self.setLayout(layout) layout.setContentsMargins(0, 0, 0, 0)
def __init__(self, viewer): """ :type viewer: QWidget """ QWidget.__init__(self, None, Qt.WindowFlags()) self.widget = viewer self.writeInCaps = False self.text = QTextEdit() self.text.setReadOnly(True) self.text.setMinimumHeight(150) self.log = getLoggerPassFilters(LOGGER_NAMES.LIVEPLAYER) scrollViewer = QScrollArea() scrollViewer.setWidget(self.widget) layout = QVBoxLayout() layout.addWidget(scrollViewer, 8) layout.addWidget(self.text, 2) self.setLayout(layout)
def __init__(self, parent=None, flags=0): # SIP code expects the flags to be of type Qt.WindowFlags. if not isinstance(flags, Qt.WindowFlags): flags = Qt.WindowFlags(int(flags)) QWidget.__init__(self, parent, flags)
def __init__(self, parent, flags=Qt.WindowFlags(0)): super(DemoAppMainWindow, self).__init__(parent, flags) self._init_controls()
# coding: utf-8 from PyQt4.QtCore import Qt # http://doc.qt.io/qt-4.8/qwidget.html#windowFlags-prop from qgis.gui import QgsDashSpaceDialog from qgis.utils import iface main_window = iface.mainWindow() dash_dialog = QgsDashSpaceDialog([3.1, 1.1, 4.9, 6, 8], main_window, f=Qt.WindowFlags()) dash_dialog.show()
# coding: utf-8 from PyQt4.QtCore import Qt # http://doc.qt.io/qt-4.8/qwidget.html#windowFlags-prop from qgis.gui import QgsCredentialDialog from qgis.utils import iface main_window = iface.mainWindow() credential_dialog = QgsCredentialDialog(main_window, fl=Qt.WindowFlags()) credential_dialog.setModal(True) credential_dialog.show()
def createWidgets(self): """ QtWidgets creation QHBoxLayout -------------------------------------------..... | QLabel: QLineEdit QButton QButton QCheckBox | -------------------------------------------..... ....-------------------------------------- QLabel: QLineEdit QButton QCheckBox | ....-------------------------------------- """ glayout = QGridLayout() self.edit = QLineEditMore(parent=self) self.edit.setEditable(1) self.edit.setMaxCount(10) self.edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.edit.lineEdit().setPlaceholderText("Search text in your test?") self.edit.setMinimumWidth(200) self.replaceEdit = QComboBox(self) self.replaceEdit.setEditable(1) self.replaceEdit.setMaxCount(10) self.replaceEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.replaceEdit.lineEdit().setPlaceholderText( "Replace the text with?") self.replaceEdit.setMinimumWidth(200) self.caseCheck = QCheckBox(self.tr("Case Sensitive")) self.caseCheck.setChecked( QtHelper.str2bool(Settings.instance().readValue( key='Editor/find-case-sensitive'))) self.caseWordCheck = QCheckBox(self.tr("Whole word only")) self.caseWordCheck.setChecked( QtHelper.str2bool( Settings.instance().readValue(key='Editor/find-whole-word'))) self.allCheck = QCheckBox(self.tr("All occurences")) self.allCheck.setChecked( QtHelper.str2bool( Settings.instance().readValue(key='Editor/replace-all'))) self.caseRegexpCheck = QCheckBox(self.tr("Regular expression")) self.caseRegexpCheck.setChecked( QtHelper.str2bool( Settings.instance().readValue(key='Editor/find-regexp'))) self.caseWrapCheck = QCheckBox(self.tr("Wrap at the end")) self.caseWrapCheck.setChecked( QtHelper.str2bool( Settings.instance().readValue(key='Editor/find-wrap'))) glayout.addWidget(self.edit, 0, 1) glayout.addWidget(self.nextButton, 0, 3) glayout.addWidget(self.previousButton, 0, 2) glayout.addWidget(self.caseCheck, 2, 2) glayout.addWidget(self.caseWrapCheck, 2, 3) glayout.addWidget(self.caseWordCheck, 3, 2) glayout.addWidget(self.caseRegexpCheck, 3, 3) glayout.addWidget(self.replaceEdit, 1, 1) glayout.addWidget(self.replaceButton, 1, 2) glayout.addWidget(self.allCheck, 1, 3) self.previousButton.setDisabled(True) self.nextButton.setDisabled(True) self.setLayout(glayout) flags = Qt.WindowFlags() flags |= Qt.Window flags |= Qt.WindowTitleHint flags |= Qt.WindowCloseButtonHint flags |= Qt.MSWindowsFixedSizeDialogHint self.setWindowFlags(flags) self.setWindowIcon(QIcon(":/main.png")) self.setWindowTitle("Find And Replace")
# coding: utf-8 from PyQt4.QtCore import Qt # http://doc.qt.io/qt-4.8/qwidget.html#windowFlags-prop from qgis.core import QgsError from qgis.gui import QgsErrorDialog from qgis.utils import iface error_dialog = QgsErrorDialog(QgsError("My error message", "My GDAL tag"), "My title", iface.mainWindow(), fl=Qt.WindowFlags()) error_dialog.show(QgsError("My error message", "My GDAL tag"), "My title", iface.mainWindow(), fl=Qt.WindowFlags())