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


Python QtWidgets.QDesktopWidget方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QDesktopWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QDesktopWidget方法的具体用法?Python QtWidgets.QDesktopWidget怎么用?Python QtWidgets.QDesktopWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QDesktopWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: showEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def showEvent(self, event=None):
        viewport_topRight = self.contentView.mapToGlobal(
            self.contentView.viewport().rect().topRight())

        desktop_size = QtWidgets.QDesktopWidget().screenGeometry()
        dock_y = viewport_topRight.y()
        dock_height = self.contentView.viewport().size().height()

        if self.notes_only:
            dock_width = dock_height = desktop_size.width() // 5.5
            dock_x = QtGui.QCursor.pos().x()
            dock_y = QtGui.QCursor.pos().y()
        else:
            dock_width = desktop_size.width() // 5
            dock_x = viewport_topRight.x() - dock_width + 1
            self.parent.navBar.hide()

        self.main_window.active_docks.append(self)
        self.setGeometry(dock_x, dock_y, dock_width, dock_height)
        self.animation.start() 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:22,代码来源:dockwidgets.py

示例2: initUI

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def initUI(self):      

        self.wid = binWidget(self, self._source)
        
        self.hbox = QtWidgets.QHBoxLayout()
        self.hbox.addWidget(self.wid)
        self.setLayout(self.hbox)

        screen = QtWidgets.QDesktopWidget().screenGeometry()
        self.setGeometry(0, 0, screen.width()-100, screen.height()-100)

        self.setWindowTitle(self._title)
        #self.showMaximized()
        self.wid.activateWindow()

        self.raise_()
        self.installEventFilter(self) 
开发者ID:mtivadar,项目名称:qiew,代码行数:19,代码来源:qiew.py

示例3: center

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def center(self, pGeometry=None):
        if pGeometry:
            pr = pGeometry
            x, y, w, h = pr.x(), pr.y(), pr.width(), pr.height()
            # 父窗口的中心点坐标
            cenPosX = x + w / 2
            cenPosY = y + h / 2
            size = self.size()
            xPos = cenPosX - size.width() / 2
            yPos = cenPosY - size.height() / 2
            self.move(xPos, yPos)
        else:
            qr = self.frameGeometry()
            cp = QDesktopWidget().availableGeometry().center()
            qr.moveCenter(cp)
            self.move(qr.topLeft()) 
开发者ID:epolestar,项目名称:equant,代码行数:18,代码来源:framelesswindow.py

示例4: read_settings

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def read_settings(self):
        if self.settings.value('Last_Run/geometry'):
            self.restoreGeometry(self.settings.value('Last_Run/geometry'))
        else:
            self.resize(720, 540)
            qr = self.frameGeometry()
            cp = Qw.QDesktopWidget().availableGeometry().center()
            qr.moveCenter(cp)
            self.move(qr.topLeft())

        if self.settings.value('Last_Run/window_state'):
            self.restoreState(self.settings.value('Last_Run/window_state'))

        self.read_qsettings_item('angrysearch_lite', 'bool')
        self.read_qsettings_item('fast_search_but_no_substring', 'bool')
        self.read_qsettings_item('typing_delay', 'bool')
        self.read_qsettings_item('darktheme', 'bool')
        self.read_qsettings_item('fm_path_doubleclick_selects', 'bool')
        self.read_qsettings_item('icon_theme', 'str')
        self.read_qsettings_item('row_height', 'int')
        self.read_qsettings_item('number_of_results', 'int')
        self.read_qsettings_item('directories_excluded', 'list')
        self.read_qsettings_item('file_manager', 'fm')
        self.read_qsettings_item('conditional_mounts_for_autoupdate', 'list')
        self.read_qsettings_item('notifications', 'bool')
        self.read_qsettings_item('regex_mode', 'bool')
        self.read_qsettings_item('close_on_execute', 'bool')

        if self.settings.value('Last_Run/last_sort'):
            k = self.settings.value('Last_Run/last_sort')
            if isinstance(k, list) and len(k) == 2:
                if self.setting_params['angrysearch_lite'] and int(k[0]) > 1:
                    k[0] = 1
                self.setting_params['last_sort'] = [int(x) for x in k]
            else:
                self.setting_params['last_sort'] = [1, 0]
        else:
            self.setting_params['last_sort'] = [1, 0] 
