Results 1 to 2 of 2

Thread: How can to change the QGraphicsTextItem 's cursor width?

  1. #1

    Smile How can to change the QGraphicsTextItem 's cursor width?

    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.

  2. #2

    Smile Re: How can to change the QGraphicsTextItem 's cursor width?

    Qt Code:
    1. #include "cgTextItem.h"
    2. #include <QPlainTextDocumentLayout>
    3.  
    4.  
    5. cgTextItem::cgTextItem(QGraphicsItem *parent, QGraphicsScene *scene)
    6. :QGraphicsTextItem(parent, scene)
    7. {
    8. QFont newFont = font();
    9. newFont.setPointSize(24);
    10. setFont(newFont);
    11.  
    12. setDefaultTextColor(Qt::blue);
    13.  
    14. QPlainTextDocumentLayout *plainLayout = new QPlainTextDocumentLayout(document());
    15. plainLayout->setCursorWidth(100);
    16.  
    17. document()->setDocumentLayout(plainLayout);
    18.  
    19. setFlag(QGraphicsItem::ItemIsMovable,true);
    20. setFlag(QGraphicsItem::ItemIsSelectable,true);
    21. setTextInteractionFlags(Qt::TextEditorInteraction);
    22.  
    23. setPlainText("New Item");
    24. }
    To copy to clipboard, switch view to plain text mode 

    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 .
    Last edited by robertkun; 11th August 2009 at 03:57.

Similar Threads

  1. Change cursor & status during Drag & Drop
    By ronlongo in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2008, 16:56
  2. statusBar() message color change
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 23:20
  3. QGraphicsTextItem: handling cursor position change
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2007, 10:42
  4. QGraphicsTextItem size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2007, 08:34
  5. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.