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

Резултати

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

Пребарај: #transgenders

当前筛选 #transgenders清除筛选
Trump's Ear

@trumpsear_tg · Post #1520 · 17.09.2025 г., 16:01

In the wake of the Minneapolis Catholic church shooting, senior Justice Department officials are weighing proposals to limit transgender people’s right to possess firearms, according to two officials familiar with the internal discussions. The talks, described as preliminary in nature, appear to build on an idea that has gained some currency in conservative media since the Minneapolis shooting that killed two children and injured 21, most of them children, at Annunciation Catholic Church, an attack that police say was carried out by a 23-year-old transgender woman. Such a move would represent a dramatic escalation of the Trump administration’s fight against the rights of transgender Americans. President Donald Trump has issued a series of executive orders on the topic, including one barring transgender people from serving in the military and another ordering federal prisons to move transgender inmates to facilities corresponding to their gender assigned at birth. In addition, the idea of restricting gun rights has long been a red line for conservatives, with many Republican lawmakers and gun rights groups opposing red flag laws and or other policies aimed at keeping guns away from people suffering from mental health issues. But Justice Department leadership is seriously considering whether it can use its rulemaking authority to follow on to Trump’s determination to bar military service by transgender people and declare that people who are transgender are mentally ill and can lose their Second Amendment rights to possess firearms, according to one Justice official. Another senior Justice Department official cautioned that any such proposal, should it gain steam, would likely run into legal complications. Millions of Americans have mental health issues and many take medications, but are not a danger to society and therefore cannot have their rights infringed upon. #DOJ#transgenders#firearms 👂More on Trump's Ear ⚠️