PDA

View Full Version : QTextEdit changing color , after pasting some color data



PstdEr
3rd July 2013, 19:51
Hi,
I dont know this is a strange problem , or silly but i am stumbled..

I am using the following code to format my QTextEdit.

whenever i paste some colored text from some other location the color is visible as it is and if i press enter
the text "EnterHere>" also changing to same color as pasted text.
I am using "EnterHere>" as command promt
I tried using AutoFillFormat(None) but did not help.

please let me now if any body faced this before.



QFont font("Arial",9,QFont::Courier,FALSE);
setFont(font);
QPalette pl;

setAutoFillBackground(true);
pl.setColor(pl.Base,Qt::black);
pl.setColor(QPalette::Text,Qt::white);
setPalette(pl);
mPrompt = "EnterHere>";
append(mPrompt);


Added after 10 minutes:

Solved by using

setTextColor(Qt::white);
again after pressing enter.

Please let me know if any other way to disable the same