Results 1 to 3 of 3

Thread: QTextEdit and style sheets

  1. #1
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTextEdit and style sheets

    Hello! I'm trying to customize QTextEdit colors via the stylesheet:

    Qt Code:
    1. textEdit->setStyleSheet ("color: " + text_color + "; background-color: " + back_color +
    2. "; selection-color: " + sel_text_color + "; selection-background-color: " + sel_back_color + ";");
    To copy to clipboard, switch view to plain text mode 

    text_color, back_color, etc. are QString variables. The colors are change, but the QTextEdit's scrollbar becomes unusable - the scrollbar receives just single clicks, no drag'n'drop of the scroller pointer, and it looks like it has no visual style at all.

  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: QTextEdit and style sheets

    Use a type selector to exclude scroll bars:
    Qt Code:
    1. textEdit->setStyleSheet("QTextEdit { ... }");
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

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

    roxton (13th September 2008)

  4. #3
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit and style sheets

    It works! Thank you!

Similar Threads

  1. Span style is not working in QTextEdit
    By joy in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2007, 13:56

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.