PDA

View Full Version : QTextEdit and some options



troorl_ua
29th June 2007, 20:55
Hi!
How can I set the color of text in QTextEdit without using styles and html formatting (text is readonly). setTextColor not working :(
And one more question. How can I set margin at the left or right border?

marcel
29th June 2007, 20:59
Try this:


QPalette p = textEdit->palette();
p.setColor( QPalette::Text, Qt::red );
textEdit->setPalette(p);


What do you mean by margin?
Do you want an offset for the text displayed by the text edit?

Regards

troorl_ua
29th June 2007, 21:50
Try this:


QPalette p = textEdit->palette();
p.setColor( QPalette::Text, Qt::red );
textEdit->setPalette(p);


What do you mean by margin?
Do you want an offset for the text displayed by the text edit?

Regards

Thanks for the first answer. I mean a space between border of QTextEdit and text.

PS. Sorry for my English :o

marcel
29th June 2007, 22:03
What do you need an offset for?
Do you want to insert something in at the left of the text( icons, widgets, etc )?

If this is the case, then you can use QAbstractScrollArea::setViewportMargins to make some room for what you need to add.

Regards