Python PyQt5.QtCore 模块,QPoint() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtCore.QPoint()

项目:PyNoder    作者:johnroper100    | 项目源码 | 文件源码
def getSelectedNodesCentroid(self):
        selectedNodes = self.getSelectedNodes()

        leftMostNode = None
        topMostNode = None
        for node in selectedNodes:
            nodePos = node.getGraphPos()

            if leftMostNode is None:
                leftMostNode = node
            else:
                if nodePos.x() < leftMostNode.getGraphPos().x():
                    leftMostNode = node

            if topMostNode is None:
                topMostNode = node
            else:
                if nodePos.y() < topMostNode.getGraphPos().y():
                    topMostNode = node

        xPos = leftMostNode.getGraphPos().x()
        yPos = topMostNode.getGraphPos().y()
        pos = QtCore.QPoint(xPos, yPos)

        return pos
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def draw_progress_bar(plex_item, pixmap, height=6):
    """draw a progress indicator on the bottom of pixmap with height pixels"""
    if not hasattr(plex_item, 'in_progress'):
        return
    if not plex_item.in_progress:
        return
    progress_color = QtGui.QColor(204, 123, 25)
    progress = plex_item.view_offset / max(1, plex_item.duration)
    p = QtGui.QPainter(pixmap)
    rect = p.window()
    progress_rect = QtCore.QRect(rect.bottomLeft() - QtCore.QPoint(0, height),
                                 rect.bottomRight())
    progress_fill = QtCore.QRect(progress_rect)
    progress_fill.setWidth(rect.width() * progress)
    p.fillRect(progress_rect, QtGui.QBrush(QtCore.Qt.black))
    p.fillRect(progress_fill, QtGui.QBrush(progress_color))
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def draw_unwatched_indicator(plex_item, pixmap, size=0.20):
    """draw a triangle on the top right of pixmap"""
    if not hasattr(plex_item, 'watched') and not hasattr(plex_item, 'in_progress'):
        return
    if plex_item.watched or plex_item.in_progress:
        return
    p = QtGui.QPainter(pixmap)
    rect = p.window()
    top_right = rect.topRight()
    size = pixmap.height() * size
    color = QtGui.QColor(204, 123, 25)
    triangle = QtGui.QPolygon([top_right, top_right - QtCore.QPoint(size, 0),
                               top_right + QtCore.QPoint(0, size)])
    p.setPen(QtGui.QPen(QtGui.QBrush(QtGui.QColor(0, 0, 0, 120)), 6))
    p.drawLine(triangle.point(1), triangle.point(2))
    p.setBrush(QtGui.QBrush(color))
    p.setPen(color)
    p.drawPolygon(triangle)
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def visible_items(self):
        model = self.model()
        if not model.rowCount():
            return (0, [])
        rect = self.rect()

        # columns, rows = self.update_batch_size()

        visible = []

        start = self.indexAt(QtCore.QPoint(15, 15))
        for i in range(start.row() if start.isValid() else 0, model.rowCount()):
            index = model.index(i)
            if rect.intersects(self.visualRect(index)):
                visible.append(index)
            else:
                if visible:
                    break
        # print(len(visible))
        # self.request_thumbs.emit(visible)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        self.width = 5000
        self.height = 4000
        self.margin = 10

        self.keys = {
            Qt.Key_W: False,
            Qt.Key_A: False,
            Qt.Key_S: False,
            Qt.Key_D: False,
        }  # This will be modified by View, and be read by GuiClient
        self.mouseDown = False
        self.mousePos = QPoint()
        self.decaying = []
        self.setSceneRect(5, 5, self.width, self.height)
        self.polygons = ObjectTracker()
        self.heroes = ObjectTracker()
        self.bullets = ObjectTracker()
        self.experienceBar = ExperienceBar()
        self.addItem(self.experienceBar)
        self.scoreboard = Scoreboard()
        self.addItem(self.scoreboard)
