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. [Solved] Styling QTableView items
Forum Updated to NodeBB v4.3 + New Features

[Solved] Styling QTableView items

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.4k 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #1

    Hi everybody,
    I have a problem styling the border of the selected item in a QTableView.
    Although I set the selection mode to no selection the border of the currently selected item is still drawn and I'd like it removed.
    Here is a screenshot of the problem:
    !http://i278.photobucket.com/albums/kk113/V-Ronin/Test_zps010fec55.png(Screenshot of the problem)!
    the table stylesheet is:
    @
    "background-color: rgba(255,0,0,255);"
    "border: none;"
    @

    I tried using ::item but with no results.
    Thanks in advance for the help
    Luca

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Try to remove the border by disabling the focus using method "setFocusPolicy":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#focusPolicy-prop and argument Qt::NoFocus.

      http://anavi.org/

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        It worked fine for me but, just for curiosity, is there a way to do the same thing via stylesheet?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          I haven't tried, but due to beeing a QObject-property you might be able to style it using <code>qproperty-focusPolicy: "Qt::NoFocus"</code>.

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            I meant removing the border, not disabling the focus :D

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            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