View Full Version : How can to change the QGraphicsTextItem 's cursor width?
robertkun
17th July 2009, 08:45
Hello ,
I am using a QGraphicsTextItem ,but the cursor in it is too thin to find it .
And I Find the QGraphicsTextItem doesn't supports the method of " setCursorWidth( ) ".
Does anybody know how to change it tell me please.
Thanks.
robertkun
11th August 2009, 03:49
#include "cgTextItem.h"
#include <QPlainTextDocumentLayout>
cgTextItem::cgTextItem(QGraphicsItem *parent, QGraphicsScene *scene)
:QGraphicsTextItem(parent, scene)
{
QFont newFont = font();
newFont.setPointSize(24);
setFont(newFont);
setDefaultTextColor(Qt::blue);
QPlainTextDocumentLayout *plainLayout = new QPlainTextDocumentLayout(document());
plainLayout->setCursorWidth(100);
document()->setDocumentLayout(plainLayout);
setFlag(QGraphicsItem::ItemIsMovable,true);
setFlag(QGraphicsItem::ItemIsSelectable,true);
setTextInteractionFlags(Qt::TextEditorInteraction) ;
setPlainText("New Item");
}
this is my construct function ,the QPlainTextDocumentLayout have a function setCursorWidth can be change the cursor width in the QGraphicsTextItem ,
but the effect is not good,it becomed very small. I don't know the reason .can you help me ?
And changed the setCursorWidth's value ,the effect is still .
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.