August 18, 2010

spsingh spsingh
Lab Rat
27 posts

Center align the icon in QAbstractItemView using stylesheets

 

I have a custom model for a table view. My data function returns a QImage for the decoration role. But this image is not center aligned (horizontally and vertically). I tried using the following style sheet. But the image is still not centered. Please help.

QAbstractItemView::icon { border: 1px solid black;
}

QAbstractItemView { subcontrol-position: center center;
}

2 replies

August 18, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Try to use QAbstractItemView::item

August 20, 2010

spsingh spsingh
Lab Rat
27 posts

I tried using it in the following ways but these did not work as well.

QAbstractItemView::item {
subcontrol-position: center center;
}

And

QAbstractItemView::item::icon {
subcontrol-position: center center;
}

 
  ‹‹ How to detect a specific running application/service from within my QtGui-based app?      "Host not found" using QtSoap ››

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