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


Python QtGui.QTransform类代码示例

本文整理汇总了Python中PyQt4.QtGui.QTransform的典型用法代码示例。如果您正苦于以下问题:Python QTransform类的具体用法?Python QTransform怎么用?Python QTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: paintEvent

    def paintEvent(self, event ):
        """QToolBar.paintEvent reimplementation
        Draws buttons, dock icon and text
        """
        rect = self._spacer.rect()

        painter = QPainter( self )

        transform = QTransform()
        transform.translate(self._spacer.pos().x(), self._spacer.pos().y())
        painter.setTransform( transform )

        """ Not supported currently
        if  self._dock.features() & QDockWidget.DockWidgetVerticalTitleBar :
            transform = QTransform()

            rect.setSize( QSize( rect.height(), rect.width() ) )
            transform.rotate( -90 )
            transform.translate( -rect.width(), 0 )

            painter.setTransform( transform )
        """

        # icon / title
        optionB = QStyleOptionButton()
        optionB.initFrom( self._dock )
        optionB.rect = rect
        optionB.text = self._dock.windowTitle()
        optionB.iconSize = self.iconSize()
        optionB.icon = self._dock.windowIcon()

        self.style().drawControl( QStyle.CE_PushButtonLabel, optionB, painter, self._dock )
开发者ID:adjustive,项目名称:enki,代码行数:32,代码来源:dockwidget.py

示例2: scene_bbox

def scene_bbox(item, view=None):
    """
    Returns the bounding box of an item in scene space.

    If view is given and the object has the
    QGraphicsItem::ItemIgnoresTransformations flag set, additional steps are
    taken to compute the exact bounding box of the item.
    """
    bbox = item.boundingRect()
    if not (item.flags() & QGraphicsItem.ItemIgnoresTransformations):
        # Normal item, simply map its bounding box to scene space
        bbox = item.mapRectToScene(bbox)
    else:
        # Item with the ItemIgnoresTransformations flag, need to compute its
        # bounding box with deviceTransform()
        if view is not None:
            vp_trans = view.viewportTransform()
        else:
            vp_trans = QTransform()
        item_to_vp_trans = item.deviceTransform(vp_trans)
        # Map bbox to viewport space
        bbox = item_to_vp_trans.mapRect(bbox)
        # Map bbox back to scene space
        bbox = vp_trans.inverted()[0].mapRect(bbox)
    return bbox                    
开发者ID:flupke,项目名称:pyflu,代码行数:25,代码来源:graphics.py

示例3: get_nametag

def get_nametag(char_id, x, y, color, vertical = False):
  
  w = IMG_W
  h = IMG_H
  
  nametag = get_char_name(char_id, common.editor_config.data01_dir)
  if nametag == None:
    nametag = "NAMETAG MISSING"
  
  if vertical:
    nametag_img = QImage(h, w, QImage.Format_ARGB32_Premultiplied)
    
    new_x   = h - y
    new_y   = x
    x       = new_x
    y       = new_y
  else:
    nametag_img = QImage(w, h, QImage.Format_ARGB32_Premultiplied)
  
  format = TextFormat(x = x, y = y, w = 25, h = 25, align = TEXT_ALIGN.left, orient = TEXT_ORIENT.hor, clt = 0)
  nametag_img = print_text(nametag_img, nametag, None, format = format, mangle = False)
  
  if vertical:
    matrix = QTransform()
    matrix.rotate(-90)
    nametag_img = nametag_img.transformed(matrix)
  
  nametag_img = replace_all_colors(nametag_img, color)
  
  return nametag_img
开发者ID:ThunderGemios10,项目名称:The-Super-Duper-Script-Editor-2,代码行数:30,代码来源:text_printer.py

示例4: updateTransfrom

	def updateTransfrom( self ):
		if self.updating : return
		self.updating = True
		trans = QTransform()
		trans.translate( self.valueToX( -self.scrollX ) + self.offsetX, self.valueToY( -self.scrollY ) )
		self.setTransform( trans )
		self.update()
		self.updating = False
开发者ID:tommo,项目名称:gii,代码行数:8,代码来源:CurveView.py

示例5: setZoom

	def setZoom( self, x, y ):
		self.zx = x
		self.zy = y
		trans = QTransform()
		trans.scale( self.zx, self.zy )
		self.setTransform( trans )
		for vert in self.vertItems:
			vert.updateZoom( self.zx, self.zy )
开发者ID:tommo,项目名称:gii,代码行数:8,代码来源:CurveView.py