项目:Cite    作者:siudej    | 项目源码 | 文件源码
def __init__(self):
        """ Initialize main window. """
        QMainWindow.__init__(self)
        self.setupUi(self)
        self.resize(QSize(settings.get('citewidth'),
                          settings.get('citeheight')))
        self.move(QPoint(settings.get('citex'),
                         settings.get('citey')))
        self.tabWidget.tabBar().setCurrentIndex(0)
        self.searchTab.setFocus()
        self.setWindowTitle('Cite')
        self.show()
        self.raise_()

        self.linkSettings()

        self.searchQuery.installEventFilter(self)
        self.text = self.bibtext = self.lastquery = ""
        self.batchBibtext = self.batchText = ""
        self.neverOpened = True

        self.helpText.setSource(QUrl('doc/help.html'))
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def setPointSize(self, pointSize):
        scrollArea = self._scrollArea
        newScale = pointSize / self._unitsPerEm
        if scrollArea is not None:
            # compute new scrollbar position
            hSB = scrollArea.horizontalScrollBar()
            vSB = scrollArea.verticalScrollBar()
            viewport = scrollArea.viewport()
            centerPos = QPoint(viewport.width() / 2, viewport.height() / 2)
            pos = self.mapToCanvas(self.mapFromParent(centerPos))
        self.setScale(newScale)
        if scrollArea is not None:
            pos = self.mapFromCanvas(pos)
            delta = pos - self.mapFromParent(centerPos)
            hSB.setValue(hSB.value() + delta.x())
            vSB.setValue(vSB.value() + delta.y())
项目:pisi-player    作者:mthnzbk    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__()
        self.parent = parent
        self.setWindowFlags(Qt.Tool)
        self.setVisible(False)
        self.resize(300, 250)
        self.move(settings().value("Settings/position") or QPoint(250,250))
        self.setWindowIcon(QIcon.fromTheme("pisiplayer"))
        self.setWindowTitle(self.tr("Ayarlar"))
        self.setStyleSheet("""QToolBox::tab {
                            background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                                        stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
                                                        stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
                            border-radius: 5px;
                            color: darkgray;
                            }

                            QToolBox::tab:selected { /* italicize selected tabs */
                                font: italic;
                                color: white;
                            }""")

        page1 = self.addItem(SubtitleWidget(self), self.tr("Altyaz?lar"))

        page2 = self.addItem(YoutubeWidget(self), self.tr("Youtube"))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def doLayout(self, rect, testOnly):
        x = rect.x()
        y = rect.y()
        lineHeight = 0

        for item in self.itemList:
            wid = item.widget()
            spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Horizontal)
            spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Vertical)
            nextX = x + item.sizeHint().width() + spaceX
            if nextX - spaceX > rect.right() and lineHeight > 0:
                x = rect.x()
                y = y + lineHeight + spaceY
                nextX = x + item.sizeHint().width() + spaceX
                lineHeight = 0

            if not testOnly:
                item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))

            x = nextX
            lineHeight = max(lineHeight, item.sizeHint().height())

        return y + lineHeight - rect.y()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def updateColor(self, item):
        pixmap = QPixmap(16, 16)
        color = QColor()
        if item:
            color = item.backgroundColor()
        if not color.isValid():
            color = self.palette().base().color()
        painter = QPainter(pixmap)
        painter.fillRect(0, 0, 16, 16, color)
        lighter = color.lighter()
        painter.setPen(lighter)
        # light frame
        painter.drawPolyline(QPoint(0, 15), QPoint(0, 0), QPoint(15, 0))
        painter.setPen(color.darker())
        # dark frame
        painter.drawPolyline(QPoint(1, 15), QPoint(15, 15), QPoint(15, 1))
        painter.end()
        self.colorAction.setIcon(QIcon(pixmap))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(HelloGLWidget, self).__init__(parent)

        self.object = 0
        self.xRot = 0
        self.yRot = 0
        self.zRot = 0

        self.lastPos = QPoint()

        self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
        self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)

        self.setWindowTitle("Hello GL")

    # The rotation of the logo about the x-axis can be controlled using the
    # xRotation property, defined using the following getter and setter
    # methods.
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def doLayout(self, rect, testOnly):
        x = rect.x()
        y = rect.y()
        lineHeight = 0

        for item in self.itemList:
            wid = item.widget()
            spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Horizontal)
            spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Vertical)
            nextX = x + item.sizeHint().width() + spaceX
            if nextX - spaceX > rect.right() and lineHeight > 0:
                x = rect.x()
                y = y + lineHeight + spaceY
                nextX = x + item.sizeHint().width() + spaceX
                lineHeight = 0

            if not testOnly:
                item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))

            x = nextX
            lineHeight = max(lineHeight, item.sizeHint().height())

        return y + lineHeight - rect.y()
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def updateColor(self, item):
        pixmap = QPixmap(16, 16)
        color = QColor()
        if item:
            color = item.backgroundColor()
        if not color.isValid():
            color = self.palette().base().color()
        painter = QPainter(pixmap)
        painter.fillRect(0, 0, 16, 16, color)
        lighter = color.lighter()
        painter.setPen(lighter)
        # light frame
        painter.drawPolyline(QPoint(0, 15), QPoint(0, 0), QPoint(15, 0))
        painter.setPen(color.darker())
        # dark frame
        painter.drawPolyline(QPoint(1, 15), QPoint(15, 15), QPoint(15, 1))
        painter.end()
        self.colorAction.setIcon(QIcon(pixmap))
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(HelloGLWidget, self).__init__(parent)

        self.object = 0
        self.xRot = 0
        self.yRot = 0
        self.zRot = 0

        self.lastPos = QPoint()

        self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
        self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)

        self.setWindowTitle("Hello GL")

    # The rotation of the logo about the x-axis can be controlled using the
    # xRotation property, defined using the following getter and setter
    # methods.