开发者ID:DoTheEvo,项目名称:ANGRYsearch,代码行数:40,代码来源:angrysearch.py

示例5: center

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def center(self):
		screen = QDesktopWidget().screenGeometry()
		size = self.geometry()
		self.move((screen.width() - size.width()) // 2, (screen.height() - size.height()) // 2) 
开发者ID:CharlesPikachu,项目名称:Games,代码行数:6,代码来源:Game11.py

示例6: showEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def showEvent(self, event):
        self.color_background(True)

        size = self.size()
        desktop_size = QtWidgets.QDesktopWidget().screenGeometry()
        top = (desktop_size.height() / 2) - (size.height() / 2)
        left = (desktop_size.width() / 2) - (size.width() / 2)
        self.move(left, top) 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:10,代码来源:definitionsdialog.py

示例7: generate_display_position

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def generate_display_position(self, mouse_cursor_position):
        size = self.size()
        desktop_size = QtWidgets.QDesktopWidget().screenGeometry()

        display_x = mouse_cursor_position.x()
        display_y = mouse_cursor_position.y()

        if display_x + size.width() > desktop_size.width():
            display_x = desktop_size.width() - size.width()

        if display_y + size.height() > desktop_size.height():
            display_y = desktop_size.height() - size.height()

        return QtCore.QPoint(display_x, display_y) 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:16,代码来源:metadatadialog.py

示例8: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def __init__(self, parent=None):
        super(FixedComboBox, self).__init__(parent)
        screen_width = QtWidgets.QDesktopWidget().screenGeometry().width()
        self.adjusted_size = screen_width // 6 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:6,代码来源:dockwidgets.py

示例9: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def __init__(self, parent=None):
        super(FixedLineEdit, self).__init__(parent)
        screen_width = QtWidgets.QDesktopWidget().screenGeometry().width()
        self.adjusted_size = screen_width // 4.5 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:6,代码来源:toolbars.py

示例10: fitImageToScreen

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def fitImageToScreen(pixmap):
    """Fit pixmap to screen.
    """
    resolution = QDesktopWidget().screenGeometry()
    h, w = resolution.width(), resolution.height()
    w = min(pixmap.width(), w)
    h = min(pixmap.height(), h)
    return pixmap.scaled(QtCore.QSize(w, h), QtCore.Qt.KeepAspectRatio) 
开发者ID:xsyann,项目名称:detection,代码行数:10,代码来源:common.py

示例11: centering_window

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def centering_window(self):

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft()) 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:8,代码来源:gui.py

示例12: centerOnScreen

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def centerOnScreen(self):
        """centerOnScreen() - Centers the window on the screen."""
        resolution = QtWidgets.QDesktopWidget().screenGeometry()
        frame = self.frameSize()
        self.move(
            (resolution.width() / 2) - (frame.width() / 2),
            (resolution.height() / 2) - (frame.height() / 2),
        ) 
开发者ID:Eomys,项目名称:pyleecan,代码行数:10,代码来源:SidebarWindow.py

示例13: center

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def center(self):
        qr = self.frameGeometry()
        cp = QtWidgets.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft()) 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:7,代码来源:acars.py

示例14: center

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def center(self):
      qr = self.frameGeometry()
      cp = QtWidgets.QDesktopWidget().availableGeometry().center()
      qr.moveCenter(cp)
      self.move(qr.topLeft()) 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:7,代码来源:MainInterface.py

示例15: center

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDesktopWidget [as 别名]
def center(self):
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) // 2, (screen.height() - size.height()) // 2) 
开发者ID:LoveDaisy,项目名称:tetris_game,代码行数:6,代码来源:tetris_game.py


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