TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #381 · 23 окт.

Установить свойства виджета в PySide можно не только через соответствующие методы и конструктор класса. Можно их изменять с помощью метода setProperty по имени. btn = QPushButton("Click Me") btn.setProperty("flat", True) Это аналогично вызову btn.setFlat(True) Если указать несуществующее свойство, то оно просто создается btn.setProperty("btnType", "super") Получить его значение можно методом .property(name) btn_type = btn.property("btnType") Когда это может быть полезно? ▫️Можно просто хранить какие то данные в виджете и потом их доставать обратно widget = QWidget() widget.setProperty('my_data', 123) print(widget.property('my_data')) ▫️ Назначая эти свойства разным виджетам можно потом отличить виджеты во время итераци по ним. Например, найти все кнопки со свойством my_data="superbtn". Но ведь вместо кастомного свойства можно использовать objectName, будет тот же результат. Да, но y ObjectName есть ограничение - только строки. ▫️ Если нам потребуется не просто поиск а, например, сортировка по числу, то свойства позволяют нам это сделать. Поддерживается любой тип данных widget.setProperty('my_data', {'Key': 'value'}) widget.setProperty('order', 1) all_widgets.sort(key=w: w.property('order')) Но ведь Python позволяет всё вышеперечисленное сделать простым созданием атрибута у объекта widget.order = 1 widget.my_data = 123 Да, но я думаю что не надо объяснять почему не стоит так делать. К тому же, если у виджета нет свойства то метод .property(name) вернет None, а отсутствующий атрибут выбросит исключение. ▫️ Действительно полезное применение кастомным свойствам - контроль стилей. Здесь атрибутами не обойтись, нужны именно свойства. Дело в том, что в селекторах стилей можно указывать конкретные свойства виджетов на которые следует назначать стиль. Просто запустите этот код from PySide2.QtWidgets import * if __name__ == "__main__": app = QApplication([]) widget = QWidget(minimumWidth=300) layout = QVBoxLayout(widget) btn1 = QPushButton("Action 1") btn2 = QPushButton("Action 2") btn3 = QPushButton("Action 3", flat=True) layout.addWidget(btn1) layout.addWidget(btn2) layout.addWidget(btn3) # добавим кастомное свойство одной кнопке btn1.setProperty("btnType", "super") # добавляем стили widget.setStyleSheet( """ QPushButton[btnType="super"] { background-color: yellow; color: red; } QPushButton[flat="true"] { color: yellow; } """ ) widget.show() app.exec_() С помощью селектора мы избирательно назначили стили на конкретные кнопки. Как получить список всех кастомный свойств? Функция получения списка кастомных свойств отличается от получения дефолтных. def print_widget_dyn_properties(widget): for prop_name in widget.dynamicPropertyNames(): property_name = prop_name.data().decode() property_value = widget.property(property_name) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

Пронајдени 10 слични објави

Пребарај: #risingos

当前筛选 #risingos清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #488 · 15.12.2024 г., 12:52

RisingOS - Community | A15| Nothing Phone 2 (Pong) 📝 Details: - Version: v6.0 - Device: #Pong - Released: 15/12/24 ⬇️ Download (Recovery): Vanilla | Gapps 📖 Changelogs: Source 📔 Instructions: Here 🖼 Screenshot : Here 🆘 Support: Device 🏷 Tags: #AOSP#ROM#RisingOS#V ✍️ Note: • Initial Android 15 release • Added DeviceExtra • Lawnchair not working • Base firmware 2.6.0 is recommended • Dolby Atmos available • Meteoric kernel ksu prepatched 🏆 Credits: - Chandu Dyavanapelli for DT base - Fabian and Hellboy for Glyph Implementation - Hellboy for Kernel - Ghost for help and dolby - Pedro for donation - All the testers 👤 Maintainer: @samrth012 🔔 Updates: @NothingPhone2Updates 🐙 Chat: @NothingPhone2

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #157 · 19.09.2024 г., 03:31

¡New build available! #A14#RisingOS Xiaomi 12T Pro / Redmi K50 Ultra (diting) Maintainer:@TeamMEX_XDA (Kισżż) Version:5.2.1-Lyonesse Download | Changelogs | Screenshots Device Changelog: ◦ Enable Updater app ◦ Enable Lawnchair and Pixel launcher ◦ fix ims crash (?) ◦ improve system performance ◦ more bugfixes ◦ Enable visual eq on dolby '#risinginyourarea' '#UDC' If you like my work and want to support it please consider making a donation this helps with server costs. Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #147 · 01.09.2024 г., 02:37

¡New build available! #A14#RisingOS Xiaomi 12T Pro / Redmi K50 Ultra (diting) Maintainer:@TeamMEX_XDA (Kισżż) Version:5.1-Lyonesse Download | Changelogs | Screenshots Device Changelog: ◦ Sync with last rising 5.1 source ◦ Update Yuki kernel '#risinginyourarea' '#UDC' If you like my work and want to support it please consider making a donation this helps with server costs. Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #142 · 24.08.2024 г., 18:39

¡New build available! #A14#RisingOS Xiaomi 12T Pro / Redmi K50 Ultra (diting) Maintainer:@TeamMEX_XDA (Kισżż) Version:5.0-Lyonesse Download | Changelogs | Screenshots Device Changelog: ◦ Fix some sensor issues ◦ Last source from rising ◦ update spoof from settings to pass strong '#risinginyourarea' '#UDC' If you like my work and want to support it please consider making a donation this helps with server costs. Donate PayPal

Xiaomi 12T Pro | K50U | Updates

@xiaomi_12tpro_updates · Post #134 · 16.08.2024 г., 04:56

