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

Резултати

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

Пребарај: #dwflabsxwavemaker

当前筛选 #dwflabsxwavemaker清除筛选
DWF Labs Broadcast

@DWFLabs · Post #785 · 23.08.2024 г., 04:00

Amplify your impact through our KOL Wavemaker Program — with priority access to deal flow from 700+ crypto projects, you'll be part of a connected and passionate community. Sign up here: https://www.dwf-labs.com/wavemakers P.S. Only shortlisted KOLs will be contacted. #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #767 · 05.08.2024 г., 04:00

Boost your influence with our KOL Wavemaker Program! Gain exclusive access to deal flow from over 700 crypto projects and join 200 other KOLs in our vibrant, engaged community. Sign up here: https://dwf-labs.com/wavemakers P.S. We will reach out only to shortlisted KOLs. #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #762 · 26.07.2024 г., 08:03

Over 150 KOLs have been onboarded to our exclusive Wavemaker program ⚡ Come join them and gain access to deal flow from over 700 projects. Register here: https://dwf-labs.com/contact/kol P.S. Only shortlisted KOLs will be contacted. #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #757 · 12.07.2024 г., 10:02

Amplify your impact through our KOL Wavemaker Program - with priority access to deal flow from 700+ crypto projects, you'll be part of a connected and passionate community. Sign up here: https://www.dwf-labs.com/wavemakers P.S. Only shortlisted KOLs will be contacted. #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #721 · 21.06.2024 г., 09:31

Don't miss out on this opportunity to amplify your impact through our KOL Wavemaker Program - we are always looking to cultivate long-term partnerships with top tier creators. 💥 With priority access to 700+ crypto projects, you'll be part of a connected and passionate community. Sign up here: https://www.dwf-labs.com/contact/kol P.S. Only shortlisted KOLs will be contacted. #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #713 · 05.06.2024 г., 07:38

Gain priority access to 700+ crypto projects and be part of a connected and passionate community. Join us now to amplify your impact through our KOL Wave Maker Program! 🔥 https://www.dwf-labs.com/contact/kol #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #703 · 24.05.2024 г., 06:39

Ready to take your influence to the next level? 💥 Join our community and leverage our network for growth. With priority access to 700+ crypto projects, the possibilities for creators are endless. Sign up here: https://www.dwf-labs.com/kol #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #699 · 21.05.2024 г., 07:00

Thank you to our community for the amazing response to our Wave Maker Program! We've received lots of great applications.🔥 Reminder: Please ensure your X handle is correct in your application. We're working hard on reviewing submissions - keep an eye on your DMs and emails! https://www.dwf-labs.com/kol #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #696 · 17.05.2024 г., 01:00

Exciting news! 🎉 We are thrilled to announce the launch of our Wave Maker Program for KOLs looking to work with us. Join us as we grow together. 🤝 https://www.dwf-labs.com/kol #DWFLabsxWaveMaker

DWF Labs Broadcast

@DWFLabs · Post #779 · 15.08.2024 г., 04:00

DWF Labs Haus is coming to #KBW2024 and #TOKEN2049! Come meet with industry leaders and our top tier KOL community in Seoul and Singapore 🤝 All approved DWF Labs KOLs will receive priority registration approval for our events, as well as access to exclusive deal flow from over 700 projects. If you have yet to join our community, register here: https://dwf-labs.com/wavemakers Register for DWF Labs Haus: Korea Blockchain Weekhere. Register for DWF Labs Haus: TOKEN2049 Singaporehere. P.S. We will only reach out to shortlisted KOLs. #DWFLabsxWaveMaker