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


Python Qt.SmoothTransformation方法代码示例

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


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

示例1: _paint_frame

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def _paint_frame(self, event):
        if self.bgimage:
            pixmap = self._build_pixmap(self.bgimage)
            # Check we need to resize the bgimage
            if self.bgsize:
                bgsize = self.bgsize
                if self.bgsize == 'fit':
                    bgsize = self.size()
                pixmap = pixmap.scaled(bgsize, Qt.KeepAspectRatio, Qt.SmoothTransformation)
            # Calculate the x,y position
            x,y = self.bgpos
            if self.bgpos:
                if x == 'left': x = 0
                elif x == 'center': x = (self.width() / 2) - (pixmap.width() / 2)
                elif x == 'right': x = self.width() - pixmap.width()
                if y == 'top': y = 0
                elif y == 'center': y = (self.height() / 2) - (pixmap.height() / 2)
                elif y == 'bottom': y = self.height() - pixmap.height()
            # Draw the pixmap
            painter = QtGui.QPainter(self)
            painter.setOpacity(self.bgopacity)
            painter.drawPixmap(int(x), int(y), pixmap) 
开发者ID:pkkid,项目名称:pkmeter,代码行数:24,代码来源:pkmixins.py

示例2: set_status

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def set_status(self, raw, exist=None):
        item = QLabel()
        item.setAlignment(Qt.AlignCenter)

        if exist is 0:
            icon = QPixmap(QUEUE_ICON).scaled(20, 20, Qt.KeepAspectRatio,
                                              Qt.SmoothTransformation)
            item.setPixmap(icon)
            item.setToolTip('Waiting in the download queue...')

        if exist is 1:
            icon = QPixmap(CHECK_ICON).scaled(20, 20, Qt.KeepAspectRatio,
                                              Qt.SmoothTransformation)
            item.setPixmap(icon)
            item.setToolTip('All the features are downloaded...')

        if exist is 2:
            item = QPushButton(self)
            item.setToolTip('Download')
            item.setIcon(QIcon(DOWNLOAD_ICON))
            item.clicked.connect(self.download_clicked)

        self.setCellWidget(raw, 0, item) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:25,代码来源:table.py

示例3: _draw_pixmap

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def _draw_pixmap(self, painter, draw_width, draw_height, scrolled):
        # scale pixmap
        scaled_pixmap = self._pixmap.scaledToWidth(
            draw_width,
            mode=Qt.SmoothTransformation)
        pixmap_size = scaled_pixmap.size()

        # draw the center part of the pixmap on available rect
        painter.save()
        brush = QBrush(scaled_pixmap)
        painter.setBrush(brush)
        # note: in practice, most of the time, we can't show the
        # whole artist pixmap, as a result, the artist head will be cut,
        # which causes bad visual effect. So we render the top-center part
        # of the pixmap here.
        y = (pixmap_size.height() - draw_height) // 3
        painter.translate(0, - y - scrolled)
        rect = QRect(0, y, draw_width, draw_height)
        painter.drawRect(rect)
        painter.restore() 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:22,代码来源:right_panel.py

示例4: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def paintEvent(self, event):
        ancho, altura = self.width(), self.height()
        icono = self.icono.scaled(ancho, altura, Qt.KeepAspectRatio, Qt.SmoothTransformation)

        pintor = QPainter()
        
        pintor.begin(self)
        pintor.setRenderHint(QPainter.Antialiasing, True)
        pintor.setPen(Qt.NoPen)
        pintor.drawPixmap(0, 0, icono, 0, 0, 0, 0)
        pintor.setPen(Qt.white)
        pintor.drawText(event.rect(), Qt.AlignCenter, self.etiqueta)
        pintor.setPen(Qt.NoPen)
        pintor.setBrush(self.opacidad)
        pintor.drawEllipse(0, 0, ancho, altura)
        pintor.end()

        self.setMask(icono.mask()) 
开发者ID:andresnino,项目名称:PyQt5,代码行数:20,代码来源:botonCircular.py

