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. QTreeView: Emulating Mac's native look
QtWS25 Last Chance

QTreeView: Emulating Mac's native look

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

    How can I emulate the background of a selected row like the one in the left of uTorrent?

    !http://i.imgur.com/EMxPL.png(utorrent)!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      I am not sure what you are seeing now. What you could try is:

      explicitly set the delegate to use QStyledItemDelegate for the tree. If that doesn't work:

      also set a style sheet for QTreeView::item, where you can set the background property to a Qt::LinearGradientPattern with the right colors.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Byron Lai
        wrote on last edited by
        #3

        Thanks Andre
        I emulated the look using the following stylesheet

        @background-color: rgb(222, 228, 234);
        selection-color: white;
        selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(110, 165, 218), stop: 1 rgb(33, 108, 183))@

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

          Please have a look at the "Mac Main Window Demo":http://developer.qt.nokia.com/doc/qt-4.7/demos-macmainwindow.html - it shows how to create main window applications that has the same appearance as other Mac OS X applications, including customizing the item view, the splitter and a search field and should be exactly what you need

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

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Byron Lai
            wrote on last edited by
            #5

            Thanks Volker! That article is truly helpful!

            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