В фреймворке 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
Internet History Fact!📜
Did you know? The iconic "It is Wednesday, my dudes" Budgett's frog meme first appeared on Tumblr on December 10, 2014. That grumpy frog still sums up the midweek vibe!
Fun rule: Frog memes are allowed in the comments, but only here on THIS post! 🐸💬
@googlefactss
[Source🐸]
#MemeHistory#WednesdayMyDudes#InternetLore#FrogFacts
Internet History Fact! 📜
The iconic "It is Wednesday, my dudes" Budgett's frog meme debuted on Tumblr on December 10, 2014.
Celebrating its birthday with frog and Wednesday memes allowed here for the next 24 hours! 🐸🎉
[Source🐸]
@googlefactss
#MemeHistory#WednesdayMyDudes#InternetLore#FrogFacts#ExtraMemeDay
The Titicaca water frog (Telmatobius culeus) can absorb oxygen through its skin, an adaptation that helps it survive in the high-altitude waters of Lake Titicaca, where oxygen levels are low. This unique ability allows it to thrive in an environment where most other species struggle. The frog's skin is highly vascularized, increasing its efficiency at absorbing oxygen directly from the water.
💧🐸⛰️
[Read more]
(Frog memes allowed here)
@googlefactss
#FrogFacts#TiticacaFrog#TelmatobiusCuleus#NatureScience#UniqueAdaptations#Amphibians#ItsWednesdayMyDudes
If you have ideas or feedback contact us:
@Googlefactss_Feedback_bot