python - PyQT: draw a QPainterPath() in rect? -
with qt, if use qpainter.drawtext() can pass string of characters want draw , coordinates of bounding rect argument. when drawing path qpainter.drawpath() can't specify bounding rect or coordinates path should fit in.
there built-in method of qpainterpath make fit inside bounding rect or coordinates? or have program appropriate translation , scaling manually?also, how create qpixmap qpainterpath of given size?
what i'm trying do: have font object hosts vector coordinates , draw glyphs. have function creates qpainterpath() font object. it's font editor.
thanks stepping-by.
well, answering myself first part of question: it's not path should changed painter, can save state translate,scale etc... draw path , restore state afterwards. e.g.:
painter.save() painter.translate(0,-self.squaresize) painter.scale(factor, -factor) painter.fillpath(glyph, qt.black) painter.restore()
Comments
Post a Comment