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

Резултати

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

Пребарај: #tik

当前筛选 #tik清除筛选
PT风向旗

@Ptfxq · Post #354 · 22.09.2022 г., 00:01

#Cinematik#TIK#站免 Autumn 2022 Freeleech! Once again Fall has set in and we'll have our traditional 7-day Freeleech. All torrents on site will be completely free to download until about 11PM CET on September 28. As usual, no uploading will be possible for the duration of the event, so take advantage and get rid of your bookmarks. Hopefully you may also revive some dead torrents. Beware: Don't forget to seed back everything you download to a 1:1 ratio, or for an absolute minimum time of 3 days - even spread over a week time. Hit-and-run behavior during freeleech entails from a several week warning to a final ban. Enjoy! With love from Staff

PT风向旗

@Ptfxq · Post #875 · 23.03.2025 г., 05:59

#Cinematik#TiK#站点免费 TiK 站免至 2025-03-31 23:59 (UTC) There it is, folks! It's time to celebrate Cinematik's birthday again. Your favorite tracker is now 19 years old, which is quite an amazing accomplishment! The festivities will start shortly, entailing a site-wide Freeleech that shall end at 23:59 (UTC) on 2025-03-31. In other words, the entire site will be in Golden mode for the duration of the event (9 days overall). We want to take this opportunity to extend our gratitude to everyone who has been and still is a part of this unique community. In particular, we are all very grateful to our wonderful uploaders, internals, and staffers, who volunteer their time and resources and work relentlessly towards keeping TiK as relevant and as strong as ever. And a special thank you to herrmann for creating this year's very colorful birthday banner!

PT风向旗

@Ptfxq · Post #556 · 27.01.2024 г., 07:02

#Cinematik#TIK#站点维护 We first must apologize for this sudden announcement and the short window of execution. The relaxed en-devour of moving our beloved Cinematik.net to a new server has been blocked by software incompatibility issues. This and the inability to stay on our current server (expires at the end of this month) has forced our new destiny earlier than planned. Ready or not we must embrace the newer UNIT3D code-base in its entirety and call it our new home. On Saturday the 27th 8pm GMT time our current server will go offline and the login screen will be replaced by the site landing page with the current status. Effective immediately new uploads are disabled and the approval thread locked to help negate further modifications to the server data. Please visit this thread for any further discussion. We hope you can join us in keeping a positive attitude going into our new home and allow it any benefit of doubt and time for you to get acquainted. Our new home should be ready by the 2nd of February

12
ПретходнаСтраница 1 од 2Следна