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

Резултати

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

Пребарај: #rocky

当前筛选 #rocky清除筛选
Pensive|

@PensivePost · Post #5704 · 03.05.2022 г., 18:13

#iam#Rocky#yourreview#review Love the way you are Hey buddy, yes you, one who is reading this, you may be alone, not having many friends unlike others, not having enough money to live up to your dreams, may be to even fulfil your small and cutest wishes, you might be tied up all day with your course books, stressful office work, those computers and the hectic tasks, you might be feeling like running away from all your problems and just forget about all your worries, those stressful tasks and from toxic people and enjoy the beauty of the wonderful life. Buddy, you are not alone, me, you, all the top CEO’S, the world politicians, world class celebrities, sportsmen and many real life heroes were been in the same stressful situations, Just stay calm, just feel the beauty of nature, love yourself, love the way you are, the way you are living your life. Have some inner peace, don’t be very harsh on yourselves, just believe in your dreams ,focus on your goals, your passion and nothing else. Don’t give a f* about all these f* things, the girl who rejected you, the friend who betrayed you, the relative who keeps judging you, the society which is putting you shame all the time. Just Focus on your dreams, which is going to bring a grand new reality to new. Remember, no matter where you are and what you are, how worse the situation is, always have that smile on your face, which is going to make all the difference. Bye Bye. (Rocky)

Trump's Ear

@trumpsear_tg · Post #2424 · 29.04.2026 г., 14:00

Greta Thunberg's boyfriend. His name is Rocky. They are said to have met in a psychiatric hospital, where Greta did not stay long after her first attempt to visit the Palestinians in Gaza. 🏥🌍 #greta#thunberg#boyfriend#rocky 👂More on Trump's Ear ⚠️

Видеотека 📼

@videotekashow · Post #13839 · 06.07.2025 г., 07:51

«Если окинуть взглядом свою жизнь, готов спорить, о 80% своих поступков вы пожалеете. Но жизнь — это и есть ошибки». Сегодня исполнилось 79 лет Сильвестру Сталлоне. #ВИДЕОТЕКА #SylvesterStallone #Rocky #FirstBlood #Cobra #TangoAndCash #Cliffhanger #DemolitionMan #TheSpecialist #Copland #TheExpendables2 #TulsaKing