Results 1 to 4 of 4

Thread: updating text in QTextEdit [SOLVED]

  1. #1
    Join Date
    Jul 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Cool updating text in QTextEdit [SOLVED]

    Hi
    I want to update the text in a QTextEdit upon the occurance of a specific event. Following is the snapshot of my application

    Qt Code:
    1. QTextEdit *metaDataText; // this is the text box to be updated
    2.  
    3. Window::Window(QWidget *parent) : QWidget(parent) { // constructor for the main window class
    4. metaDataText = new QTextEdit; // initializing the text box
    5. metaDataText->setText(MetaData::returnMetaData()); // puttin in initial values
    6. }
    To copy to clipboard, switch view to plain text mode 

    I want to display when the text in the MetaData class changes.
    So when the text changes in the MetaData class, a signal (triggerMetaDataUpdate) is issued, for which a slot is present in the window class as given below:

    Qt Code:
    1. void Window::triggerMetaDataUpdate(){ // slot for the signal
    2. metaDataText->setText(MetaData::returnMetaData()); // call to update, which does not update:(
    3. update();
    4. }
    To copy to clipboard, switch view to plain text mode 

    but this thing does not update the text in the QTextEdit.

    can someone please help me do this correctly?

    thanks
    Last edited by me_here_me; 25th September 2007 at 15:03.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: updating text in QTextEdit

    Can you verify that the slot indeed gets called and that MetaData::returnMetaData() returns changed data?

  3. #3
    Join Date
    Jul 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: updating text in QTextEdit

    its solved. sorry for bothering.


    there was some error in receiving the signal.

    regards

  4. #4
    Join Date
    Jul 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: updating text in QTextEdit

    thanks wysota


    you are right on THE TARGET.

    this was the matter that took me soo long

    thanks for help

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  3. How to get text of last line only in QTextEdit?
    By rajesh in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2006, 13:37
  4. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  5. coordinates of selected text in QTextEdit
    By sreedhar in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2006, 17:22

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.