В фреймворке 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
¿Que puede hacer este bot?
@ButtonMakerXBot
Envíe un medio o un mensaje de texto y agregue botones de acuerdo con su deseo y compártalo en todo TG
Idioma inglés
(Visto en @botsgram_cu)
#botones
Debido a que las reacciones de Telegram llegarán en la próxima actualización, puede optar por 2 métodos de reacciones: reacciones nativas de Telegram o bots de #botones de reacción.
(Visto en @BotsGram_cu)
¿Que puede hacer este bot?
@SuperEmojiBot
Agregue automáticamente botones de reacción y compartir a las publicaciones en su canal.
Idiomas: ruso, inglés, uzbeko
(Visto en @botsgram_cu)
#botones#canales
¿Que puede hacer este bot?
@RemoveInlineButtonsBot
Este bot eliminará cualquier mensaje que contenga botones en línea en grupos o canales
Idiomas: inglés árabe
(Visto en @botsgram_cu)
#botones#inlinebuttons
@ChannelButtonsBot
Qué puede hacer este bot?
Este bot puede crear botones para reacciones, comentarios, enlaces y más en su canal de Telegram.
Idioma: Inglés
(visto en @BotsGram_cu)
#canal, #botones, #reacciones
¿Que puede hacer este bot?
@ReactBot
Con éste bot puedes agregar botones de comentarios a las publicaciones de su canal
Idiomas: inglés
(visto en @botsgram_cu)
#canales#botones#comentarios#administrador