Results 1 to 4 of 4

Thread: QTextEdit and some options

  1. #1
    Join Date
    Apr 2007
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTextEdit and some options

    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?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit and some options

    Try this:
    Qt Code:
    1. QPalette p = textEdit->palette();
    2. p.setColor( QPalette::Text, Qt::red );
    3. textEdit->setPalette(p);
    To copy to clipboard, switch view to plain text mode 

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

    Regards

  3. #3
    Join Date
    Apr 2007
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTextEdit and some options

    Quote Originally Posted by marcel View Post
    Try this:
    Qt Code:
    1. QPalette p = textEdit->palette();
    2. p.setColor( QPalette::Text, Qt::red );
    3. textEdit->setPalette(p);
    To copy to clipboard, switch view to plain text mode 

    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

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit and some options

    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

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.