项目:IDACyber    作者:patois    | 项目源码 | 文件源码
def render_image(self, cursor=True):
        size = self.size()
        self.maxPixelsTotal = self.maxPixelsPerLine * (size.height() / self.pixelSize)
        self.buf = self.bh.get_buf(self.base + self.offs, self.maxPixelsTotal)       
        self.numbytes = min(self.maxPixelsTotal, len(self.buf))

        #img = QImage(self.maxPixelsPerLine, size.height() / self.pixelSize, QImage.Format_RGB32)
        img = QImage(self.maxPixelsPerLine, size.height() / self.pixelSize, QImage.Format_RGB32)
        addr = self.base + self.offs
        pixels = self.fm.render_img(self.buf[:self.numbytes], addr, self.mouseOffs)
        x = y = 0
        for pix in pixels:
            img.setPixel(x, y, pix)
            x = (x + 1) % self.maxPixelsPerLine
            if x == 0:
                y = y + 1

        if cursor and self.fm.highlight_cursor:
            p = QPoint(self.get_elem_x(), self.get_elem_x())
            img.setPixel(self.get_elem_x(), self.get_elem_y(), ~(img.pixelColor(p)).rgb())

        return img
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_graphic_view_zoom_to_selection(self):
        self.add_signal_to_form("esaver.complex")
        frame = self.form.signal_tab_controller.signal_frames[0]
        frame.ui.gvSignal.context_menu_position = QPoint(0, 0)
        menu = frame.ui.gvSignal.create_context_menu()
        self.assertTrue(frame.ui.gvSignal.selection_area.is_empty)
        self.assertIsNone(next((action for action in menu.actions() if action.text() == "Zoom selection"), None))

        frame.ui.gvSignal.selection_area.start = 1337
        frame.ui.gvSignal.selection_area.end = 4711
        frame.ui.gvSignal.sel_area_start_end_changed.emit(1337, 4711)

        menu = frame.ui.gvSignal.create_context_menu()
        self.assertFalse(frame.ui.gvSignal.selection_area.is_empty)
        zoom_action = next(action for action in menu.actions() if action.text() == "Zoom selection")
        zoom_action.trigger()
        self.assertEqual(frame.ui.spinBoxSelectionStart.value(), 1337)
        self.assertEqual(frame.ui.spinBoxSelectionEnd.value(), 4711)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_create_table_context_menu(self):
        # Context menu should only contain one item (add new message)
        self.assertEqual(self.form.generator_tab_controller.table_model.rowCount(), 0)
        self.form.generator_tab_controller.ui.tableMessages.context_menu_pos = QPoint(0, 0)
        menu = self.form.generator_tab_controller.ui.tableMessages.create_context_menu()
        self.assertEqual(len(menu.actions()), 1)

        # Add data to test entries in context menu
        self.add_signal_to_form("ask.complex")
        gframe = self.form.generator_tab_controller
        index = gframe.tree_model.createIndex(0, 0, gframe.tree_model.rootItem.children[0].children[0])
        mimedata = gframe.tree_model.mimeData([index])
        gframe.table_model.dropMimeData(mimedata, 1, -1, -1, gframe.table_model.createIndex(0, 0))

        self.assertGreater(self.form.generator_tab_controller.table_model.rowCount(), 0)
        menu = self.form.generator_tab_controller.ui.tableMessages.create_context_menu()
        n_items = len(menu.actions())
        self.assertGreater(n_items, 1)

        # If there is a selection, additional items should be present in context menu
        gframe.ui.tableMessages.selectRow(0)
        menu = self.form.generator_tab_controller.ui.tableMessages.create_context_menu()
        self.assertGreater(len(menu.actions()), n_items)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_create_fuzzing_list_view_context_menu(self):
        # Context menu should be empty if table is empty
        self.assertEqual(self.form.generator_tab_controller.table_model.rowCount(), 0)
        self.form.generator_tab_controller.ui.tableMessages.context_menu_pos = QPoint(0, 0)
        menu = self.form.generator_tab_controller.ui.listViewProtoLabels.create_context_menu()
        self.assertEqual(len(menu.actions()), 0)

        # Add data to test entries in context menu
        self.add_signal_to_form("fsk.complex")
        self.form.compare_frame_controller.add_protocol_label(0, 10, 0, 0, False)
        self.assertEqual(1, len(self.form.compare_frame_controller.proto_analyzer.protocol_labels))
        gframe = self.form.generator_tab_controller
        index = gframe.tree_model.createIndex(0, 0, gframe.tree_model.rootItem.children[0].children[0])
        mimedata = gframe.tree_model.mimeData([index])
        gframe.table_model.dropMimeData(mimedata, 1, -1, -1, gframe.table_model.createIndex(0, 0))

        self.assertGreater(self.form.generator_tab_controller.table_model.rowCount(), 0)
        # Select a row so there is a message for that fuzzing labels can be shown
        self.form.generator_tab_controller.ui.tableMessages.selectRow(0)
        menu = self.form.generator_tab_controller.ui.listViewProtoLabels.create_context_menu()
        n_items = len(menu.actions())
        self.assertGreater(n_items, 0)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def doLayout(self, rect, testOnly):
        x = rect.x()
        y = rect.y()
        lineHeight = 0

        for item in self.itemList:
            wid = item.widget()
            spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Horizontal)
            spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Vertical)
            nextX = x + item.sizeHint().width() + spaceX
            if nextX - spaceX > rect.right() and lineHeight > 0:
                x = rect.x()
                y = y + lineHeight + spaceY
                nextX = x + item.sizeHint().width() + spaceX
                lineHeight = 0

            if not testOnly:
                item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))

            x = nextX
            lineHeight = max(lineHeight, item.sizeHint().height())

        return y + lineHeight - rect.y()
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def updateColor(self, item):
        pixmap = QPixmap(16, 16)
        color = QColor()
        if item:
            if hasattr(item, 'backgroundColor'):
                color = item.backgroundColor()
        if not color.isValid():
            color = self.palette().base().color()
        painter = QPainter(pixmap)
        painter.fillRect(0, 0, 16, 16, color)
        lighter = color.lighter()
        painter.setPen(lighter)
        # light frame
        painter.drawPolyline(QPoint(0, 15), QPoint(0, 0), QPoint(15, 0))
        painter.setPen(color.darker())
        # dark frame
        painter.drawPolyline(QPoint(1, 15), QPoint(15, 15), QPoint(15, 1))
        painter.end()
        self.colorAction.setIcon(QIcon(pixmap))
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(HelloGLWidget, self).__init__(parent)

        self.object = 0
        self.xRot = 0
        self.yRot = 0
        self.zRot = 0

        self.lastPos = QPoint()

        self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
        self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)

        self.setWindowTitle("Hello GL")

    # The rotation of the logo about the x-axis can be controlled using the
    # xRotation property, defined using the following getter and setter
    # methods.
