'Qt stylesheets: enable margin for tree/list view only if vertical scrollbar shown

I need to show right margin for a tree/list views to the right of a vertical scroll bar. How can this be done via Qt stylesheets? I want something following:

MyNamespace--MyWidget QAbstractItemView[verticalScrollBarEnabled=true]
{
  margin-right: 1px;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source