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

Резултати

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

Пребарај: #oneplus13

当前筛选 #oneplus13清除筛选
Oneplus 13 Updates

@OnePlus13Series · Post #40 · 04.11.2024 г., 16:01

The free split screen of OnePlus 13 combined with the Snapdragon 8 Elite is simply too powerful. It can run three games smoothly at the same time, triple the fun #OnePlus13

Hashtags

Oneplus 13 Updates

@OnePlus13Series · Post #144 · 14.02.2025 г., 08:54

#ColorOS15#OnePlus13 fkcoloros Isp Module v1.1.0 Features: • Improved custom ClipboardScene Fluid Cloud, adding default support for v2ex, Kujiale, HomeAssistant, Pixiv, eHentai, QooApp, Apple Music, TapTap, YouTube, Zhihu, GitHub, Steam, SMZDM, Dianping, Ctrip. • Enhanced Fluid Cloud replacement rules and added default support for bili2PiliPalaX. • Improved custom sidebar tools. • Removed Ul support for foldable phones and tablets. • Forced apps to portrait mode only. • Optimized some feature descriptions. • Removed BL skip detection. • Recent tasks menu now shows a toast notification if the corresponding activity cannot be found. • LibChecker-dependent feature: Recent tasks menu will only show if LibChecker is installed. • Removed unnecessary logs. • Updated Compose dependencies.  By August Join @OnePlus13Series Chat @OnePlus13SeriesChatRoom

Oneplus 13 Updates

@OnePlus13Series · Post #341 · 13.11.2025 г., 15:50

OnePlus 13 Specifications Codename: dodge cc: TechleaksZone • 6.82" (3168×1440 px) 2K+ BOE X2 LTPO AMOLED display • 1-120Hz variable refresh rate • 4500nits peak brightness • 2160Hz PWM Dimming • Dolby Vision; 1.07 billion colors • Crystal Shield glass protection • Snapdragon 8 Elite SoC • LPDDR5X RAM; UFS 4.0 storage • 9925mm² VC chamber • 50MP main (LYT-T 808, OIS) • 50MP Ultrawide (JN5); 2.5cm macro • 50MP 3X Telephoto (LYT-600; OIS) • 120X Digital Zoom; Hassleblad camera • 32MP Front camera • AAC CSA+ 0916 X-axis linear motor (volume 602mm³) • Goodix Ultrasonic fingerprint • IR Blaster; Alert Slider • Dust & water resistant (IP68 + IP69) • Stereo speakers, OReality & OHaptics • 6000mAh battery; USB-C 3.2 Gen 1 • 100W wired (Max 6.0A at 10V) + 50W wireless charging (Upto 18W PD - IN variant) •4 AndroidOS upgrades + 6yrs Security Patches. (Android 15 OOB) •Lifetime Display Warranty for greenline concerns (For India) @OnePlus13Series | @OnePlus13SeriesChatRoom #oneplus13#specs#oxygenos

Oneplus 13 Updates

@OnePlus13Series · Post #289 · 13.07.2025 г., 00:38

📱SunOS-Project - Official | Android 15 | OnePlus 13 (dodge) 🗒Details: • Version: #varuna (A15) • Codename: #dodge • Released: 09/07/25 🆘Support: Telegram 📸Screenshots: Click Here 💵Donate: Paypal | UPI: dyavanapellichandu@ybl (If you like our work and want to support development, it helps pay server bills and infrastructure) 🔖Tags: #ROM#SunOS#Android15#Official#OnePlus13#dodge ✨SourceChangelogs: • Initial A15 Release based on CPH2653_15.0.0.831(EX01) firmware blobs ✅Working: • Camera & Flashlight • WiFi, Bluetooth • Telephony (Calls & Data) • IMS (VoLTE, VoWiFi, RCS) • Audio (Playback & Record) • Video Playback • GPS, Sensors • WiFi Display ❌Broken: • eSIM (WIP) 📦Compatibility: • All variants supported: EU / IN / CN / NA 📔Note: Make sure both slots have the same firmware to avoid critical issues! 🧩FlashInstructions: ⚠️ Ensure both slots have the same firmware before flashing! • Download images from here. fastboot flash init_boot init_boot.img fastboot flash boot boot.img fastboot flash recovery recovery.img fastboot flash vendor_boot vendor_boot.img fastboot -w fastboot reboot recovery ➡️Inrecovery: • Factory reset (wipe/format data) • ADB sideload the SunOS zip • Reboot and enjoy 🌞 📥Download: 🔗Sourceforge | Mirror