项目:RRPam-WDS    作者:asselapathirana    | 项目源码 | 文件源码
def clicking_close_to_a_link_will_select_it_on_the_plot(self):

        pdds, nwm = draw_a_network(self.aw, network=ex.networks[0])
        # select a link
        l = pdds.links[3]
        pos = [(l.start.x + l.end.x) / 2.0, (l.start.y, l.end.y) / 2.0]
        curve = [x for x in nwm.get_plot().get_items() if x.title().text() == l.id][0]
        plot = curve.plot()
        ax = curve.xAxis()
        ay = curve.yAxis()
        px = plot.transform(ax, pos[0])
        py = plot.transform(ay, pos[1])
        logger = logging.getLogger()
        logger.info(curve.title().text())
        QTest.mouseClick(plot, Qt.RightButton, pos=QPoint(px, py), delay=10.)
        logger = logging.getLogger()
        logger.info(str(plot.get_selected_items()))
        logger = logging.getLogger()
        logger.info((nwm.get_plot().get_selected_items()))
        # this test does not work yet.
        # todo: fix this test to work.
项目:Pyquino    作者:kmolLin    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(GLWidget, self).__init__(parent)

        self.object = 0
        self.xRot = 0
        self.yRot = 0
        self.zRot = 0

        self.lastPos = QPoint()

        self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
        self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)
