Когда разрабатываете свой 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
#Alameda Reaserch wallet 0xf02 further deposited 4,000 $ETH ($14.75M) to #Coinbase at $3,688 6 hours ago.
Notably, this is the largest single $ETH deposit by FTX and Alameda since the market rally in Feb. Since Feb 1, 2024, FTX and Alameda have deposited 21,650 $ETH ($72.4M) to #Coinbase at ~$3,343, mostly before the price dropped.
Follow @spotonchain and turn on your 🔔 for the FTX and Alameda Research entities at:
1. FTX: https://platform.spotonchain.ai/en/entity/354
2. Alameda Research: https://platform.spotonchain.ai/en/entity/79
🚨🚨#FTX and #Alameda transferred out $38.5M worth of 7 assets to exchanges ~6hrs ago:
• 750,000 $SOL ($31.2M)
• 325,501 $ENS ($2.76M)
• 10.1M $GMT ($2.22M)
• 642,702 $LDO ($1.26M)
• 288,211 $APE ($410K)
• 127,407 $BADGER ($365K)
• 555,342 $BNT ($323K)
Overall, as of Nov 8, #FTX and #Alameda have transferred out $350M worth of 36 assets to exchanges.
👉 More details: https://platform.spotonchain.ai/signal-details/ftx-and-alameda-research-further-moved-altcoins-to-exchanges-4711
Yesterday, #Alameda’s bankruptcy wallet swapped 129.04M $STG (~$26M) into 11.14M $ZRO (~$25.96M).
12 hours ago, they sent $ZRO to #WinterMute.
https://intel.arkm.com/explorer/entity/alameda-research
https://x.com/OnchainLens/status/2022268604151103646
Follow @OnchainLens for more Onchain Updates.
🚨#FTX and #Alameda Research just deposited 44.19M $CRO ($4.17M) to #Coinbase ~20 mins ago.
Overall, FTX and Alameda have deposited 13.99M worth of $ETH, $CRO, $MATH, $MPL, and $BLZ to Coinbase in the past 2 weeks.
👉 More details: https://platform.spotonchain.ai/en/signal-details/ftx-and-alameda-moved-cro-to-coinbase-prime-16235
⚠️FTX/Alameda unstaked and distributed 185,345 $SOL ($22.9M) to 38 wallets ~9 hours ago as part of their monthly SOL unloading.
Currently, 5.5M $SOL ($693.8M) remains in FTX/Alameda’s staking account.
Since November 2023, #FTX and #Alameda have unstaked and offloaded 8.019M $SOL (~$1B), mostly to #Coinbase and #Binance, at an average price of $125.8.
Follow @spotonchain for more details at https://x.com/spotonchain/status/1899992964296040930
🚨 FTX/Alameda unstaked and distributed 3.03M SOL$SOL ($432.5M) to 37 wallets, likely for deposits to #Coinbase and #Binance ~3 hours ago!
This is #FTX/#Alameda’s largest unstake since November 2023 and likely part of the 11.2M SOL$SOL (~$1.5B) set to be unlocked in early March.
Since November 2023, FTX/Alameda has unstaked and offloaded 7.83M SOL$SOL ($986M) to Coinbase and Binance at an average price of $125.8.
Follow @spotonchain and check out the details at https://x.com/spotonchain/status/1896749492738941142
#FTX and #Alameda Research deposited another 4,500 $ETH ($14.4M) to #Coinbase and #Binance at ~$3,207 in the past 8 hours.
Note that since Mar 1, FTX and Alameda have deposited 20,350 $ETH ($72.5M) into CEX at ~$3,562, often before significant price drops.
How will the price react this time? Follow @spotonchain and set alerts for FTX and Alameda via our platforms now:
1. FTX: https://platform.spotonchain.ai/en/entity/354
2. Alameda Research: https://platform.spotonchain.ai/en/entity/79
As the market rallied, #FTX and #Alameda returned to deposit 2,000 $ETH ($6.36M) to #Coinbase and 163,727 $PROM ($2.04M) to #Binance ~5hrs ago.
Notably, FTX and Alameda Research have deposited 10,447 $ETH to CEX at $2,641 ($27.6M) in the past month as the $ETH price surged 42%.
For more updates on FTX and Alameda Research’s activities, follow @spotonchain and turn your 🔔 at:
1. FTX entity: https://platform.spotonchain.ai/en/platform/entity/354
2. Alameda Research entity: https://platform.spotonchain.ai/en/platform/entity/79
🚨🚨#FTX and #Alameda related-addresses are depositing tokens to exchanges!
Via address 0xde9, #FTX 0x97f and #Alameda 0xf02 have transferred a total of $10.51M worth of 4 assets to #Binance and #Coinbase in the past 5 hours:
- 2,904 $ETH ($5.21M)
- 1,341 $MKR ($2.01M)
- 11,975 $AAVE ($1.02M)
- 198,807 $LINK ($2.27M)
👉 Address: https://platform.spotonchain.ai/profile?address=0xde9A61c2b776e2F4C6ddB0C9Ad5cCfCfC15B0a9B
🚨🚨#FTX further transferred out 1.25M $SOL ($50.1M) and 1,583 $ETH ($3M) to #Binance and #Kraken in the past 20 hours.
In total, #FTX and #Alameda have transferred a total of $312M worth of 31 tokens to exchanges since Oct 24 (13 days ago).
👉 More details: https://platform.spotonchain.ai/platform/entity/354
🎉🎉 FTX debtors may have 391M$ more thanks to $FTT recent pump!
➡️ $FTT surged by 117% due to a potential reboot of FTX crypto exchange
➡️ FTX and Alameda addresses hold ~267M $FTT (76% of the total supply)
➡️ Their $FTT value has jumped from $334M to $726M.
As of now, the addresses have yet to move any $FTT out in the recent sell-off.
🔔 Want to be informed of an $FTT activity from FTX and Alameda ASAP? Set alerts for the below entities on SpotOnChain platform now:
• FTX entity: https://platform.spotonchain.ai/platform/entity/354
• Alameda entity: https://platform.spotonchain.ai/platform/entity/79
#spotonchain#ftx#alameda
🚨🚨 Note that #FTX and #Alameda further deposited $36.01M worth of $MATIC and $AVAX to exchanges in the past 24 hours:
• 22.6M $MATIC ($17.2M) to #Coinbase and #FalconX
• 975,859 $AVAX ($18.83M) to #FalconX
Overall, FTX and Alameda have transferred out $488M worth of 48 tokens since October 24.
✅ Follow the FTX and Alameda Research entities on our platform now:
• https://platform.spotonchain.ai/entity/354
• https://platform.spotonchain.ai/entity/79
👉 More details: https://platform.spotonchain.ai/signal-details/ftx-and-alameda-continued-transferring-out-matic-and-avax-7075