July 11, 2011

Byron Lai Byron Lai
Lab Rat
14 posts

QTreeView: Emulating Mac’s native look

 

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

utorrent

4 replies

July 11, 2011

Andre Andre
Area 51 Engineer
6031 posts

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

  1. explicitly set the delegate to use QStyledItemDelegate for the tree. If that doesn’t work:
  2. also set a style sheet for QTreeView::item, where you can set the background property to a Qt::LinearGradientPattern with the right colors.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

July 12, 2011

Byron Lai Byron Lai
Lab Rat
14 posts

Thanks Andre
I emulated the look using the following stylesheet

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

July 12, 2011

Volker Volker
Robot Herder
5428 posts

Please have a look at the Mac Main Window Demo [developer.qt.nokia.com] – 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

July 12, 2011

Byron Lai Byron Lai
Lab Rat
14 posts

Thanks Volker! That article is truly helpful!

 
  ‹‹ [SOLVED] Selecting a Tab in Code      Using bash with QProcess ››

You must log in to post a reply. Not a member yet? Register here!