项目:PyNoder    作者:johnroper100    | 项目源码 | 文件源码
def paint(self, painter, option, widget):
        rect = self.windowFrameRect()
        painter.setBrush(self.__color)

        painter.setPen(QtGui.QPen(QtGui.QColor(0, 0, 0, 0), 0))

        roundingY = 10
        roundingX = rect.height() / rect.width() * roundingY

        painter.drawRoundedRect(rect, roundingX, roundingY)

        # Title BG
        titleHeight = self.__headerItem.size().height() - 3

        painter.setBrush(QtGui.QColor("#A7FF99"))
        roundingY = rect.width() * roundingX / titleHeight
        painter.drawRoundedRect(0, 0, rect.width(), titleHeight, roundingX, roundingY)
        painter.drawRect(0, titleHeight * 0.5 + 2, rect.width(), titleHeight * 0.5)

        # painter.setPen(self.__linePen)
        # painter.drawLine(QtCore.QPoint(0, titleHeight), QtCore.QPoint(rect.width(), titleHeight))

        painter.setBrush(QtGui.QColor(0, 0, 0, 0))
        if self.__selected:
            painter.setPen(self.__selectedPen)
        else:
            painter.setPen(self.__unselectedPen)

        roundingY = 10
        roundingX = rect.height() / rect.width() * roundingY

        painter.drawRoundedRect(rect, roundingX, roundingY)
项目:Computer-graphics    作者:Panda-Lewandowski    | 项目源码 | 文件源码
def add_point_by_btn(win):
    x = win.x.value()
    y = win.y.value()
    p = QPoint()
    p.setX(x)
    p.setY(y)
    add_point(p)
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
def validateClick(self, pos, obj, callback):
            validation = bool(obj.itemAt(pos if isinstance(pos, QtCore.QPoint) else pos.pos()))
            callback() if validation else False
项目:mpvQC    作者:Frechdachs    | 项目源码 | 文件源码
def contextMenu(pos=None):
    setPause()
    exitFullscreen()
    contextmenu = QMenu()
    for x in commenttypeoptions:
        contextmenu.addAction(x).triggered.connect(partial(newComment, x))
    m_pos = QCursor.pos()
    # Fixes following: Qt puts the context menu in a place
    # where double clicking would trigger the fist menu option
    # instead of just calling the menu a second time
    # or ignoring the second press
    m_pos = QPoint(m_pos.x()+1, m_pos.y())
    contextmenu.exec_(m_pos)
项目:Milis-Yukleyici    作者:sonakinci41    | 项目源码 | 文件源码
def __init__(self, ebeveyn=None):
        super(HaritaWidget,self).__init__(ebeveyn)
        self.e = ebeveyn
        self.setFixedSize(900, 450)
        self.pin = QPixmap("./resimler/pin.png")
        self.pin_konum = QPoint(-50, -50)

        self.koordinat_pixelleri = {}
        for zone, koordinat in koordinatlar.items():
            pos = self.koordinat_pixel_tespiti(koordinat[1], koordinat[0], zone)
            self.koordinat_pixelleri[pos[0]] = pos[1]
项目:Milis-Yukleyici    作者:sonakinci41    | 项目源码 | 文件源码
def paintEvent(self, event):
        boyayici = QPainter(self)
        boyayici.setRenderHints(QPainter.SmoothPixmapTransform|QPainter.Antialiasing|QPainter.HighQualityAntialiasing)

        boyayici.drawPixmap(QPoint(0, 0), QPixmap("./resimler/harita.png"))
        boyayici.drawPixmap(self.pin_konum, self.pin)
