@daler_xusinov · Post #318 · 28.10.2021 г., 16:25
#uiux Landing page design copy 1x1! Telegram | Blog | Portfolio
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #380 · 21 окт.
Регулярно приходится писать и ревьюить код, где используется PySide2-6. Заметил, что в подавляющем большинстве случаев настройка создаваемых базовых виджетов происходит через методы. Думаю, всем знаком такой способ. Простой пример с кнопкой: button = QPushButton("Click Me") button.setMinimumWidth(300) button.setFlat(True) button.setStyleSheet("font-size: 20pt") button.setToolTip("Super Button") button.clicked.connect(lambda: print("Button clicked")) Но есть и альтернативный способ - настройка через свойства. Это просто ключевые аргументы конструктора класса. Хоть они и не указаны в документации как аргументы, но они есть) Этот код делает тоже самое но с помощью Property button = QPushButton( "Click Me", minimumWidth=300, flat=True, styleSheet="font-size: 20pt", toolTip="Super Button", clicked=lambda: print("Button clicked"), ) Где это может быть полезно ▫️ Это выглядит более аккуратно и коротко, уже повод использовать ▫️ Может использоваться в заполнении лейаута, когда нам не нужно никакое другое взаимодействие с виджетом и поэтому сохранять его в переменную не требуется. Например, лейбл или кнопка. widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) layout.addWidget(QLabel("Button >", alignment=Qt.AlignRight)) layout.addWidget(QPushButton("Click Me", clicked=lambda: print("Button clicked"))) widget.show() Либо так widget = QWidget(minimumWidth=400) layout = QHBoxLayout(widget) for wd in ( QLabel("Button >", alignment=Qt.AlignRight), QPushButton("Click Me", clicked=lambda: ...) ): layout.addWidget(wd) widget.show() ▫️ Можно хранить настройки в каком-то конфиге или генерировать на лету, после чего передавать как kwargs. kwargs = {"text": "Hello " * 30, "wordWrap": True} my_label = QLabel(**kwargs) Как получить полный список доступных свойств? Эта функция распечатает в терминал все свойства виджета и их текущие значения def print_widget_properties(widget): meta_object = widget.metaObject() for i in range(meta_object.propertyCount()): property_ = meta_object.property(i) property_name = property_.name() property_value = property_.read(widget) print(f"{property_name}: {property_value}") #tricks#qt
Пребарај: #uiux
@daler_xusinov · Post #318 · 28.10.2021 г., 16:25
#uiux Landing page design copy 1x1! Telegram | Blog | Portfolio
Hashtags
@Ai_artz · Post #1036 · 22.04.2023 г., 10:50
#from#UIUX A clean website landing page for a financial services firm that offers solutions on investments and insurance, use a gold dominant color and white color scheme --v 5 --ar 9:16 ✅ Miami _Discord @ai_artz🌿
@Ai_artz · Post #935 · 10.04.2023 г., 18:16
#from#UIUX An about me page of an online portfolio for a ui/ux desiger, Landing page, magazine style, urban, modern – ar 4:3 – v 5 ✅yoitsmarco#0012 _Discord Join us for more @ai_artz
@Ai_artz · Post #661 · 19.03.2023 г., 09:11
#from#UIUX Portfolio web site designe ✅ deadrk#8928 _Discord @ai_artz
@Ai_artz · Post #652 · 17.03.2023 г., 07:55
#from#UIUX ✅ Guyp _Twitter @ai_artz
@Ai_artz · Post #198 · 31.01.2023 г., 11:29
#from#UIUX ✅ @ LinusEkenstam _Twitter @ai_artz
@fidostudio · Post #16 · 01.12.2021 г., 15:42
Website for Juru Energy from UK. Juru Energy solution-oriented international consulting and engineering firm focused on the energy sector. #web#uiux Follow us: Telegram · Instagram · Dribbble
@fidostudio · Post #15 · 01.12.2021 г., 15:40
Tezkor is a service for ordering fast delivery of food from restaurants and groceries through mobile applications or a website. #web#uiux Follow us: Telegram · Instagram · Dribbble
@fidostudio · Post #9 · 01.12.2021 г., 13:04
Landing pages for Fermopolis. It is an online platform that allows farmers to raise finance, grow agricultural products and then supply them to consumers or return a percentage of sales. #web#uiux Follow us: Telegram · Instagram · Dribbble
@fidostudio · Post #14 · 01.12.2021 г., 15:39
Tezkor is a service for ordering fast delivery of food from restaurants and groceries through mobile applications or a website. #mobile#uiux Follow us: Telegram · Instagram · Dribbble
@fidostudio · Post #11 · 01.12.2021 г., 13:12
Special vaccination App for Covid 19. This App will help you to plan ahead the time, place and type of vaccination. Check out our new work 🙌 Link in bio. #app#uiux Follow us: Telegram · Instagram · Dribbble
@fidostudio · Post #22 · 01.12.2021 г., 16:00
New Interface for iABS. #web#uiux#3D Follow us: Telegram · Instagram · Dribbble