示例5: initUI

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def initUI(self):
        label = QLabel(self)
        label.setPixmap(QPixmap("Imagenes/siacle.jpg").scaled(450, 450, Qt.KeepAspectRatio,
                                                              Qt.SmoothTransformation))
        label.move(0, 0)

        botonCerrar = QPushButton("Cerrar", self)
        botonCerrar.setFixedSize(430, 32)
        botonCerrar.move(10, 457)

      # ========================= EVENTO =========================

        botonCerrar.clicked.connect(self.close)


# ========================= CLASE Acerca =========================== 
开发者ID:andresnino,项目名称:PyQt5,代码行数:18,代码来源:siacle.py

示例6: initUI

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

      # ==================== WIDGET QLABEL =======================
        
        self.labelImagen = QLabelClickable(self)
        self.labelImagen.setGeometry(15, 15, 118, 130)
        self.labelImagen.setToolTip("Imagen")
        self.labelImagen.setCursor(Qt.PointingHandCursor)

        self.labelImagen.setStyleSheet("QLabel {background-color: white; border: 1px solid "
                                       "#01DFD7; border-radius: 5px;}")

        self.pixmapImagen = QPixmap("Qt.png").scaled(112, 128, Qt.KeepAspectRatio,
                                                     Qt.SmoothTransformation)
        self.labelImagen.setPixmap(self.pixmapImagen)
        self.labelImagen.setAlignment(Qt.AlignCenter)

      # ===================== EVENTO QLABEL ======================

      # Llamar función al hacer clic o doble clic sobre el label
        self.labelImagen.clicked.connect(self.Clic)

  # ======================= FUNCIONES ============================ 
开发者ID:andresnino,项目名称:PyQt5,代码行数:25,代码来源:QLabel_clickable.py

示例7: doClockwise

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def doClockwise(self):
        # 顺时针45度
        image = QImage(self.srcImage.size(),
                       QImage.Format_ARGB32_Premultiplied)
        painter = QPainter()
        painter.begin(image)
        # 以图片中心为原点
        hw = self.srcImage.width() / 2
        hh = self.srcImage.height() / 2
        painter.translate(hw, hh)
        painter.rotate(45)  # 旋转45度
        painter.drawImage(-hw, -hh, self.srcImage)  # 把图片绘制上去
        painter.end()
        self.srcImage = image  # 替换
        self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage))

#         # 下面这个旋转方法针对90度的倍数,否则图片会变大
#         trans = QTransform()
#         trans.rotate(90)
#         self.srcImage = self.srcImage.transformed(
#             trans, Qt.SmoothTransformation)
#         self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage)) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:24,代码来源:ImageRotate.py

示例8: doAnticlockwise

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def doAnticlockwise(self):
        # 逆时针45度
        image = QImage(self.srcImage.size(),
                       QImage.Format_ARGB32_Premultiplied)
        painter = QPainter()
        painter.begin(image)
        # 以图片中心为原点
        hw = self.srcImage.width() / 2
        hh = self.srcImage.height() / 2
        painter.translate(hw, hh)
        painter.rotate(-45)  # 旋转-45度
        painter.drawImage(-hw, -hh, self.srcImage)  # 把图片绘制上去
        painter.end()
        self.srcImage = image  # 替换
        self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage))

#         # 下面这个旋转方法针对90度的倍数,否则图片会变大
#         trans = QTransform()
#         trans.rotate(90)
#         self.srcImage = self.srcImage.transformed(
#             trans, Qt.SmoothTransformation)
#         self.imageLabel.setPixmap(QPixmap.fromImage(self.srcImage)) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:24,代码来源:ImageRotate.py

示例9: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self)
        self.imgLabel = QLabel(self)
        self.coldSlider = QSlider(Qt.Horizontal, self)
        self.coldSlider.valueChanged.connect(self.doChange)
        self.coldSlider.setRange(0, 255)
        layout.addWidget(self.imgLabel)
        layout.addWidget(self.coldSlider)

        # 加载图片
        self.srcImg = QImage('src.jpg')
        self.imgLabel.setPixmap(QPixmap.fromImage(self.srcImg).scaledToWidth(800, Qt.SmoothTransformation))
        # DLL库
        self.dll = CDLL('Cold.dll')
        print(self.dll) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:18,代码来源:Test.py