项目:Milis-Yukleyici    作者:sonakinci41    | 项目源码 | 文件源码
def paintEvent(self, event):
        boyayici = QPainter(self)
        boyayici.setRenderHints(QPainter.SmoothPixmapTransform|QPainter.Antialiasing|QPainter.HighQualityAntialiasing)

        boyayici.drawPixmap(QPoint(0, 0), QPixmap("./resimler/klavye.png"))

        koordinat_listesi = ((10, 30), (90, 90), (115, 150), (80, 215))
        sayac = 0
        if self.ciziliyor:
            for key_list in klavye_modeli[self.klavye_modeli]:
                coordinat = koordinat_listesi[sayac]
                sayac += 1
                for num, key in enumerate(key_list):
                    try:
                        font = boyayici.font()
                        font.setPointSize(12)
                        boyayici.setFont(font)

                        big = QPen(QColor("#ccff00"))
                        boyayici.setPen(big)
                        boyayici.drawText(coordinat[0]+(60*num), coordinat[1], self.tus_yerlesimi[key][1])

                        font = boyayici.font()
                        font.setPointSize(14)
                        boyayici.setFont(font)

                        little = QPen(QColor(255, 255, 255))
                        boyayici.setPen(little)
                        boyayici.drawText(coordinat[0]+15+(60*num), coordinat[1]+20, self.tus_yerlesimi[key][0])

                    except KeyError as err:
                        print(self.tus_yerlesimi, key)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def on_valueChanged(self, value: int) -> None:
        if value < self.restrictValue:
            self.setSliderPosition(self.restrictValue)
        if self._showSeekToolTip and self._mouseOver:
            opt = QStyleOptionSlider()
            self.initStyleOption(opt)
            handle = self.style().subControlRect(QStyle.CC_Slider, opt, QStyle.SC_SliderHandle, self)
            pos = handle.topRight()
            pos += QPoint(5, 13)
            globalPos = self.mapToGlobal(pos)
            timecode = self.parent.delta2QTime(value).toString(self.parent.timeformat)
            QToolTip.showText(globalPos, str(timecode), self)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None, **kwargs):
        super(VolumeSlider, self).__init__(parent, **kwargs)
        self.setObjectName('volumeslider')
        self.valueChanged.connect(self.showTooltip)
        self.offset = QPoint(0, -45)
        if sys.platform == 'win32':
            self.setStyle(QStyleFactory.create('Fusion'))
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        # Click pos
        self.clickPos = QtCore.QPoint(50, 50)
        # App Icon
        self.icon_Label = QtWidgets.QLabel()
        self.icon_Label.setPixmap(QtGui.QPixmap(":/resources/bcts.png").scaled(QtCore.QSize(40, 40)))
        self.icon_Label.setFixedWidth(40)
        # Title font
        self.title_font = QtGui.QFont("Segoe UI")
        self.title_font.setPointSize(11)
        self.title_font.setBold(True)
        # Title        
        self.title_Label = QtWidgets.QLabel("")
        self.title_Label.setFont(self.title_font)
        self.title_Label.setAlignment(QtCore.Qt.AlignCenter)
        #?Button
        self.closeApp_btn = QtWidgets.QToolButton()
        self.closeApp_btn.setIcon(QtGui.QIcon(":/resources/close.png"))
        self.closeApp_btn.setObjectName("closeButton")
        self.titlelayout = QtWidgets.QHBoxLayout()
        self.titlelayout.addWidget(self.icon_Label)
        self.titlelayout.addWidget(self.title_Label)
        self.titlelayout.addWidget(self.closeApp_btn)
        self.titlelayout.setSpacing(0) 
        self.titlelayout.setContentsMargins(5, 5, 5, 5)
        # Stylesheet
        self.setStyleSheet("QLabel{background:#ffffff; color:#859ba6; font-family:'Segoe UI'; font-size:12pt;} QToolButton{border:none;} QPushButton:hover{background:#6e66cc;border:1px solid #373366;} QToolButton:hover{background:#fa7064;}")
        self.setLayout(self.titlelayout)
        # Slots & signals
        self.closeApp_btn.clicked.connect(parent.close)
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        # Add new font
        self.titleFont = QtGui.QFont('Caviar Dreams', 20)
        self.titleFont.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, 2.0)
        # Parent widget, application window
        self.parent = parent
        # Mouse
        self.clickPos = QtCore.QPoint(50, 50)
        # Layout
        self.titleLayout = QtWidgets.QHBoxLayout()
        # Icon
        self.iconLabel = QtWidgets.QLabel()
        self.iconLabel.setPixmap(QtGui.QPixmap(":/resources/bcts.png").scaled(QtCore.QSize(100, 100)))
        self.iconLabel.setAlignment(QtCore.Qt.AlignCenter)
        # Title text     
        self.titleLabel = QtWidgets.QLabel("BATS")
        self.titleLabel.setFont(self.titleFont)
        # Stylesheet
        self.setStyleSheet("QLabel{color:#ffffff;}")
        # Add widget
        self.titleLayout.addWidget(self.iconLabel)
        self.titleLayout.addWidget(self.titleLabel)
        # Set layout
        self.titleLayout.setContentsMargins(20, 10, 20, 0)
        self.titleLayout.setSpacing(30)
        self.titleLayout.setAlignment(QtCore.Qt.AlignCenter)
        self.setLayout(self.titleLayout)



