Когда разрабатываете свой 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
Mt. Gox just announced it will start repaying creditors in $BTC and $BCH in early July 2024. Preparations and compliance measures are complete, but detailed implementation will take some time.
Note that Mt. Gox currently holds 141,686 $BTC ($8.67B) across 3 wallets.
It seems that the market has already reacted negatively after the news was out, with the $BTC price dropping from $62.8K to $60.8K in only a few minutes.
Follow @spotonchain and set alerts for the #MtGox entity via https://platform.spotonchain.ai/en/platform/entity/2182
#MtGox#BTC
Экс-глава Mt. Gox предложил хардфорк для возврата украденных BTC 2011 года
Бывший CEO Mt. Gox предложил рассмотреть возможность хардфорка сети Bitcoin для возврата монет, похищенных в результате взлома 2011 года.
Речь идет о примерно 80 000 BTC, которые по текущим ценам оцениваются в около $5,2 млрд. Идея предполагает изменение истории блокчейна с целью признания соответствующих транзакций недействительными.
Инициатива уже вызвала критику в сообществе, поскольку подобное вмешательство противоречит принципу неизменяемости блокчейна.
Massive Bitcoin Transfer by Mt. Gox
Mt. Gox moves $905 million worth of Bitcoin to an unmarked wallet, raising eyebrows in the crypto community. The exodus has sparked speculations about future moves. For more details, check the full article here.
#Bitcoin#MtGox#Crypto#Blockchain
💸Биржа Mt. Gox переводит 24 000 BTC после взлета крипты выше $100 000
🟪 Криптовалютная биржа Mt. Gox перевела 24 051 BTC на неизвестный адрес после того, как цена биткоина превысила $100 000.
🟪 По данным Arkham Intelligence, транзакция состоялась утром 5 декабря. Это первая операция биржи с 12 ноября.
🟪 Аналитики предполагают, что перевод может предшествовать новым выплатам кредиторам, пострадавшим от взлома платформы. Ранее подобные транзакции совершались перед выплатами компенсаций.
🟪 Перемещение таких объемов криптовалюты может оказать давление на рынок. Если биткоины будут проданы на биржах, это может привести к снижению их стоимости.
#MtGox#Биткоин#BTC
АкадемияGarantex|Garantex Announcements|ВКонтакте|YouTube
⚠️ Mt. Gox wakes up: 10,608 $BTC (~$954M) moved today after 8 months offline. 🚨
• 185.5 $BTC ($16.7M) sent to #Kraken ~12 mins ago
• 10,422 $BTC ($937M) moved to a new wallet—likely its own cold wallet—potentially to be distributed to exchanges in smaller batches later (~4 hrs ago)
Follow @spotonchain to track the next #MtGox moves with us now!
https://x.com/spotonchain/status/1990698974127517780
[ATTENTION] Mt. Gox just moved 11,501.4 $BTC ($1B) again!
This includes 10,608 $BTC ($929.7M) sent to a new wallet and 893.4 $BTC ($78.3M) to a warm wallet.
Notably, after Mt. Gox’s previous transfer, 332 $BTC ($25.5M) was deposited into #Bitstamp. It is likely the 893.4 $BTC sent to the warm wallet will be moved out shortly too!
Follow @spotonchain and track #MtGox live now: https://x.com/spotonchain/status/1904335124675833869
Mt. Gox just moved 11,834 $BTC ($910M) again!
This includes 11,502 $BTC ($885M) to a new wallet and 332 $BTC ($25.5M) to a warm wallet.
Notably, after Mt. Gox’s last major $BTC transfer 5 days ago, 166.5 $BTC was sent to #BitGo, likely for creditor repayment. The above 332 $BTC ($25.5M) may be moved out soon.
Follow @spotonchain and track #MtGox live with us now: https://x.com/spotonchain/status/1899263219065393536
🔴 Mt. Gox moved 47,228 $BTC ($3.15B) to 3 new wallets in the past 2 hours!
Based on past activities, Mt. Gox may soon move parts of these $BTC to CEX to repay creditors.
Since July 5, 2024, Mt. Gox has transferred a total of 61,559 $BTC ($3.88B) to #Bitstamp, #SBIVC and #Kraken for creditor repayments.
Follow @spotonchain and set alerts for the latest updates about #MtGox now: https://platform.spotonchain.ai/en/entity/2182
🚨🚨 BREAKING: Mt. Gox moved 2,239 $BTC ($149M) to #Bitstamp 30 minutes ago!
To repay creditors this July as previously announced, Mt. Gox has so far:
➡️ Deposited 1,545 $BTC ($84.87M) to #Bitbank on Jul 5
➡️ Moved 48,641 $BTC ($3.27B) wallet 3JQie, possibly a #Kraken deposit, on Jul 16 and held them there.
➡️ Moved 2,239 $BTC ($149M) to #Bitstamp on Jul 23 just now.
Follow @spotonchain and set alerts for #MtGox now via https://platform.spotonchain.ai/en/platform/entity/2182
Mt. Gox moved 47,229 $BTC($3.13B) to 3 unknown wallets again in the past 3 hours!
#MtGox has moved 61,559 $BTC($3.89B) to #Bitstamp, #Kraken, #Bitbank, and SBI VC Trade for repayment since July 5.
Bitcoin Hits $92,000; Crypto News Roundup
- BioNexus Gene Lab adopts Ethereum treasury strategy, first Nasdaq firm to do so. Read more
- Argentina freezes $100M in crypto linked to LIBRA sale, seeks transaction records. Read more
- Trump's WLFI invests $336M in various tokens, faces $88M loss. Read more
- Ethereum Devconnect set for Buenos Aires, Nov 17-22, 2025. Read more
- $50M in USDC minted at USDC Treasury. Details
- Mt. Gox transfers over $1B in Bitcoin to an unmarked address. Read more
#Bitcoin#Crypto#Ethereum#USDC#MtGox#Argentina#BioNexus#WLFI#Devconnect#Tokens#CryptoAssets#Treasury#ETH#Investments#CryptoNews#Finance#Blockchain#Tech#NASDAQ#Loss
Whale Moves ETH, Mt. Gox Transfers BTC
A major whale sold 25,800 ETH to avert liquidation, incurring a $31.75 million loss after purchasing at an average price of $3,084 in July 2024. Meanwhile, Mt. Gox transferred 11,501 BTC (approx. $905 million) to a new address and 332 BTC (approx. $26.13 million) to its warm wallet. New markets for minting crvUSD with weETH, cbBTC, and LBTC as collateral launched.
#ETH#BTC#MtGox#DeFi#Crypto#Whale#Liquidation#trading#MarketNews#CurveFinance#blockchain#finance#investment#cryptocurrency#ethusd#bitcoinnews#assets#collateral#cryptoexchange#trends