示例10: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def paint(self, painter, option, index):
        column = index.column()
        if column == 1:
            pixmap = None
            status = index.data(Qt.UserRole)
            if status == MagicFolderChecker.LOADING:
                self.waiting_movie.setPaused(False)
                pixmap = self.waiting_movie.currentPixmap().scaled(
                    20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation
                )
            elif status in (
                MagicFolderChecker.SYNCING,
                MagicFolderChecker.SCANNING,
            ):
                self.sync_movie.setPaused(False)
                pixmap = self.sync_movie.currentPixmap().scaled(
                    20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation
                )
            if pixmap:
                point = option.rect.topLeft()
                painter.drawPixmap(QPoint(point.x(), point.y() + 5), pixmap)
                option.rect = option.rect.translated(pixmap.width(), 0)
        super(Delegate, self).paint(painter, option, index) 
开发者ID:gridsync,项目名称:gridsync,代码行数:25,代码来源:view.py

示例11: resizeEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def resizeEvent(self, event):
        # Resize images only if the width of the scroll area
        # is shorter than that of images
        for i, lbl in enumerate(self.lbl_img_list):
            w = self.width() - QStyle.PM_ScrollBarExtent
            if w < self.pixmap_list[i].width():
                lbl.setPixmap(
                        self.pixmap_list[i].scaledToWidth(
                            w, Qt.SmoothTransformation))
            else:
                lbl.setPixmap(
                        self.pixmap_list[i].scaledToWidth(
                            self.pixmap_list[i].width()))
        return super().resizeEvent(event) 
开发者ID:canard0328,项目名称:malss,代码行数:16,代码来源:content.py

示例12: update_preview

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def update_preview(self):
        if not self._preview_pixmap:
            return

        scaled = self._preview_pixmap.scaled(
            self._ui.lblPreview.width(),
            self._ui.lblPreview.height(),
            Qt.KeepAspectRatio,
            Qt.SmoothTransformation,
        )
        self._ui.lblPreview.setPixmap(scaled) 
开发者ID:zyantific,项目名称:IDASkins,代码行数:13,代码来源:themeselector.py

示例13: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def paintEvent(self, e):
        """
        draw pixmap with border radius

        We found two way to draw pixmap with border radius,
        one is as follow, the other way is using bitmap mask,
        but in our practice, the mask way has poor render effects
        """
        if self._pixmap is None:
            return
        radius = 3
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setRenderHint(QPainter.SmoothPixmapTransform)
        scaled_pixmap = self._pixmap.scaledToWidth(
            self.width(),
            mode=Qt.SmoothTransformation
        )
        size = scaled_pixmap.size()
        brush = QBrush(scaled_pixmap)
        painter.setBrush(brush)
        painter.setPen(Qt.NoPen)
        y = (size.height() - self.height()) // 2
        painter.save()
        painter.translate(0, -y)
        rect = QRect(0, y, self.width(), self.height())
        painter.drawRoundedRect(rect, radius, radius)
        painter.restore()
        painter.end() 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:31,代码来源:meta.py

示例14: set_cover_pixmap

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def set_cover_pixmap(self, pixmap):
        self._cover_label.show()
        self._cover_label.setPixmap(
            pixmap.scaledToWidth(self._cover_label.width(),
                                 mode=Qt.SmoothTransformation)) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:7,代码来源:meta.py

示例15: seleccionarImagen

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SmoothTransformation [as 别名]
def seleccionarImagen(self):
        imagen, extension = QFileDialog.getOpenFileName(self, "Seleccionar imagen", getcwd(),
                                                        "Archivos de imagen (*.png *.jpg)",
                                                        options=QFileDialog.Options())
          
        if imagen:
            # Adaptar imagen
            pixmapImagen = QPixmap(imagen).scaled(166, 178, Qt.KeepAspectRatio,
                                                  Qt.SmoothTransformation)

            # Mostrar imagen
            self.labelImagen.setPixmap(pixmapImagen) 
开发者ID:andresnino,项目名称:PyQt5,代码行数:14,代码来源:guardarImagen.py


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