The QGraphicsTextItem class, part of the Qt framework, provides a text item that you can add to a QGraphicsScene to display formatted text.
Questions tagged [qgraphicstextitem]
64 questions
1
vote
1 answer
How to make text align to center(vertical) in QGraphicsTextItem?
In my project, I am using graphic units that consist of a QGraphicsItem which contains a QGraphicsTextItem.
item_text is set to position (0,0) and its width is set to the width of the rect_item. In order to center the text in the center(horizontal),…

Samantha Smith
- 41
- 6
1
vote
0 answers
QGraphicsTextItem dynamic resizing
I'd like to dynamically resize a QGraphicsTextItem object and keep the text in top left corner.
I've tried to tackle this problem in many ways without any success so I included the version of code which is IMO the closest to the working…

webpositive
- 41
- 5
1
vote
1 answer
QGraphicsTextItem receive keypresses
import sys
import random
from PySide2 import QtCore, QtWidgets, QtGui
# IN PROCESS
class MainWindow(QtWidgets.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
# IN PROCESS
class…

trayres
- 522
- 2
- 6
- 18
1
vote
2 answers
How to add Axis features (labels, ticks, values) to a 3D plot with GLViewWidget of pyqtgraph?
I want to add axis info such as labels, ticks and values to a 3D scene created with the pyqtgraph.opengl.GLViewWidget module. There is already a very simple axis drawing option with GLAxisItem, but with this you can only control the length of the…

Luiz Tauffer
- 463
- 6
- 17
1
vote
2 answers
QPropertyAnimation of a QGraphicsTextItem with a frame make the text shaky
I am animating a QGraphicsTextItem that I have added a frame around. During the animation the text seems to shake slightly inside the frame, which is very annoying.
An example code:
class MovingFrameText : public QGraphicsTextItem
{
Q_OBJECT;
…

plover
- 439
- 5
- 17
1
vote
1 answer
QT : QGraphicsTextItem alignment char to top-left corner
I want to draw a character aligned to the top-left corner of parent.
QGraphicsTextItem * tItem = new QGraphicsTextItem(parent);
tItem->setPlainText("a");
tItem->setPos(QPointF(0,0));
Picture below presents output of my code (grey rectangle is…

Newbie
- 249
- 1
- 2
- 8
1
vote
1 answer
Child QGraphicsItem move event (ItemIsMovable) to its parent
How can a child QGraphicsItem move its parent item ?
I set the child item's ItemIsMovable flag and when I try to move the child item, the parent item does not move, only child item moves.
// child items's mouseMoveEvent
void…

Baris Atamer
- 700
- 7
- 13
1
vote
3 answers
Getting QGraphicsTextItem length?
Is there anyway to calculate the text's length when TextWidth = -1?.
I have a rectangle that has a QGraphicsTextItem in it, and I want to change the rectangle's width when characters exceed the rectangle.

Baris Atamer
- 700
- 7
- 13
1
vote
0 answers
Displaying overlayed QGraphicsItems
I have developed an application in PyQt5 that displays an image and allows the user to pan the image using the mouse and zoom using the mouse wheel. I now need to add the functionality to show popup text associated to specific parts of the displayed…

Stuart Buckingham
- 1,574
- 16
- 25
1
vote
1 answer
How to check position of a wheelEvent within text of a QGraphicsTextItem?
I have a QGraphicsTextItem subclass that accepts mouse events (i.e. implements wheelEvent() method.
How can I check on which position within the text the wheel event happened? I would like to get the letter that the mouse pointer pointed at when the…

Tadeusz A. Kadłubowski
- 8,047
- 1
- 30
- 37
1
vote
0 answers
How to render text of QGraphicsSimpleTextItem from right to left in Qt?
I've an Object that inherits from QGraphicsRectItem and looks like schematic.
i want to render the red underlined QGraphicsSimpletextItem inside the rectangle so that it renders from right to left.
Is there any function in Qt that can render…

secretgenes
- 1,291
- 1
- 19
- 39
1
vote
0 answers
How to get the signal like currentCharFormatChanged from QGraphicsTextItem variable
I am implementing a text editor by Qt. Since I added the editor to a QGraphicsScene, I chose QGraphicsTextItem to implement it. However, I want to change the status of some tool buttons(like "bold", "italic", "font", etc) when the cursor change. The…

Liya Yang
- 11
- 1
1
vote
1 answer
Fetch text from unnamed QGraphicsTextItem
A friend of mine and I are currently trying to make a game in C++ using Qt. Our current problem is that we need to fetch text from a QGraphicsTextItem on a button mousePressEvent. In the game menu it is possible to choose how many players there are,…

Dromnes
- 302
- 2
- 3
- 12
1
vote
1 answer
Updating a QGraphicsTextItem on text change
I’ve been working with QGraphicsTextItem. I currently have the laid out in a scene, each depicting a physical page of text. Right now I’m overriding the keyReleaseEvent function to redistribute the text typed across all of the pages. The problem…

icco
- 3,064
- 4
- 35
- 49
1
vote
1 answer
QGraphicPixmapItem double click event does not go to parent widget while QGraphicsTextItem send
I have a main widget in Qt and this widget contains a QGraphicsView and inside it QGraphicsScene. In scene I add QGraphicsPixmapItems and QGraphicsTextItems. In main widget I handle QWidget::mouseDoubleClickEvent ( QMouseEvent * event ), my items…

Akın Yılmaz
- 300
- 5
- 18