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

Резултати

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

Пребарај: #microsoftdeveloperscommunity

当前筛选 #microsoftdeveloperscommunity清除筛选
MDC Uzbekistan

@mdcuzbekistan · Post #906 · 07.11.2024 г., 11:57

Microsoft Community Conference 2024 | Uzbekistan Join us for a premier gathering of the Microsoft Developers Community in Uzbekistan! The annual Microsoft Community Conference is back and promises an unparalleled experience of innovation and technology. Mark your calendar for November 30, 2024, and get ready to immerse yourself in the latest advancements and ideas shaping the tech industry. 🎉 Highlights: • Inspiring Keynote Presentations: Hear from leading tech innovators and industry experts. • Interactive Workshops: Explore hands-on sessions with the latest Microsoft tools and technologies. • Engaging Panel Discussions: Dive into trends and best practices shaping today’s tech landscape. • Networking Opportunities: Connect with fellow developers, tech professionals, and enthusiasts. 📅 Date: November 30, 2024 📍 Location: Tashkent, Uzbekistan Don’t miss out on this exciting opportunity to learn, network, and grow within a vibrant community. Whether you're a developer, tech professional, student, or simply passionate about technology, this is an event you won’t want to miss! 🔗 Register Now: https://mdcuzbekistan.com/register Stay tuned for more updates and join us in shaping the future of technology in Uzbekistan! #MDCConf2024#MicrosoftDevelopersCommunity#UzbekistanTech#TechConference#CommunityEvent @mdcuzbekistan

INHA University in Tashkent

@inha_uz · Post #8263 · 20.11.2024 г., 10:10

Microsoft Community Conference 2024 | Uzbekistan Join us for a premier gathering of the Microsoft Developers Community in Uzbekistan! The annual Microsoft Community Conference is back and promises an unparalleled experience of innovation and technology. Mark your calendar for November 30, 2024, and get ready to immerse yourself in the latest advancements and ideas shaping the tech industry. 🎉 Highlights: • Inspiring Keynote Presentations: Hear from leading tech innovators and industry experts. • Interactive Workshops: Explore hands-on sessions with the latest Microsoft tools and technologies. • Engaging Panel Discussions: Dive into trends and best practices shaping today’s tech landscape. • Networking Opportunities: Connect with fellow developers, tech professionals, and enthusiasts. 📅 Date: November 30, 2024 📍 Location: Tashkent, Uzbekistan Don’t miss out on this exciting opportunity to learn, network, and grow within a vibrant community. Whether you're a developer, tech professional, student, or simply passionate about technology, this is an event you won’t want to miss! 🔗 Register Now: https://mdcuzbekistan.com/register Stay tuned for more updates and join us in shaping the future of technology in Uzbekistan! #MDCConf2024#MicrosoftDevelopersCommunity#UzbekistanTech#TechConference#CommunityEvent @mdcuzbekistan

MDC Uzbekistan

@mdcuzbekistan · Post #910 · 20.11.2024 г., 06:01

Exciting Announcement: The Tech Joined Us as a Media Partner! We are proud to welcome The Tech as an official media partner of the MDC Uzbekistan. This partnership marks the beginning of an exciting collaboration to support all our initiatives, including hackathons, conferences, and other key events. With The Tech’s support, we’re set to expand our reach and inspire even more developers across Central Asia. Together, we’ll continue building a stronger tech community! #MicrosoftDevelopersCommunity#TheTech#MediaPartner#TechEvents#MicrosoftUzbekistan @mdcuzbekistan