В фреймворке 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
#HawkerHeritage📢 Originally the Seng Poh Road Market in 1951, Tiong Bahru Market served as a bustling centre for the community. Next time you’re there for a meal, don’t forget to soak up the history & nostalgia!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage Fancy A Feast in a Garden 🌴? Since 1971, Newton Food Centre hawker has been serving up Singapore’s culinary diversity with its unique 'garden city' charm. Forward this post to someone who’ll appreciate this picturesque setting!
#OurHawkerCulture#OurHawkerCentres#HawkerHeritage
#HawkerHeritage📜 Tekka Centre: Let’s time-travel back to 1915, where 'Kandang Kerbau' and ‘Tekka’ tell tales of cattle and wild bamboo. What a journey for the senses!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage🌟 People’s Park Food Centre: A Culinary Heritage Site 🌟 Starting as a hawker shelter in 1923 and evolving into the largest market by 1940, it's a place where history and cuisine meet. Share this with someone that you’ll like to explore this iconic food haven with!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage🍲✨ Experience a rich blend of history and culinary excellence at Singapore's largest hawker centre: Chinatown Complex Market! Established in 1981 for the last of Chinatown’s street hawkers, it's now a vibrant gastronomic haven with around 700 stalls. Share this with your favourite foodies!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage Changi Village Hawker Centre: From a military past to a seaside food haunt 🌴#DidYouKnow This dining spot was part of Changi's transformation into a resort? An idyllic memory to savour with your favourite hawker delights!
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage Architectural elegance meets culinary delight at Old Airport Road Food Centre 🍴🏛️#DidYouKnow that its modern structure was designed in '73 to match the housing estates in the area?
#OurHawkerCulture#OurHawkerCentres
#HawkerHeritage#DidYouKnow Adam Road Food Centre is nine-sided and almost circular? This popular spot is famous for its nasi lemak and a variety of delightful treats! This is your sign to organise that makan trip🍴
#OurHawkerCulture#OurHawkerCentres
❤️#HawkerHeritage❤️#DidYouKnow that Maxwell Food Centre was once a wet market? It was also one of the places where the poor and displaced could find cheap meals after WWII. Today, it’s a treasure trove of local delights!
#OurHawkerCulture#OurHawkerCentres