@Ptfxq · Post #167 · 05.04.2021 г., 03:57
#KG 对满足条件的用户发放1个邀请。 原文:https://telegra.ph/Invites-for-long-term-seeders-04-05
Hashtags
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
Пребарај: #kg
@Ptfxq · Post #167 · 05.04.2021 г., 03:57
#KG 对满足条件的用户发放1个邀请。 原文:https://telegra.ph/Invites-for-long-term-seeders-04-05
Hashtags
@Ptfxq · Post #554 · 26.01.2024 г., 22:08
#KG#站免 KG Sitewide freeleech active! Ends in 8d 22h 53m
@Ptfxq · Post #258 · 28.01.2022 г., 04:39
#KG#站免 KG 现已开启站免,直至 2022.02.06 18:00(农历正月初六),感谢群友提供消息!
@Ptfxq · Post #62 · 29.01.2021 г., 14:21
#KG#站免 update:已结束。
@Ptfxq · Post #694 · 02.08.2024 г., 05:41
#KG#PTP PTP在KG开设官窑 要求如下 Members of Karagarga that have an unwarned account that is older than two years, and fulfill at least one of the below requirements, are eligible to request an invite. ▪ At least 50 uploads (25 of which must be movies) ▪ At least 10 completed subtitle pots ▪ VIP or staff tldr: 满足要求你肯定已经进了,没进你也不满足要求,也大概率满足不了要求 感谢群友投稿
@Ptfxq · Post #490 · 28.11.2023 г., 08:59
#KaraGarga#KG KG History & Memory subforum We have gathered together KG history related forum posts in a new subforum for your convenience. Pay it a visit and learn more about our past.
Hashtags
@Ptfxq · Post #375 · 14.10.2022 г., 22:00
#karagarga#KG The Pot The pot system has been functioning well for more than a decade now, big thanks to all subtitlers and pledgers. Please check if you have claimed any pots. Go to your profile, and after Pot Pledges click on (claimed pots). If you are working on a pot, leave a comment there about progress, and update that post at least every 3 months. If not, cancel your claim. A dormant claim can discourage a potential subtitler. Also, please keep an eye from time to time on pots you started or pledged to (see Pot Pledges in your profile). If good subtitles appeared in the meantime, report that pot with a link to the subs. If you want to subtitle a film for which the pot has been claimed long ago without any news, please contact one of us (corvusalbus, flipflink, cyzs, musiclova). Happy subtitling and viewing!
Hashtags
@aadaili · Post #14628 · 23.04.2026 г., 13:21
#KG#cfm#范围 2026-04-22 21:46:46 游戏:穿越火线枪战王者 KG公益裸奔范围 无任何卡密验证 使用root设备 给777权限 大厅界面执行
@Ptfxq · Post #976 · 07.02.2026 г., 03:43
#KaraGarga#KG#站点免费 站免 9 天 同时 BHD 在 KG 开设了官方邀请,要求为账号年龄两年、pu 等级和有一个发种。
Hashtags
@Ptfxq · Post #847 · 31.01.2025 г., 19:29
#karagarga#KG#站点免费 Sitewide freeleech active! Ends in 8d 20h
Hashtags
@Ptfxq · Post #501 · 11.12.2023 г., 09:00
#Karagarga#KG#站点活动 Take part in Karagarga's Top 100 Movie Poll We are collecting Top 10 lists from our members until midnight (UTC) on 24 December 2023. A KG Top 100 list based on these votes will be revealed on Christmas Day.
Hashtags
@Ptfxq · Post #692 · 01.08.2024 г., 11:30
#karagarga#KG#捐赠 希望给站点捐赠的用户可以联系站内公告提到的管理了。 注:没有捐入,没有额外福利,只是为了站点的存续而筹备今年的资金。
Hashtags