示例6: updateZoom

	def updateZoom( self, zx, zy ):
		trans = QTransform()
		trans.scale( 1.0/zx, 1.0/zy )
		# self.setTransform( trans )
		self.VP.setTransform( trans )
		self.preBP.setTransform( trans )
		self.postBP.setTransform( trans )
		self.updateTPPos()
开发者ID:tommo,项目名称:gii,代码行数:8,代码来源:CurveView.py

示例7: transform

 def transform(self):
     try:
         return self.__dict__['transform'] if self.scale else QTransform()
     except KeyError:
         transform = QTransform()
         image = self.client.image
         if image is not None and not image.isNull():
             scale = min(self.width()/image.width(), self.height()/image.height())
             transform.translate((self.width() - image.width()*scale)/2, (self.height() - image.height()*scale)/2)
             transform.scale(scale, scale)
             transform = self.__dict__.setdefault('transform', transform)
         return transform
开发者ID:kevinlovesing,项目名称:blink-qt,代码行数:12,代码来源:vncviewer.py

示例8: ellipse_path

def ellipse_path(center, a, b, rotation=0):
    if not isinstance(center, QPointF):
        center = QPointF(*center)

    brect = QRectF(-a, -b, 2 * a, 2 * b)

    path = QPainterPath()
    path.addEllipse(brect)

    if rotation != 0:
        transform = QTransform().rotate(rotation)
        path = transform.map(path)

    path.translate(center)
    return path
开发者ID:PythonCharmers,项目名称:orange3,代码行数:15,代码来源:owvenndiagram.py

示例9: __init__

    def __init__(self, *args, **kwargs):
        QDockWidget.__init__(self, *args, **kwargs)

        self.__expandedWidget = None
        self.__collapsedWidget = None
        self.__expanded = True

        self.__trueMinimumWidth = -1

        self.setFeatures(QDockWidget.DockWidgetClosable | \
                         QDockWidget.DockWidgetMovable)
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.featuresChanged.connect(self.__onFeaturesChanged)
        self.dockLocationChanged.connect(self.__onDockLocationChanged)

        # Use the toolbar horizontal extension button icon as the default
        # for the expand/collapse button
        pm = self.style().standardPixmap(
            QStyle.SP_ToolBarHorizontalExtensionButton
        )

        # Rotate the icon
        transform = QTransform()
        transform.rotate(180)

        pm_rev = pm.transformed(transform)

        self.__iconRight = QIcon(pm)
        self.__iconLeft = QIcon(pm_rev)

        close = self.findChild(QAbstractButton,
                               name="qt_dockwidget_closebutton")

        close.installEventFilter(self)
        self.__closeButton = close

        self.__stack = AnimatedStackedWidget()

        self.__stack.setSizePolicy(QSizePolicy.Fixed,
                                   QSizePolicy.Expanding)

        self.__stack.transitionStarted.connect(self.__onTransitionStarted)
        self.__stack.transitionFinished.connect(self.__onTransitionFinished)

        QDockWidget.setWidget(self, self.__stack)

        self.__closeButton.setIcon(self.__iconLeft)
开发者ID:675801717,项目名称:orange3,代码行数:48,代码来源:dock.py

示例10: __init__

 def __init__(self,parent, font_name, font_size, font_height, w,h, colorscheme):
     super().__init__(parent)
     self.setFocusPolicy(Qt.WheelFocus)
     self.setAutoFillBackground(False)
     self.setAttribute(Qt.WA_OpaquePaintEvent, True)
     self.setCursor(Qt.IBeamCursor)
     font = QFont(font_name)
     font.setPixelSize(font_size)
     self.setFont(font)
     self._screen = []
     self._text = []
     self._transform= QTransform()
     self._cursor_col = 0
     self._cursor_row = 0
     self._dirty = False
     self._kbdfunc= None
     self._w=w
     self._h=h
     self._alt_sequence= False
     self._alt_seq_length=0
     self._alt_seq_value=0
     self._cursortype= CURSOR_OFF
     self._color_scheme=self.color_schemes[self.color_scheme_names[colorscheme]]
     self._cursor_color=self._color_scheme[2]
     self._cursor_char= 0x20
     self._cursor_attr=-1
     self._cursor_update=True
     self._blink= True
     self._blink_counter=0
     self._cursor_rect = QRect(0, 0, self._char_width, self._char_height)
     self._cursor_polygon=QPolygon([QPoint(0,0+(self._char_height/2)), QPoint(0+(self._char_width*0.8),0+self._char_height), QPoint(0+(self._char_width*0.8),0+(self._char_height*0.67)), QPoint(0+self._char_width,0+(self._char_height*0.67)), QPoint(0+self._char_width,0+(self._char_height*0.33)), QPoint(0+(self._char_width*0.8),0+(self._char_height*0.33)), QPoint(0+(self._char_width*0.8),0), QPoint(0,0+(self._char_height/2))])
