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 слични објави

Пребарај: #little

当前筛选 #little清除筛选
Journey to Fluency

@fluencyinenglish · Post #7453 · 18.12.2019 г., 05:06

#few #a_few #little #a_little @fluencyinenglish @ieltsstrategies ❇️Little, a little, few, a few @fluencyinenglish @ieltsstrategies (A) little and (a) few are quantifiers meaning ‘some’. Little and few have negative meanings. We use them to mean ‘not as much as may be expected or wished for’. ✅Compare All she wanted was a few moments on her own. some, a small number She had few moments on her own. not many/almost none She saves a little money every month. some, a small amount They had little money to spend. not much/almost nothing A: Have you got any money? B: Yes, a little. some, a small amount A: Have you got any money? B: No, very little. not much/almost nothing @fluencyinenglish @ieltsstrategies A little, a few with a noun ❇️We use a little with singular uncountable nouns. We use a few with plural countable nouns: Mary said nothing, but she drank some tea and ate a little bread. We stayed a few days in Florence and visited the museums. @fluencyinenglish @ieltsstrategies Little, few with a noun ❇️We use little with uncountable nouns. We use few with plural countable nouns. They are used in formal contexts: I’m not very happy about it but I suppose I have little choice. Few cities anywhere in Europe can match the cultural richness of Berlin. [talking about a period of history] At that time few people travelled who didn’t have to. @fluencyinenglish @ieltsstrategies (A) little, (a) few without a noun ❇️We can use (a) little and (a) few as pronouns. We can use them to substitute for a noun when it is obvious from the context: After that, she began to tell them a little about her life in Scotland, particularly her life with the Rosenblooms. Don’t take all the strawberries. Just have a few. (Just have a few strawberries.) @fluencyinenglish @ieltsstrategies ❇️Little and few are not very common without a noun. We use them in formal contexts: Little is known about his upbringing and education. Few would be in favour of police officers carrying weapons. @fluencyinenglish @ieltsstrategies

VIP_影视分享

@WangZhuanZhan · Post #34500 · 28.10.2024 г., 07:30

Y-y杨y过g与y小x龙l女n- 杨过与小龙女 楊過與小龍女 (1983) 直达链接:https://pan.quark.cn/s/936f5b69fe88 #杨过与小龙女 #楊過與小龍女 #神雕侠侣之杨过与小龙女 #Little Dragon Maiden 链接:https://link3.cc/sf_com #电影#爱情#内地#80年代

小喵的ACG黄油 (重开版)

@xiaomiaogame · Post #3356 · 11.03.2026 г., 10:57

Little Witch Inuko 见习魔女犬子酱 いぬこちゃんは見習い魔女 v2.04 官方中文步兵版 游戏简介: 在绝望的深渊中,苍之魔术师艾欧斯遇见了一只拥有惊人魔法天赋的犬丸。 他收它为徒,赐名「犬子」,决心培养她成为自己的继承人。 多年过去,犬子这位从犬丸化身为人类的少女,如今已是前途无量的见习魔法师……但现在,她遇到大麻烦了! 她最爱的师父竟逼她接受魔法协会设下的严酷试炼,考核她是否有资格成为正式魔女! 更可怕的是,如果失败,师父就要断绝师徒关系! 为了继续待在艾欧斯身边,更为了让他正眼看待自己、接受她的心意,犬子下定决心挑战试炼! 究竟,师父为何如此坚持要她参加考验?遗迹之中又藏着怎样的秘密? 她是否能通过试炼,征服神秘的地下遗迹,成为真正的魔女? 一切谜题,等你与犬子一同揭晓! 评分 作者 #ふらむそふと #PC#RPG#步兵#逆推#官中 #Little Witch Inuko #见习魔女犬子酱#いぬこちゃんは見習い魔女 入正地址 下载地址