Results 1 to 4 of 4

Thread: QGraphicsTextItem setPlainText() is resetting the item

  1. #1
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QGraphicsTextItem setPlainText() is resetting the item

    Hello all,

    I have managed to do a lot of work on the application I am working on after an initial ramp-up period and I have run into a confusing problem.

    I have as QTableView class that allows the user to type in text into a QDelegate'ed QTableWidgetItem. There is a SIGNAL/SLOT combo that calls QGraphicsTextItem::setPlainText() directly onto a QGraphicsTextItem control I have created.

    The QGraphicsTextItem control is a child object to another QGraphicsItem, and both have been registered with the scene that is attached to the primary widget in the application.

    The problem is that when I make the QGraphicsTextItem::setPlainText() call with some new text, all of the text in the item disappears.

    I found a potential solution here: http://stackoverflow.com/questions/3...on-text-change

    However that actually made the entire control disappear rather than make the text go away. I can select the empty control but I can no longer double-click in it and set the text that way like I could before the call.

    Any ideas?

    Cheers!
    -Caolan.

  2. #2
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QGraphicsTextItem setPlainText() is resetting the item

    bueller? bueller?

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGraphicsTextItem setPlainText() is resetting the item

    The problem is that when I make the QGraphicsTextItem::setPlainText() call with some new text, all of the text in the item disappears.
    Including the new text? You are going to have to post the code (all of the code in the slot, not just the setPlainText() line) so we can see some context.

  4. #4
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QGraphicsTextItem setPlainText() is resetting the item

    I solved the problem actually. It revolved around catching a bug I wasn't expecting...

    Thanks!

Similar Threads

  1. Replies: 0
    Last Post: 16th April 2014, 07:49
  2. setPlainText/setText simply won't run
    By RandomNobodyEU in forum Qt Programming
    Replies: 5
    Last Post: 9th June 2013, 22:24
  3. QGraphicsTextItem setPlainText Memory issue
    By decin in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2010, 03:03
  4. Resetting a Qwidget
    By devilj in forum Qt Programming
    Replies: 12
    Last Post: 3rd July 2007, 10:32
  5. Resetting Tableview...
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 26th September 2006, 06:57

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.