I'm trying to change the selection behaviour in a QTreeView using a stylesheet. The show-decoration-selected property seems to have no effect.
I'm calling the following in my QMainWindow:
setStyleSheet(
"QTreeView {"
" selection-background-color: navy;"
" alternate-color: white;"
" alternate-background-color: rgb(240,240,240);"
" show-decoration-selected: 1;"
"}"
);
setStyleSheet(
"QTreeView {"
" selection-background-color: navy;"
" alternate-color: white;"
" alternate-background-color: rgb(240,240,240);"
" show-decoration-selected: 1;"
"}"
);
To copy to clipboard, switch view to plain text mode
The alternate-background-color property does have an effect, so I know that the QTreeView is using the stylesheet. But switching show-decoration-selected from 0 to 1 has no effect at all. How should the show-decoration-selected property affect a QTreeView?
I would like to have the entire row selected from the extreme left of the QTreeView to the extreme right of the QTreeView regardless of the level/depth of the item in the QTreeView. And I would like the selection-background-color to be navy and selection-color to be white.
I have had this styling working for a QTableView. Any reason why it shouldn't be possible for a QTreeView?
I'm on Windows 7 using C++ Qt 4.6.2 in Visual Studio 2008.
Bookmarks