Когда разрабатываете свой 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
#Polygon
Polygon обошёл Ethereum по суточным комиссиям
Впервые сеть Polygon опередила Ethereum по ежедневным комиссиям:
— пятница: $407k против $212k,
— суббота: $303k против $285k.
Основной драйвер — рост активности на Polymarket. За неделю платформа принесла сети более $1 млн комиссий.
‼️ BREAKING: INDIA TO LAUNCH ARC STABLECOIN ☺️
🇮🇳 India plans to roll out ARC, a rupee-backed stablecoin in Q1 2026.
Built by 🟣#Polygon & Anq, ARC is designed to operate under Reserve Bank of India’s CBDC framework.
➡️ India is planning to launch ARC (Asset Reserve Certificate), a rupee-pegged stablecoin (1:1 backed by government securities like treasury bills, not just debt), developed by Polygon and fintech firm Anq. It's set for a tentative Q1 2026 debut under the RBI's CBDC framework, using a two-tier system (limited to corporate accounts initially) to boost domestic liquidity, cut outflows to USD stablecoins like USDT/USDC, and drive demand for Indian bonds. It'll use tech like Uniswap v4 for compliant trading on whitelisted addresses, keeping things sovereign and regulated—no wild speculation here. No official RBI announcement yet, but project docs and sources confirm it's moving forward amid India's crypto push.
🚨 American billionaire Mark Cuban (@mcuban) unstaked and deposited 2.82M $MATIC ($2.56M, price: $0.907) to #Coinbase ~6hrs ago.
Notably, Mark Cuban received 2.5M $MATIC (then $4.25M) from the #Polygon Ecosystem Growth on May 24, 2021 and then staked them to earn more $MATIC.
👉 More details: https://platform.spotonchain.ai/en/signal-details/mark-cuban-moved-matic-to-coinbase-10-14444
🚨🚨Republic Capital just moved 24.5M $MATIC at $1.11 (~$27.2M) to #Coinbase 6hrs ago.
They received the amount from #Polygon (Matic) Ecosystem Growth on Jan 18 at $0.97 as part of the vesting process.
Republic Capital is among investors in Polygon’s $450M private funding round early last year.
Wallet address: 0xc865a52c3894025e0070b180b0e6e4e4731ee799
🚨LayerX Capital and Whales deposited 12.53M $MATIC ($11.33M) to #Binance and #Coinbase in the past 10 hours.
1. LayerX Capital deposited 3.62M $MATIC ($3.31M) to Binance at $0.916 ~10hrs ago.
- The VC still stakes 7.18M $MATIC ($6.38M) with #Polygon.
- Estimated total loss: $17.5M (-58.1%).
2. Two whales 0x2e9 and 0xdb6 (likely one person) deposited 5.27M $MATIC ($4.80M) to Binance at $0.91 on avg ~9.5hrs ago.
- Estimated profit: $36.1K (+0.76%).
3. Whale 0x5d7 deposited 3.64M $MATIC ($3.22M) to Coinbase at $0.886 ~40 mins ago.
- Estimated profit: $521K (+19.3%).
👉 More details: https://platform.spotonchain.ai/signal-details/layerx-capital-and-whales-deposited-matic-to-binance-11022
🔥🚀$MATIC increased by 80% this year and people are still excited about the #Polygon zk rollup solution.
⁃ Whale "0xa205fd7" just received 17.1M $MATIC ($23.9M) from #binance 17 hours ago (price was $1.36).
⁃ This is the first receive since he sold all $MATIC to #coinbase one year ago.
👉More details: https://twitter.com/spotonchain/status/1628677718115250176
🚨Don’t miss the major DeFi launch of 2022
🚧MAXX Finance is a dual yield aggregator platform backed by validator nodes & protected by a gamified system to counter inflation to ensure a sustainable ecosystem. MAXX will be launching on #Polygon🚀, free of any CeFi dependencies such as price correlations & counterparty risk.
🚀 In the spirit of decentralization, MAXX team conducts launch in the fairest way possible with no ICO, IDO, or any VC backing (with a built-in system that prevents whale accumulation).
🔗Right now it’s the best time to enter their #whitelist & win BIG! Go visithttps://link.maxx.finance/dn & complete the form to get your bounties:
🏆Priority Access to MAXX Liquidity Amplifier (every entrant)
🏆 5,000 in $MATIC (shared by 100 winners)
🏆 200,000,000 in $MAXX (shared by 200 winners)
🔴 Join MAXX Finance Liquidity Amplifier waiting list & claim your place in the largest DeFi Dapp launch of 2022.
📈Polygon Ecosystem Token POL Drops 3.93% Amid Upbit Hard Fork Suspension
Polygon Ecosystem Token (POL) has experienced a nearly 4% price drop today, primarily driven by a significant operational update from major South Korean exchange Upbit regarding a hard fork and...
🔗Read Full Analysis
🎯 SPECIAL OFFER: 15% OFF
💸 Coupon Code: salenow15%
🚀 Upgrade to premium signals → https://markets.fxpremiere.com/en/signals?utm_source=telegram
#Cryptocurrency#Polygon#POL