TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #62 · 4 апр.

Когда разрабатываете свой GUI с помощью PyQt для какого-либо софта бывает необходимо позаимствовать цвета из текущего стиля интерфейса. Например, чтобы правильно раскрасить свои виджеты, подогнав их по цвету. Ведь бывает, что ваш GUI используется в разных софтах. Причём некоторые со светлой темой а другие с тёмной. По умолчанию стили наследуются, но если вы задаёте какую-либо раскраску для части виджета через свой styleSheet, то требуется ссылаться на цвета текущего стиля. Как это сделать? Как получить нужный цвет из палитры имеющегося стиля? Это достаточно просто, нужно использовать класс QPalette и его роли. Например, мне нужно достать цвет текста из одного виджета и применить его в другом как цвет фона (не важно зачем именно так, просто захотелось😊). Получаем палитру виджета и сразу достаём нужный цвет, указав его роль. from PySide2.QtGui import QPalette color = main_window.palette().color(QPalette.Text) теперь можем использовать этот цвет в стилях my_widget.setStyleSheet(f'background-color: {color.name()};') Готово, мы динамически переопределили дефолтный стиль используя текущий стиль окна! На самом деле есть запись покороче, в одну строку и без лишних переменных. Не очень-то по правилам CSS, но Qt это понимает. my_widget.setStyleSheet('background-color: palette(Text);') Этот способ не подходит если вам нужно как-то модифицировать цвет перед применением в своих стилях. В этом случае потребуется первый способ. Зато он прекрасно сработает в файле .qss, то есть не придётся в коде прописывать раскраску отдельных элементов через ссылки на палитру, всё красиво сохранится в отдельном файле .qss! QListView#my_widget::item:selected { background: palette(Midlight); } Про имеющиеся роли можно почитать здесь🌍 #qt#tricks

Hashtags

Резултати

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

Пребарај: #asianfencing

当前筛选 #asianfencing清除筛选
Oʻzbekiston Qilichbozlik Federatsiyasi

@fencinguzbekistan · Post #5499 · 05.12.2025 г., 12:18

⚔️ The Sabre Grand Prix is underway in Orléans! Strong Asian presence from: 🇯🇵 Japan, 🇰🇷 Korea, 🇭🇰 Hong Kong, 🇨🇳 China, 🇺🇿 Uzbekistan, 🇰🇿 Kazakhstan, 🇯🇴 Jordan, 🇮🇷 Iran, 🇰🇼 Kuwait, 🇲🇾 Malaysia, 🇸🇦 Saudi Arabia, 🇸🇬 Singapore, 🇹🇼 Chinese Taipei. 🔥 14 Asian athletes advance to the December 6 main draw. Good luck to all! 📸 Photos by Eva — FIE Team #FIE#FCA#AsianFencing

Oʻzbekiston Qilichbozlik Federatsiyasi

@fencinguzbekistan · Post #6031 · 19.02.2026 г., 15:47

All delegations have arrived… and the real preparation begins ⚔️🔥 Athletes have started their official training sessions at the competition venue, ahead of tomorrow’s Asian Cadet & Junior Fencing Championships, featuring a large participation of Asia’s rising talents 🌏 Sharp focus, strong determination, and exciting energy ahead of the first bout 🏆 Tomorrow… it begins. 🌐www.asian-fencing.com Follow @fencing_fca #AsianFencing#FCA#CadetJunior#RoadToGlory

Oʻzbekiston Qilichbozlik Federatsiyasi

@fencinguzbekistan · Post #5850 · 24.01.2026 г., 10:05

⏳ Just 1 month to go! Asia’s future fencing stars will meet in Jakarta, Indonesia 🇮🇩 for the Asian Cadet & Junior Fencing Championships 2026 🤺 📅 20–27 February 2026 📍 Jakarta The countdown is on. Are you ready? 🔥 🌐www.asian-fencing.com Follow @fencing_fca #AsianFencing #FCA #AsianCadetJunior #Fencing2026 #Jakarta2026

Oʻzbekiston Qilichbozlik Federatsiyasi

@fencinguzbekistan · Post #4897 · 24.10.2025 г., 17:43

🥇🏆 The Moment of Glory! A proud scene from the podium at the Asian Cadet Fencing Championships – Kuala Lumpur 2025 🇲🇾⚔️ From Hong Kong to Kazakhstan and Uzbekistan, fencers shined with skill, passion, and true sportsmanship 💪 Congratulations to the Men’s Foil medalists on an outstanding performance and well-deserved victories! 👏 🥇 HO Shing Him Harris 🇭🇰 🥈 LAM Ho Long 🇭🇰 🥉 NURUMOV Galim 🇰🇿 🥉 MOLINA Ilyas 🇺🇿 #Fencing#AsianFencing#MensFoil#KualaLumpur#FencingAsia#Championships#FencingSpirit

Oʻzbekiston Qilichbozlik Federatsiyasi

@fencinguzbekistan · Post #3876 · 01.05.2025 г., 09:29

🏆 Asian Senior Fencing Championship – Bali 2025 🗡️ This is where legends are forged ✨ Where pleasure 🎉, dignity 🛡️, and the spirit of competition 🔥 collide! The thrill of victory 🥇, the clash of steel ⚔️, and the soul of competition 🏃‍♂️ All in one place — glory carved in blades, legends born in every touch ⚡ #Bali welcomes the elite 🤺 #AsianFencingChampionship 2025 🌏 #FCA#FencingAsia#Bali2025 #FencingPower#BladesOfGlory#Honor#AsianFencing

Oʻzbekiston Qilichbozlik Federatsiyasi

@fencinguzbekistan · Post #4078 · 06.06.2025 г., 18:16

🔟 Only 10 Days to Go! The countdown has begun for Asia’s ultimate fencing spectacle ⚔️🌏 Get ready as the 2025 Asian Senior Fencing Championships land on the breathtaking island of Bali! 🌺🌴 📍 Bali, Indonesia 🇮🇩 📅 June 17–23, 2025 ⏳ Seven days. One stage. Endless glory. ✨ Witness: ⚡ Elite fencers from across Asia battle for supremacy 🔥 Unforgettable showdowns & rivalries reborn 🥇 New legends rising — champions forged in every bout 🎯 Precision. Passion. Power. Every point is everything. 📡 Stay tuned for: 🔴 Live updates 🎞️ Daily highlights 🎥 Behind-the-scenes action 📸 Exclusive content you won’t want to miss! 🚀 The road to greatness starts now — and it leads through Bali. Don’t just watch history… be part of it. 🔽 Follow us & gear up for the fight of the year! #AsianFencing#Bali2025#UnleashTheBlade #CountdownToGlory#FencingAsia#SeniorFencing #ChampionsRise#BladesOfAsia#FIE#TopFencers #Indonesia#FencingElite#RoadToVictory#AFC