PDA

View Full Version : Problem with QTextEdit



jogeshwarakundi
18th March 2008, 06:19
Hi,
I am using QTextEdit on Qtopia 4.3.0.
I set it to readonly.


QTextEdit* lTextEdit = new QTextEdit(this);
lTextEdit->setReadOnly(true);
lTextEdit->setText("You and me are one and same.\nYou and me are one and shame.\nYou and me are one and dame.");
lTextEdit->setGeometry(10, 140, 80, 80);

connect(lTextEdit, SIGNAL(textChanged()), this, SLOT(BtnClicked()));

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 :crying:
please help me out

jpn
18th March 2008, 12:26
Are you 100% sure you're not calling QTextEdit::clear() anywhere in your code? Did you connect any signals to the aforementioned slot?

wysota
18th March 2008, 12:29
Have you tried using QTextBrowser instead?

jogeshwarakundi
18th March 2008, 13:06
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.

jogeshwarakundi
18th March 2008, 16:03
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 :D


Have you tried using QTextBrowser instead?