开发者ID:wyongfei,项目名称:pyilper,代码行数:31,代码来源:pilqterm.py

示例11: data

 def data(self, index, role):
     if not index.isValid():
         return QVariant()
     if index.row() >= len(self.list):
         return QVariant()
     if role == Qt.DecorationRole:
         card = self.list[index.row()]
         pixmap = card.pixmap()
         pixmap = pixmap.scaledToHeight(self.preferredCardHeight)
         if card.tapped:
             transform = QTransform()
             transform.rotate(90)
             pixmap = pixmap.transformed(transform)
         return pixmap
         
     return QVariant()
开发者ID:mplamann,项目名称:PTG,代码行数:16,代码来源:QCardModel.py

示例12: updateStandardIcons

    def updateStandardIcons(self):
        size = QSize(16, 16)
        rect = QRect(QPoint(), self.iconSize())

        transform = QTransform()
        transform.rotate(90)

        pixmap = self.style().standardIcon(QStyle.SP_TitleBarNormalButton, None, self.widgetForAction(self.aFloat)).pixmap(size)
        rect.moveCenter(pixmap.rect().center())
        pixmap = pixmap.copy(rect)
        self.aFloat.setIcon(QIcon(pixmap))

        pixmap = self.style().standardIcon(QStyle.SP_TitleBarCloseButton, None, self.widgetForAction(self.aClose)).pixmap(size)
        rect.moveCenter(pixmap.rect().center())
        pixmap = pixmap.copy(rect)
        self.aClose.setIcon(QIcon(pixmap))
开发者ID:mprska,项目名称:ricodebug,代码行数:16,代码来源:docktitlebar.py

示例13: resizeEvent

    def resizeEvent(self, event):
        w = self.view.width() - 10
        h = self.view.height() - 10

        transform = QTransform.fromScale(w, h)

        self.view.setTransform(transform)
        QWidget.resizeEvent(self, event)
开发者ID:karolszczapa,项目名称:GIS,代码行数:8,代码来源:GraphGui.py

示例14: _define_symbols

def _define_symbols():
    """
    Add symbol ? to ScatterPlotItemSymbols,
    reflect the triangle to point upwards
    """
    symbols = pyqtgraph.graphicsItems.ScatterPlotItem.Symbols
    path = QPainterPath()
    path.addEllipse(QRectF(-0.35, -0.35, 0.7, 0.7))
    path.moveTo(-0.5, 0.5)
    path.lineTo(0.5, -0.5)
    path.moveTo(-0.5, -0.5)
    path.lineTo(0.5, 0.5)
    symbols["?"] = path

    tr = QTransform()
    tr.rotate(180)
    symbols['t'] = tr.map(symbols['t'])
开发者ID:JingqinGao,项目名称:orange3,代码行数:17,代码来源:owscatterplotgraph.py

示例15: trigger

    def trigger(self, ui):
        """
        Trigger this animation
        """
        glyph = [glyph for glyph in ui.scene.items()
                 if hasattr(glyph, 'entity') and glyph.entity == self.mover][0]

        if self.direction in (2, 3, 4):
            self.flipped = True
            self.offset = 32

        if self.direction in (6, 7, 8):
            self.flipped = False
            self.offset = 0

        if self.flipped:
            glyph.flipped = True
            glyph.setTransform(QTransform.fromScale(-1, 1))
        else:
            glyph.flipped = False
            glyph.setTransform(QTransform.fromScale(1, 1))

        if glyph.entity.artificial_intelligence:
            adapter = MapGlyphAdapter(ui, glyph)
        else:
            adapter = MapGlyphAdapter(ui, glyph, True)

        animation = QParallelAnimationGroup()

        move_y = QPropertyAnimation(adapter, 'y_location')
        move_y.setDuration(100)
        move_y.setStartValue(self.start[1] * 32)
        move_y.setEndValue(self.destination[1] * 32)

        move_x = QPropertyAnimation(adapter, 'x_location')
        move_x.setDuration(100)
        move_x.setStartValue(self.start[0] * 32 + self.offset)
        move_x.setEndValue(self.destination[0] * 32 + self.offset)

        animation.addAnimation(move_y)
        animation.addAnimation(move_x)

        ui.animations.append(animation)
        animation.finished.connect(ui.remove_finished_animation)

        animation.start()
开发者ID:,项目名称:,代码行数:46,代码来源:


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