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

Резултати

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

Пребарај: #techart

当前筛选 #techart清除筛选
Auto Life

@revheadcrypto · Post #526 · 25.09.2024 г., 11:41

🚗✨Introducing the Techart Monochrome: A 800-HP Tribute to the Porsche 911!🎉 🔧Engine: 3.8L Turbo Flat-Six from the 911 Turbo S, tuned to an astonishing 800 HP and 950 Nm of torque! ⚡️0-100 km/h: Just 2.5 seconds! 🏁Top Speed: A thrilling 350 km/h! 🌬️ The aerodynamic kit generates 4x more downforce than the standard 911, reducing lift by 45% at 140 km/h! 🏆 Only 20 units of this exclusive coupe will be produced! #Techart#Porsche911#Monochrome#Supercar#800HP#CarEnthusiast#LimitedEdition#Auto

Auto Life

@revheadcrypto · Post #391 · 26.08.2024 г., 20:00

🚗✨ Introducing the New Techart Aero Kit I for the Updated Porsche Cayenne! ✨🚗 Get ready to elevate your ride with this stunning aerodynamic body kit that not only enhances the aggressive look of the Cayenne but also improves its aerodynamics! 💨🔥 While the price of the kit is yet to be announced, Techart is already working on even more aggressive versions to take your driving experience to the next level! 🚀💪 #Techart#PorscheCayenne#AeroKitI#CarEnthusiast#LuxuryCars#Aerodynamics#UpgradeYourRide#Auto

Themes

@ThemesM8 · Post #316 · 10.07.2024 г., 23:48

https://t.me/addtheme/CyberGlow_ThemesM8 And finally, after a long time, I made a new theme again. I put a lot of time into this one to ensure that all the colors are correct. I even adjusted the story colors, channel statistics' colors, and more. By the way, as always, it also supports Desktop. Let's begin with a good theme. Enjoy! #Android#Desktop#AndroidTheme#DesktopTheme#Dark#CyberpunkTheme#NeonTheme#TechTheme#DarkTheme#GlowingTheme#DigitalArt#CyberArt#TechArt#TelegramTheme#TelegramThemes#CustomThemes#ThemeDesign#purple#ThemeCreator#DarkMode#TechAesthetics#CyberAesthetics#HackerStyle#FuturisticStyle#NeonLights#GlowInTheDark#DigitalAesthetics#CyberFashion#TechWear#NeonWear#HoodieStyle#LEDLights#TechAccessories#ThemeSupport#DesktopThemes#MobileThemes#CyberpunkArt#NeonVibes#GlowingEyes#FuturisticFashion#CyberGirl#LEDMask#HoodieFashion#NeonPink#NeonPurple#DarkAesthetic#CyberMask#FuturisticLook#TechnoFashion#NeonGlow#GlowingMask#SciFiArt#TechnoAesthetic#CyberBeauty#NightMode#CyberMood#DigitalFashion#CyberTech#NeonAesthetic#LEDGlow#ElectricVibes#TechWearFashion#FuturisticHoodie#NeonDrip#TechBeauty#LEDStyle#DarkFashion#CyberFashionista#GlowingTech#FutureFashion#CyberVibes#NeonDreams#HackerFashion#TechnoChic#NeonLightsFashion 🩷@ThemesM8 🩷 ⭐️ BOOST ⭐️