В фреймворке PyQt (и PySide тоже) часто встречается настройка чего-либо с помощью так называемых флагов.
widget.setWindowFlags(Qt.Window)
Взаимодействие нескольких флагов делается с помощью бинарных (или побитовых) операторов.
Несколько флагов можно указать с помощью оператора "|"
list_item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
исключить флаг из уже имеющегося набора можно так
list_item.setFlags(list_item.flags() ^ Qt.ItemIsEnabled)
Добавить новый флаг к имеющимся можно так
list_item.setFlags(list_item.flags() | Qt.ItemIsEnabled)
А проверка наличия делается так
is_enabled = item.flags() & Qt.ItemIsEnabled > 0
Почему именно так? Всё дело в том как именно работают побитовые операторы. Но об этом в следующем посте.
#qt
🔥#Coinbase secretly submitted documents to the #CFTC for listing of futures regulated in the USA for #Dogecoin, #Litecoin and #BitcoinCash
It's already April 1st!! 🚀
The first step towards launching futures ETFs for these altcoins
📌 CFTC approval is not required for listing commodity futures for $LTC, $DOGE and $BCH — as the "self-certification" method is used (paragraph 40.2A)
📰#iXDailyBrief
STAT
⚡️ Think consumers are apathetic to data misuse? Think again. 56% of people say they would stop buying from a business that mishandles their data, and 79% of people say they would tell friends and family to boycott an organisation based on data misuse (Source: Veritas)
INSIGHT
📱 A majority of Americans use #Facebook and #YouTube, but young adults are especially heavy users of #Snapchat and #Instagram: prs.pctvix.co/2KPK3Is
OTHER NEWS
💵#Revolut adds #Ripple and #BitcoinCash support: prs.pctvix.co/2GLXDKr
🐦#Twitter looks to woo smaller, Facebook-frustrated publishers with new site: prs.pctvix.co/2KRewFY
😂 Federal judge rules that #Trump can't block Twitter users: t.me/iXNews/25922
🚙#Apple reportedly partnering with Volkswagen to make self-driving employee shuttles: t.me/iXNews/25952
—
Do you have a #Telegram channel? Check this out: prs.pctvix.co/2kkLaVq
Have a great Thursday!
Ben, @iXNews