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

Резултати

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

Пребарај: #gemifaucet

当前筛选 #gemifaucet清除筛选
Gemi Faucet News

@gemifaucet · Post #1577 · 05.05.2026 г., 06:06

🎯Big Opportunity: Turn 2 TON into 100 TON!💰 Get ready to test your luck with our latest Lottery Draw on Gemifaucet! 🎟Ticket Price: Only 2 TON 🏆Winning Prize: Up to 100 TON ⏳Draw Time: Every 3 Days Here’s your chance to multiply your TON in a simple and exciting way. Just grab your ticket, sit back, and wait for the draw — one lucky winner will walk away with a massive reward! 🔥 Don’t miss out — the sooner you enter, the bigger the prize pool grows. 🚀Buy your ticket now and secure your chance to win big! #Gemifaucet#Lottery#WinTON#CryptoOpportunity Buy Now

Gemi Faucet News

@gemifaucet · Post #1573 · 04.05.2026 г., 18:47

🎉Exciting Update: Lottery Feature is Now Live on Gemifaucet!🎉 We’re thrilled to introduce a brand-new way to win big on Gemifaucet — our Lottery System is officially launched! 🎟How it works: * Purchase your lottery tickets directly داخل the app * Each ticket gives you a chance to win * One lucky winner takes home the entire prize pool💰 🔥 The more participants, the bigger the rewards — so don’t miss your chance to be part of it! This feature is designed to make your experience more engaging, rewarding, and fun. Whether you're a regular user or just getting started, now is the perfect time to try your luck. 🚀Start buying your tickets today and aim for the jackpot! Stay tuned for more updates and features coming soon. #Gemifaucet#LotteryLaunch#WinBig#CryptoRewards

Gemi Faucet News

@gemifaucet · Post #771 · 10.02.2026 г., 07:09

💥 OFFICIAL PARTNERSHIP ANNOUNCEMENT 💥 We’re pleased to announce an official partnership between Gemifaucet and AdsGram, focused on improving monetization quality and user experience across our platform. 🚀 About Gemifaucet Gemifaucet is a Telegram mini app where users receive rewards by interacting with tasks and ads in a simple, transparent, and user-friendly environment. 📊 About AdsGram AdsGram is a leading Telegram Native Ads platform trusted by top Telegram apps and communities. It provides seamless, non-intrusive ad solutions with strong performance, advanced analytics, and a proven monetization ecosystem. 🤝 Why this partnership matters By this official partnership formalizes our collaboration and strengthens our monetization infrastructure. 👉 Gemifaucet: @gemifaucet_bot 👉 AdsGram: @adsgram_ai Thank you for your continued support — more updates coming soon! 🚀 #OfficialPartnership#Gemifaucet#AdsGram#TelegramMiniApp#Announcement