Results 1 to 3 of 3

Thread: QUndoCommand and QGraphicsTextItem

  1. #1
    Join Date
    Jul 2012
    Location
    Switzerland
    Posts
    32
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default QUndoCommand and QGraphicsTextItem

    Hello everyone,

    I wanted to implement costom behvior for typing in a QGraphicsTextItem. The Problem is, that I've a MainWindow class where the QUndoStack is (and where it should be added). Is there a good way to connect the active QGraphicsTextItem with this method(on Mainwindow class which creates a QUndoCommand for typing) or do I have to emit a singal from the QGraphicsScene if the QGraphicsTextitem has changed?

    hope someone can help me

    thank you

    airglide

  2. #2
    Join Date
    Jul 2012
    Location
    Switzerland
    Posts
    32
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QUndoCommand and QGraphicsTextItem

    well I've managed to do it, it isn't that pretty...

    If I add an QTextItem a QUndoCommand is created and there i can call a QGraphicsScene public method which emits a Signal to the MainWindow, where the new QGraphicsTextItem is connected/disconnected...

    if you find out a smoother solution let me know

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QUndoCommand and QGraphicsTextItem

    QGraphicsTextItem has an embedded QTextDocument. You can manipulate it directly without interfacing the scene.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 8th March 2012, 04:19
  2. Replies: 51
    Last Post: 26th November 2010, 13:24
  3. Replies: 0
    Last Post: 3rd August 2010, 11:47
  4. QGraphicsRectItem and QGraphicsTextItem.
    By cydside in forum Qt Programming
    Replies: 13
    Last Post: 20th July 2009, 12:11
  5. QGraphicsTextItem - is it a bug there?
    By Tair in forum Qt Programming
    Replies: 5
    Last Post: 18th October 2006, 08:48

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.