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

Резултати

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

Пребарај: #gcam

当前筛选 #gcam清除筛选
Libreware

@libreware · Post #1222 · 11.02.2024 г., 23:51

. Google's Pixel / GCam is a great, easy to use, feature rich camera app that competes well with the excellent open source Open Camera. GCam brings things like portrait mode, and easy to use slow-motion. Because of this, there are many developers porting the app to work on as many phones as possible. GCam can increase the performance of your phone's hardware camera, and the ports can also bring the GCam app to DeGoogled phones. GCam Hub is a website dedicated to tracking all the GCam ports. Here is the 👉🏻web page listing many Stable GCam Version: You can work you way through the list until you find one that works on your phone, but then you may try 100 versions and never get one that works. Keep in mind, these ports will not auto update. Note: Shamim's SGCAM version 8.5.300 V5 works on Pixel 3a running Lineage. If you find a version that works on your phone, let everyone know in the comments. ⚡️@LinuxTechIndex #GCam#camera

Hashtags

Oneplus 13 Updates

@OnePlus13Series · Post #369 · 15.01.2026 г., 09:19

LM.CCD config adapted for OnePlus 13 ⬇️ Download Gcam App (pick aweme variant) What's Working : Main, Telephoto, Selfie, UW, Night Sight, Portrait, Videography (4k 60fps + Stabilization) Changelogs : • Based on LM.CCD_v3_Sabre config by LaoMa • Upscaling is enabled by default for Selfie Camera • Removed extra profiles (which i felt useless) • Miscellaneous small tweaks done by me. XML (.agc) Save Directory: /Download/AGC 9.2/configs All credit goes to the original creator of the config. #gcam#xml#agc 👤 Adapted by: @pulkittg 🔔 Updates: @OnePlus13Series 💬 Discussion: @OnePlus13SeriesChatRoom

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #735 · 01.05.2026 г., 18:00

Volcarona - AGC Config | Nothing Phone 2 (Pong) ✍️ Details: - Supports AGC 8.4 & 9.2 - Config can be downloaded from AGC Toolkit or Telegram ⬇️ GCAM: 8.4 | 9.2 ⬇️ Toolkit Link for the Config : ToolKit 📮 Original Post: Here 📝 Changelogs: * Initial Release for pong ⚙️ Installation 8.4 1. Copy the config inside Download/AGC.8.4/configs (create folder if it doesn't exist) 2. Open GCam then swipe down to open the top menu 3. Click on "Load Configs" > select the config > load 9.2 1. Copy the config inside Download/AGC.9.2/configs (create folder if it doesn't exist) 2. Open GCam then click on the profile icon on the app right 3. Click on "Load Configs" > select the config > load ⚠️ Notes - Use lite configs if the profiles list does not load all the profiles in regular version 👨‍💻 Adapted by: @Abdulhubbali 🌐 Discussion: @NothingPhone2Photography 🔖 Tags: #agc#gcam#config