@MostInspiring · Post #1966 · 04.04.2024 г., 02:10
Must watch. #MustWatch What matters the most is.. Not who's mistake but whose life
Hashtags
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
Пребарај: #mustwatch
@MostInspiring · Post #1966 · 04.04.2024 г., 02:10
Must watch. #MustWatch What matters the most is.. Not who's mistake but whose life
Hashtags
@MostInspiring · Post #1515 · 16.10.2020 г., 09:01
#MustWatch @MostInspiring Video Click to Join 👇👇👇👇 You will certainly Experience the good Feeling after seeing this Video
Hashtags
@rusembcy · Post #1341 · 21.11.2023 г., 06:17
#MustWatch To fully understand the genesis of the current situation in Ukraine, how the rise of Neo-Nazism came to be and how the far-right Russophobic ideology and groups gained power over a brotherly nation one must take a retrospect view. 📣 World renowned filmmaker and actor, Academy award winner Nikita Mikhalkov tells and explains just that, with proven facts and archival footage to show the truth, in an emergency hour-long episode of his author's programme BesogonTV. The Western mainstream media will never report on these facts, sweeping under the rug anything that damages the current anti-Russian narrative, hoping the audiences have no recollection of the sequence of the events. Watch to jog your memory. Warning: the video contains sensitive images, viewer discretion advised.
Hashtags
@MostInspiring · Post #760 · 04.05.2019 г., 02:51
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️ One of the best videos ever! Absolutely brilliant in conveying the most needed message of today with no words! We wish this video goes viral across India and the world to create an awareness where education is sold. @MostInspiring #MustWatch
Hashtags
@MostInspiring · Post #655 · 31.03.2019 г., 04:49
Will Power #mustwatch @MostInspiring
Hashtags
@MostInspiring · Post #490 · 13.02.2019 г., 15:01
#MustWatch@mybestcollection
Hashtags
@MostInspiring · Post #329 · 23.12.2018 г., 22:37
@MostInspiring #mustwatch
Hashtags
@MostInspiring · Post #313 · 19.12.2018 г., 23:18
#MustWatch @MostInspiring
Hashtags
@positivenewss · Post #232 · 23.06.2020 г., 09:17
What is real kindness #mustwatch @Highimpact
Hashtags
@primevisa_uz · Post #205 · 21.07.2022 г., 04:43
Bizga ham nasib qilsin 🙌 #mustwatch
Hashtags
@positivenewss · Post #143 · 12.04.2020 г., 05:07
Amazing Video 🔗👆 #MustWatch
Hashtags
@MostInspiring · Post #133 · 24.10.2018 г., 00:06
@MostInspiring #MustWatch
Hashtags