¡New build available! #A14#RisingOS Xiaomi 12T Pro / Redmi K50 Ultra (diting) Maintainer:@TeamMEX_XDA (Kισżż) Version:5.0-Lyonesse Download | Changelogs | Screenshots Device Changelog: ◦ Enable Updater app ◦ Enable Lawnchair and Pixel launcher ◦ fix ims crash (?) ◦ improve system performance ◦ more bugfixes ◦ Enable visual eq on dolby '#risinginyourarea' '#UDC' If you like my work and want to support it please consider making a donation this helps with server costs. Donate PayPal Follow@xiaomi_12tpro_updates Join@xiaomi12tpro_chat

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #561 · 12.02.2025 г., 19:40

RisingOS Revived - Official | A15| Nothing Phone 2 (Pong) 📝 Details: - Version: v6.2.1 - Device: #Pong - Released: 12/2/25 ⬇️ Download: VANILLA | GAPPS 📖 Changelogs: Source | Device 📔 Instructions: Here 🖼 Screenshot : Here 🆘 Support: Device | Source 🏷 Tags: #AOSP#ROM#RisingOS#RisingOS_Revived#V ✍️ Note: • Initial official release • Feb Security Patch 🏆 Credits: - Chandu Dyavanapelli for DT base - Hellboy for Kernel - Ghost for help and dolby - Pedro for donation - All the testers 👤 Maintainer: @samrth012 🔔 Updates: @NothingPhone2Updates 🐙 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #405 · 22.08.2024 г., 14:48

RisingOS - Community | A14 | Nothing Phone (2) 📔 Details: - Version: 5.0 (Lyonesse) - Codename: #Pong - Released: 22/08/2024 🔽 Download (Recovery) : Vanilla | Gapps ⚙️ Installation: Here 📸 Screenshots: Here 🔄 Source Changelog: Here 🆘 Support: Telegram 🔖 Tags : #ROM#AOSP#Community#RisingOS#QPR3#U#NothingPhone2 ✍️ Note: - Lawnchair included in both builds - Padding Can be adjusted from Settings - Kernel is prepatched with KSU - Dolby Atmos Included - Clean flashing is mandatory (v4.0 users can dirty flash) ‼️ Known Bugs: - (You tell.. I fix.. 🤝) 🏆 Credits - Chandu for base device tree - Hellboy for Dolby & Kernel - Fabian for PA Glyph Implementation - Testing team 😎 Maintainer: @samrth012 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #378 · 02.08.2024 г., 14:39

RisingOS - Community | A14 | Nothing Phone (2) 📔 Details: - Version: 4.2 (Kailash) - Codename: #Pong - Released: 02/08/2024 🔽 Download (Recovery) : Vanilla | Gapps ⚙️ Installation: Here 📸 Screenshots: Here | Here 🔄 Source Changelog: Here 💵 Donate: Paypal | UPI: samrth012@okaxis 🆘 Support: Telegram 🔖 Tags : #ROM#AOSP#Community#RisingOS#QPR3#U#NothingPhone2 ✍️ Note: - Rebased trees - Padding Can be adjusted from Settings - Use this pif.json in settings for passing play integrity - Kernel is prepatched with KSU - Dolby Atmos Included - Unlimited Google Photos Spoof Available.. - Clean flashing is mandatory (v4.0 users can dirty flash) ‼️ Known Bugs: - (You tell.. I fix.. 🤝) 🏆 Credits - Chandu for base device tree & Kernel - AgbKartik for help - Hellboy for Dolby - Fabian for PA Glyph Implementation - Testing team 😎 Maintainer: @samrth012 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #372 · 28.07.2024 г., 20:50

RisingOS - Community | A14 | Nothing Phone (2) 📔 Details: - Version: 4.1 (Kailash) - Codename: #Pong - Released: 29/07/2024 🔽 Download (Recovery) : Vanilla | Gapps ⚙️ Installation: Here 📸 Screenshots: Here | Here | Here 🔄 Source Changelog: Here 🆘 Support: Telegram 🔖 Tags : #ROM#AOSP#Community#RisingOS#QPR3#U#NothingPhone2 ✍️ Note: - Padding Can be adjusted from Settings - BCR Included - Kernel is prepatched with KSU (Download Manager) - Dolby Atmos Included - Unlimited Google Photos Spoof Available.. - Clean flashing is mandatory (v4.0 users can dirty flash) - NO OTA's ‼️ Known Bugs: - None (You tell.. I fix.. 🤝) 🏆 Credits - Chandu for base device tree & Kernel - OC'D, Miki, Unluck & Ghost for all help - Hellboy for Dolby - Fabian for PA Glyph Implementation - EverRising for Testing 😎 Maintainer: @samrth012 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #366 · 25.07.2024 г., 05:53

RisingOS - Community | A14 | Nothing Phone (2) 📔 Details: - Version: 4.0 (Kailash) - Codename: #Pong - Released: 23/07/2024 🔽 Download (Recovery) : Vanilla | Gapps ⚙️ Installation: Here 📸 Screenshots: Here 🆘 Support: Telegram 🔖 Tags : #ROM#AOSP#Community#RisingOS#QPR3#U#NothingPhone2 ✍️ Note: - Padding Can be adjusted from Settings - BCR Included - Kernel is prepatched with KSU (Download Manager) - Dolby Atmos Included - Unlimited Google Photos Spoof Available.. - Clean flashing is mandatory - Sam is Working on OTA.. Might Get OTA Updates with Next Release.. ‼️ Known Bugs: - None (You tell.. I fix.. 🤝) 🏆 Credits - Chandu for base device tree & Kernel - OC'D, Miki, Unluck & Ghost for all help - Hellboy for Dolby - Fabian for PA Glyph Implementation - EverRising for Testing 😎 Maintainers: @samrth012 🔔 Updates: @NothingPhone2Updates 💬 Chat: @NothingPhone2