Установить свойства виджета в 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
Stop Trusting #Messaging Apps! Build Your Own Global #Meshtastic#MQTT Network - Explained Simply
Most messaging apps promise privacy, but very few let you control the infrastructure behind your conversations.
https://rumble.com/v75rxrg
#im#mesh#p2p
There's a newcomer to the Mesh world
In this video we introduce #Meshcore, a powerful open-source, text-based encrypted mesh-radio system built on #LoRa hardware—perfect for off-grid communications on your homestead or preparedness setup. #Meshtastic fans will find Meshcore instantly familiar — a low-cost, open-source way to stay connected when the internet and cell service aren’t available. But Meshcore takes a few different paths, and we’ll break it down in plain English.
https://www.youtube.com/watch?v=iaFltojJrAc
Edit: not fully foss ⚠️
MeshCore is not entirely open source, which seems odd for an off-grid decentralized communications framework. Some parts are open, but the official clients (the mobile apps, web app, and T-Deck firmware) are not
https://hackaday.com/2025/12/06/lessons-learned-after-trying-meshcore-for-off-grid-text-messaging/
#mesh#p2p#im
Unboxing Elecrow ThinkNode M1 & M2 | #Meshtastic Setup, Field Test, Review & Off-Grid Comms Breakdown
https://rumble.com/v6v1uk1
In this video, I take you deep into the world of off-grid communication as I unbox and test two brand-new devices from Elecrow: the ThinkNode M1 and ThinkNode M2. These tools come pre-installed with Meshtastic firmware and are built for encrypted, decentralized communication — no SIM card, no Wi-Fi, and no cell towers required. Whether you’re prepping for a blackout, building a resilient mesh network, or just exploring survival tech, this video is packed with everything you need to know.
We start with a full unboxing of both devices, breaking down what makes each unique. The ThinkNode M1 is powered by the nRF52840 chip and includes a GPS module for location tracking, a 1.54” sunlight-readable EPD screen, and a 1200mAh battery built to last over 48 hours. It’s rugged, outdoor-ready, and ideal for emergency kits or remote travel. In contrast, the ThinkNode M2 is lighter, smaller, and powered by the ESP32-S3 chip. It includes a 1.3” OLED display, Bluetooth support, a 1000mAh battery, and is better suited for modular integration or stealthy builds.
After the unboxing, I walk you through a step-by-step setup of each device using the Meshtastic mobile app. I show you how to configure them, pair with Bluetooth, and get your private mesh network up and running in minutes. From there, I run live tests to see how each device performs in real-world conditions and compare their features, form factor, and best use cases.
If you’re interested in off-grid privacy tools, these are two of the most beginner-friendly and capable devices out there right now. I also include a breakdown of which device might be better depending on your needs—whether you’re building a neighborhood mesh or planning for emergency scenarios.
Make sure to check out the official product pages using the links below. These links track monthly performance, so I appreciate your support if you use them:
👉 ThinkNode M1:
https://www.elecrow.com/thinknode-m1-meshtastic-lora-signal-transceiver-powered-by-nrf52840-with-154-screen-support-gps.html?idd=5
👉 ThinkNode M2:
https://www.elecrow.com/thinknode-m2-meshtastic-lora-signal-transceiver-powered-by-esp32-s3-with-1-3-oled-display.html?idd=5
Elecrow is also running a giveaway where you can win LoRa modules or get PCB assembly sponsorship. Don’t miss this opportunity to level up your off-grid gear for free:
https://www.elecrow.com/blog/lora-modules-giveaway-and-pcb-assembly-sponsorship.html?idd=5
These tools are more than tech — they represent freedom. In a world where networks can go dark and censorship can silence, devices like these keep people connected, informed, and in control. With Meshtastic and LoRa, you are the signal. You are the network. And it’s all open source.
If you found this helpful, drop a comment, like the video, and subscribe for more content on off-grid tech, cybersecurity gadgets, and digital autonomy. Let me know which one you’d trust in your blackout bag — the rugged M1 or the sleek, portable M2.
⸻
📡 Hashtags:
#LoRa#Meshtastic#ThinkNodeM1#ThinkNodeM2#Elecrow#OffGridCommunication#EmergencyComms#GridDown#PreppingGear#TechUnboxing#ESP32#nRF52840#SurvivalTech#MeshNetworking#DecentralizedComms#EncryptedMessaging#HamRadioAlternative#LongRangeRadio#DigitalFreedom#TacticalTech#CyberSecurity#LoRaWAN#MeshRadio#HackerTools#BlackoutReady#BugOutBag#PrivacyTech#RadioComms#DisasterPreparedness#MeshtasticSetup#FreedomThroughTech