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

Резултати

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

Пребарај: #mine

当前筛选 #mine清除筛选
🏆 Premium, NFT, Tokens

@giiveaways · Post #2717 · 10.08.2024 г., 19:44

🔥 What's up with the listing of HOT and the project overall ? ⚡️ Futures on HOT can already be traded on the 🐂#WhiteBIT exchange, and the price is promising 🤘 Chart on the screenshot, 1 HOT = 19.803 USDT). When spot trading for HOT will be launched is just a matter of time... . 🙂#MineHOT here: https:://t.me/herewalletbot/app👈 🔥

🏆 Premium, NFT, Tokens

@giiveaways · Post #2556 · 26.07.2024 г., 18:31

🔥 What's up with the listing of HOT and the project overall ? ⚡️ Futures on HOT can already be traded on the 🐂#WhiteBIT exchange, and the price is promising 🤘 Chart on the screenshot, 1 HOT = 9.142 USDT). When spot trading for HOT will be launched is just a matter of time... . 🙂#MineHOT here: https:://t.me/herewalletbot/app👈 🔥

🏆 Premium, NFT, Tokens

@Giiveaways · Post #2375 · 08.07.2024 г., 08:02

🔥 What's up with the listing of HOT and the project overall ? ⚡️ Futures on #HOT can already be traded on the 🐂#WhiteBIT exchange, and the price is promising 🤘 Chart on the screenshot, 1 HOT = 6.600#USDT). When spot trading for HOT will be launched is just a matter of time... . 🙂#MineHOT here: https:://t.me/herewalletbot/app👈 ➖

🏆 Premium, NFT, Tokens

@giiveaways · Post #2462 · 15.07.2024 г., 19:42

🔥 What's up with the listing of HOT and the project overall ? ⚡️ Futures on #HOT can already be traded on the 🐂#WhiteBIT exchange, and the price is promising 🤘 Chart on the screenshot, 1 HOT = 8.438#USDT). When spot trading for HOT will be launched is just a matter of time... . 🙂#MineHOT here: https:://t.me/herewalletbot/app👈 ➖

🏆 Premium, NFT, Tokens

@Giiveaways · Post #1974 · 05.06.2024 г., 16:57

🔥 What's up with the listing of HOT and the project overall ? After #Notcoin🤑, one of the major applications that launched was: HOT Near #Wallet. "How to mine - HERE ⚡️ The developers are actively engaging in marketing and have already formed numerous collaborations. In the past two days, they partnered with #1inch and added MPC wallets. ⚡️ Direct support from #Near: it's already evident that all transactions are being recorded on the blockchain. We are #mining a real token, not just pixels on a screen! Moreover, HOT plans to launch its own blockchain. ⚡️ Futures on #HOT can already be traded on the 🐂#WhiteBIT exchange, and the price is promising 🤘 (chart on the screenshot, 1 HOT = 3.987 #USDT). When spot trading for HOT will be launched is just a matter of time... 💯 In conclusion, we can say that the game has a strong foundation and prospects for future development. 🙂#MineHOT here:👇👇 https://t.me/herewalletbot/app?startapp=200850-village-15134