Results 1 to 5 of 5

Thread: Problem with QTextEdit

  1. #1
    Join Date
    Dec 2007
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Unhappy Problem with QTextEdit

    Hi,
    I am using QTextEdit on Qtopia 4.3.0.
    I set it to readonly.

    Qt Code:
    1. QTextEdit* lTextEdit = new QTextEdit(this);
    2. lTextEdit->setReadOnly(true);
    3. lTextEdit->setText("You and me are one and same.\nYou and me are one and shame.\nYou and me are one and dame.");
    4. lTextEdit->setGeometry(10, 140, 80, 80);
    5.  
    6. connect(lTextEdit, SIGNAL(textChanged()), this, SLOT(BtnClicked()));
    To copy to clipboard, switch view to plain text mode 

    All is working fine like being unable to modify it, select the text etc.
    Problem is that when the widget attains navigation focus (the whole textbox and scrollbar are highlighted) i type a space or any other alphanumeric key, the text is lost. I tried searching but to no result
    please help me out
    Let your work talk for you

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with QTextEdit

    Are you 100% sure you're not calling QTextEdit::clear() anywhere in your code? Did you connect any signals to the aforementioned slot?
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    jogeshwarakundi (18th March 2008)

  4. #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: Problem with QTextEdit

    Have you tried using QTextBrowser instead?

  5. The following user says thank you to wysota for this useful post:

    jogeshwarakundi (18th March 2008)

  6. #4
    Join Date
    Dec 2007
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Problem with QTextEdit

    Quote Originally Posted by jpn View Post
    Are you 100% sure you're not calling QTextEdit::clear() anywhere in your code? Did you connect any signals to the aforementioned slot?
    Yes, I have a parent class (inherits QWidget and acts as the main window and class for QTOPIA_MAIN) inside whose constructor this is the only code. I have a button for exit, a sample button which does nothing and this TextEdit. nothing else is written. This clearing happens only when the widget gets navigation focus through arrow or tab. Operations through mouse and scrolling through arrow etc all work fine.
    Let your work talk for you

  7. #5
    Join Date
    Dec 2007
    Posts
    40
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Problem with QTextEdit

    wow! QTextBrowser does not have this problem. I can go ahead and use it.
    But still would like to know why it happens with QTextEdit...will try to poke into the issue more...
    Thanks to all. god only knows how ppl like me can manage without support of you all

    Quote Originally Posted by wysota View Post
    Have you tried using QTextBrowser instead?
    Let your work talk for you

Similar Threads

  1. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 15:36
  2. repaint problem in QTextEdit
    By kennyxing in forum Qt Programming
    Replies: 2
    Last Post: 10th November 2006, 09:49
  3. QTextEdit problem
    By vijay anandh in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2006, 12:56
  4. setting cursor problem in QTextEdit
    By jyoti kumar in forum Qt Programming
    Replies: 3
    Last Post: 19th May 2006, 09:17
  5. Problem with inserting text into QTextEdit
    By xorrr in forum Qt Programming
    Replies: 0
    Last Post: 6th February 2006, 12:45

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.