Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting foreground in a QTextCharFormat from a QPalette
Forum Updated to NodeBB v4.3 + New Features

Setting foreground in a QTextCharFormat from a QPalette

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Forgive
    wrote on last edited by
    #1

    It is possible to set a QTextCharFormat foreground from a QPalette?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      setForeground() takes a [[Doc:QBrush]] as argument, [[Doc:QPalette]] returns brushes. So, yes, this works. You'll have to poke the brush out of the palette manually, though, there's no way to pass a QPalette to the text format directly.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Forgive
        wrote on last edited by
        #3

        I see, thanks.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved