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. How to set style "font-family" for selected row in QTableView?
QtWS25 Last Chance

How to set style "font-family" for selected row in QTableView?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtableview font
7 Posts 3 Posters 6.4k Views
  • 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.
  • David.ReznicekD Offline
    David.ReznicekD Offline
    David.Reznicek
    wrote on last edited by
    #1

    Hello,

    can anybody help me please? How can I set style for font-family for selected item in QTreeView/QTableView?

    Trying:

    QTreeView::item:selected { font-familly: ....; font-size: ...; }
    QTableView::item:selected { font-familly: ....; font-size: ...; }

    Thanks,
    David.

    raven-worxR 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      If you right click your Treeview, there is CSS editor
      (if u use UI files)

      Have u tried with
      { font: 16pt "Segoe UI Emoji"; }

      1 Reply Last reply
      0
      • David.ReznicekD Offline
        David.ReznicekD Offline
        David.Reznicek
        wrote on last edited by David.Reznicek
        #3

        Thank you.

        But no UI no Creator, all styles are in *.qss file.

        Please see:

        Working properly:
        QTreeView::item:selected { border: 0px; color: blue; background-color: red; }

        Font is not change for selected item only color is...
        QTreeView::item:selected { border: 0px; color: blue; background-color: red; font-size: 13px; font-family: Lato;}

        Regards.

        mrjjM 1 Reply Last reply
        0
        • David.ReznicekD David.Reznicek

          Thank you.

          But no UI no Creator, all styles are in *.qss file.

          Please see:

          Working properly:
          QTreeView::item:selected { border: 0px; color: blue; background-color: red; }

          Font is not change for selected item only color is...
          QTreeView::item:selected { border: 0px; color: blue; background-color: red; font-size: 13px; font-family: Lato;}

          Regards.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @David.Reznicek
          Hi
          Im not sure
          QTreeView::item:selected accept font
          http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtreeview

          1 Reply Last reply
          1
          • David.ReznicekD Offline
            David.ReznicekD Offline
            David.Reznicek
            wrote on last edited by
            #5

            Thank you for you time, I know about this site. I was hoping exists some solution....

            mrjjM 1 Reply Last reply
            1
            • David.ReznicekD David.Reznicek

              Thank you for you time, I know about this site. I was hoping exists some solution....

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @David.Reznicek
              Hi
              Well you can always use a delegate and do the drawing yourself.
              This also seems to work.
              http://stackoverflow.com/questions/13413156/qt-stylesheet-for-a-qtreeview

              1 Reply Last reply
              1
              • David.ReznicekD David.Reznicek

                Hello,

                can anybody help me please? How can I set style for font-family for selected item in QTreeView/QTableView?

                Trying:

                QTreeView::item:selected { font-familly: ....; font-size: ...; }
                QTableView::item:selected { font-familly: ....; font-size: ...; }

                Thanks,
                David.

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #7

                @David.Reznicek
                please use the forum search before posting, this question has been asked multiple times already.
                For example this.

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                1

                • Login

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