Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    qtableview font
    3
    7
    5748
    Loading More Posts
    • 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.Reznicek
      David.Reznicek last edited by

      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-worx 1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • David.Reznicek
          David.Reznicek last edited by 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.

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @David.Reznicek last edited by

            @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 Reply Quote 1
            • David.Reznicek
              David.Reznicek last edited by

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

              mrjj 1 Reply Last reply Reply Quote 1
              • mrjj
                mrjj Lifetime Qt Champion @David.Reznicek last edited by mrjj

                @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 Reply Quote 1
                • raven-worx
                  raven-worx Moderators @David.Reznicek last edited by

                  @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 Reply Quote 1
                  • First post
                    Last post