В фреймворке 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
🎩Agent 301 Puzzle | Sept 6
🧩Cards in Order:11:10:7:13
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Sept 4
🧩Cards in Order:13:16:8:1
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Sept 2
🧩Cards in Order:5:9:13:1
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Sept 1
🧩Cards in Order:15:4:12:13
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 31
🧩Cards in Order:8:13:1:4
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 30
🧩Cards in Order:6:11:5:10
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 29
🧩Cards in Order:5:14:10:12
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 27
🧩Cards in Order:2:3:10:5
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 26
🧩Cards in Order:12:6:5:13
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 24
🧩Cards in Order:5:15:11:4
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 23
🧩Cards in Order:3:5:2:12
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 21
🧩Cards in Order:8:16:13:4
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle