Когда разрабатываете свой 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
Hey, you can check your $ZRO Token Airdrop eligibility on TokenPocket!
📱Open TokenPocket > Switch to the Discover page > You can see the DApp on the Airdrop Zone!
💻You can get the checking page on TokenPocket's DApp Store!
👉https://tokenpocket.pro/en/dappstore
Good luck! 💙#LayerZero
Layer Zero AirDrop Starts NOW!
All active participants will receive a guaranteed drop of $ZRO tokens.
Airdrop : https://linktr.ee/labslayerzero
A total of 12.000.000 $ZRO coins have been allocated, time is limited!
#layerzero#airdrop#tokens#coin
📋The sensational #LayerZero (ZRO) is trading at $ 3.05 and the current circulation of unlocked coins is only $ 770 million, the total capitalization is also small - $ 3 billion, which is 2-3 times less than Aptos or SUI. #zkSync (ZK) has a similar picture, the total capitalization is even more than ZRO by 900 million.
🧐It looks very modest, I think few people predicted this. Looking at this picture, you start to worry about the rest of the altos with large capitalization. And looking at the small ones, you also think about it. After this, is it possible to believe in a further correction of Chia (XCH)?
🥸Both projects are technologically advanced, but in different aspects. zkSync focuses on scaling and efficiency within a single blockchain (Ethereum) using advanced cryptographic techniques. LayerZero is aimed at improving the interaction between different blockchains, which is also an important task for the entire industry.
😎I think for #ZRO and #ZK you need to allocate a place in your portfolio, lay a theoretical descent lower by 30-50% and start buying a ladder from the current level, of course we are talking about spot. That is, to allow a speculative decrease in ZRO to $ 2.1 and ZK to $ 0.13 due to a speculative decrease and liquidation of longs on futures. But you need to understand that the current price is already very attractive, you need to partially buy now.
0⃣#ZRO + #Tether = 🚀🚀🚀
Tether recently invested in #LayerZero, and you know they don't drop cash without deep due diligence. 🕵️♂️ The fundamentals are rock solid.
This rally is just the beginning. 🌤 I’m stacking as much $ZRO as possible. targeting 2x - 5x gains! 💸
Get in or get left behind.👋
#DeFi#BullRun $ZRO #ZROUSDT
https://x.com/CryptoBull_360/status/2021403228970315928?s=20
Bitcoin: Panic Buying Amid Market Shakeup
Panic reactions in the market are evident as Bitcoin fluctuates. Key developments in the TON ecosystem include:
- TVM Ventures launching a $100M fund for TON growth 🔗
- Updates from TON Core for Dec 2024 - Jan 2025 🔗
- Steve Yun discusses DeFi’s future in Telegram on CNBC 🔗
- First mid-core web3 game launched on TON 🔗
- Support program for Mini Apps initiated 🔗
- Innovations from Notcoin team highlighted 🔗
- LayerZero’s new USDT bridge enhances TON’s cross-chain capabilities 🔗
- Key investments in DeFi and SocialFi detailed by TVM Ventures 🔗
- TON’s ecosystem expands beyond major project monopolies 🔗
- TRM Labs introduces a comprehensive blockchain analysis tool for TON 🔗
- The domain believers.ton is permanently lost 🔗
#Bitcoin#DeFi#TON#Crypto#Web3#Investment#LayerZero#Blockchain#MiniApps#PanicBuying#TVMVentures#Notcoin#TRMLabs
Multiple Fundraising Rounds Announced
Several companies secured funding recently:
- OpenCopilot raised $1.52M for AI customer support.
- Archive Intel secured $1.50M for AI-driven data archiving solutions.
- Serene obtained $1.14M using AI for customer insights and compliance.
- Sytrex raised $1.10M to aid financial institutions.
- Tire Swing acquired $500K focusing on cybersecurity.
In other news, the SEC sues Elon Musk over misleading shareholders during the Twitter acquisition, and Meta plans to lay off 3,600 employees for inefficiency. More updates on AI job creation and Bitcoin market analysis suggest significant changes ahead.
#Funding#AI#Crypto#SEC#ElonMusk#Meta#Bitcoin#CustomerSupport#DataArchiving#FinancialInstitutions#AIJobs#LayerZero#Serene#Sytrex#TireSwing#ArchiveIntel#OpenCopilot