# Side Menu
项目:motorized_zoom_lens    作者:Kurokesu    | 项目源码 | 文件源码
def paintEvent(self, event):
        qp = QtGui.QPainter()
        qp.begin(self)
        if self.image:
            qp.drawImage(QtCore.QPoint(0, 0), self.image)
        qp.end()
项目:motorized_zoom_lens    作者:Kurokesu    | 项目源码 | 文件源码
def paintEvent(self, event):
        qp = QtGui.QPainter()
        qp.begin(self)
        if self.image:
            qp.drawImage(QtCore.QPoint(0, 0), self.image)
        qp.end()
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def placeholder_thumb_generator(title, size=150):
    """Returns a QPixmap of size with the first letter of each word in title"""
    initials = ' '.join([x[0] for x in title.split(' ') if len(x) > 2])
    key = 'placeholder' + initials
    img = QtGui.QPixmapCache.find(key)
    if img:
        return img
    qsize = QtCore.QSize(size, size)
    circle_color = QtGui.QColor(50, 50, 50)
    text_color = QtGui.QColor(75, 75, 75)
    rect = QtCore.QRect(QtCore.QPoint(0, 0), QtCore.QPoint(size, size))
    center = QtCore.QPoint(size / 2, size / 2)
    img = QtGui.QPixmap(qsize)
    img.fill(QtCore.Qt.transparent)
    p = QtGui.QPainter(img)
    p.setFont(QtGui.QFont('Open Sans', size / 4, weight=QtGui.QFont.Bold))
    p.setBrush(QtGui.QBrush(circle_color))
    p.setPen(circle_color)
    p.setRenderHint(QtGui.QPainter.Antialiasing, True)
    p.drawEllipse(center, size / 2 - 1, size / 2 - 1)
    p.setPen(text_color)
    p.drawText(rect, QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter, initials)
    QtGui.QPixmapCache.insert(key, img)
    return img
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def constructPolygon(self):
        points = []
        rbase = math.tau / self.edges
        for i in range(self.edges):
            theta = i * rbase
            points.append(QPoint(
                self.axis * math.cos(theta),
                self.axis * math.sin(theta)
            ))
        points.append(QPoint(self.axis, 0))
        self.polygonShape = QPolygonF(points)
项目:thegame    作者:afg984    | 项目源码 | 文件源码
def setUiPos(self, view):
        vw = view.width()
        vh = view.height()
        expCenter = view.mapToScene(
            QPoint(vw / 2, vh - 50))
        self.experienceBar.setPos(expCenter)
        scoreboardCenter = view.mapToScene(
            QPoint(vw - 5, 5))
        self.scoreboard.setPos(scoreboardCenter)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(GLWidget, self).__init__(parent)

        self.shapes = Shapes([])
        self.orientation = 0
        self.wpZero = 0
        self.routearrows = []
        self.expprv = None

        self.isPanning = False
        self.isRotating = False
        self.isMultiSelect = False
        self._lastPos = QPoint()

        self.posX = 0.0
        self.posY = 0.0
        self.posZ = 0.0
        self.rotX = 0.0
        self.rotY = 0.0
        self.rotZ = 0.0
        self.scale = 1.0
        self.scaleCorr = 1.0

        self.showPathDirections = False
        self.showDisabledPaths = False

        self.BB = BoundingBox()

        self.tol = 0
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def init_ui(self):
        self.setFixedSize(700,600)
        self.assemble()
        self.set_styles()
        self.aux = QPoint(200,300)
        self.setWindowFlags(Qt.FramelessWindowHint)
        # self.setAttribute(Qt.WA_TranslucentBackground)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def mouseMoveEvent(self, event):
        delta = QPoint(event.globalPos() - self.oldPos)
        self.aux = QPoint(self.x() + delta.x(), self.y() + delta.y())
        self.move(self.aux)
        self.oldPos = event.globalPos()

        self._to_x = event.pos().x()
        self._to_y = event.pos().y()

        self.global_pos = event.globalPos()

        self._from_x = self._to_x
        self._from_y = self._to_y
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def mouseMoveEvent(self, evt):
        if self.selected:
            delta = QPoint(evt.globalPos() - self.oldPos)
            self.move(self.x() + delta.x(), self.y() + delta.y())
            self.oldPos = evt.globalPos()
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def mousePressEvent(self, qmouseevent):
        super().mousePressEvent(qmouseevent)
        bt = qmouseevent.button()
        if bt == 2:
            menu = QMenu(self)
            for action in self.popup_items:
                _action = menu.addAction(action[0])
                _action.triggered.connect(action[1])

            point = QPoint(qmouseevent.globalX(), qmouseevent.globalY())
            menu.popup(point)
项目:MyoSEMG    作者:LuffyDai    | 项目源码 | 文件源码
def __init__(self,parent):
        super(MyBar,self).__init__()
        self.parent = parent
        self.layout = QHBoxLayout()
        self.layout.setContentsMargins(0,5,10,0)
        self.title = QLabel("MyoSEMG")

        self.m_DragPosition = self.parent.pos()


        self.pushButtonClose = QPushButton("")
        self.pushButtonClose.setObjectName("pushButtonClose")
        self.pushButtonClose.clicked.connect(self.btn_close_clicked)


        self.pushButtonMinimize = QPushButton("")
        self.pushButtonMinimize.setObjectName("pushButtonMinimize")
        self.pushButtonMinimize.clicked.connect(self.btn_min_clicked)

        self.pushButtonMaximize = QPushButton("")
        self.pushButtonMaximize.setObjectName("pushButtonMaximize")
        self.pushButtonMaximize.clicked.connect(self.btn_max_clicked)


        self.title.setFixedHeight(14)
        self.title.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(self.title)
        self.layout.addWidget(self.pushButtonMinimize)
        self.layout.addWidget(self.pushButtonMaximize)
        self.layout.addWidget(self.pushButtonClose)

        self.windowstyle = load_windowstyle()
        self.setStyleSheet(self.windowstyle)
        self.setLayout(self.layout)

        self.start = QPoint(0,0)
        self.pressing = False
        self.maxNormal = True
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def qt_point_to_point(qt_point, unit=None):
    """Create a Point from a QPoint or QPointF

    Args:
        qt_point (QPoint or QPointF): The source point
        unit (Unit): An optional unit to convert
            values to in the output `Point`. If omitted, values
            in the output `Point` will be plain `int` or `float` values.

    Returns: Point
    """
    if unit:
        return Point(qt_point.x(), qt_point.y()).to_unit(unit)
    else:
        return Point(qt_point.x(), qt_point.y())
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def point_to_qt_point(point):
    """Create a QPoint from a Point

    Args:
        point (Point): The source point

    Returns: QPoint
    """
    return QPoint(unit_to_qt_int(point.x), unit_to_qt_int(point.y))
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def test_qt_point_to_point_with_q_point():
    point = qt_point_to_point(QPoint(1, 2))
    assert(isinstance(point, Point))
    assert(point.x == 1)
    assert(point.y == 2)
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def test_qt_point_to_point_with_q_point_and_unit_class():
    point = qt_point_to_point(QPoint(1, 2), GraphicUnit)
    assert(isinstance(point, Point))
    assert(point.x == GraphicUnit(1))
    assert(point.y == GraphicUnit(2))
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def test_point_to_qt_point():
    qpoint = point_to_qt_point(Point(GraphicUnit(1.2), GraphicUnit(2.2)))
    assert(isinstance(qpoint, QPoint))
    assert(qpoint.x() == 1)
    assert(qpoint.y() == 2)


# point_to_qt_point_f #########################################################