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

Резултати

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

Пребарај: #bukit

当前筛选 #bukit清除筛选
Bali News

@balinews · Post #386 · 08.04.2025 г., 12:35

🎸Singer and surfer Jack Johnson to give a concert in Bali 📆 Jack Johnson will be coming to Bali in 2025 for a chamber event to be held at Uluwatu Surf Villas on Bukit Peninsula on June 18, 2025 and it will be one performance only. 🎫 Less than 1,000 tickets are expected to go on sale. It costs Rp 2,205,000 for adults and Rp 815,000 for children 5-12 years old. Food and drinks will be available all evening and the event will be completely outdoors. It will be held in all weather conditions. ℹ️ The singer has become known for his soft acoustic music that has become a symbol of the surf culture of the 2000s (many have heard one of his most famous tracks Better Together. Jack Johnson rose to fame after the release of surf movie The September Sessions, where he performed his first songs. @BaliNews #events#concerts#Bukit

Bali News

@balinews · Post #127 · 26.07.2024 г., 10:01

🍊Mandarin Oriental to open new hotel in Bali 🏨 Famous Mandarin Oriental plans to open a luxury resort on the Bukit Peninsula in 2027. The new project will feature 110 rooms, suites and villas, all of which will blend in with the natural surroundings. 🕺 Renowned interior designer Jeffrey Wilkes is involved in the project. He designs luxury hotels and residences. 📍 The location of the resort will be 30 minutes from the international airport. Close to popular tourist areas such as Jimbaran, Uluwatu and Nusa Dua. @BaliNews #places#hotels#goodnews#Bukit

Bali News

@balinews · Post #166 · 06.09.2024 г., 12:01

⛔The canyon to Tanah Barak Beach has been closed to private vehicles 📰 One of Bukit's most photogenic spots near the famous Pandawa Beach, Tanah Barak Canyon, is now off-limits to private vehicles. Tourists will have to walk or take a paid shuttle service. 🏝 Visitors will now be able to enjoy the beauty and tranquillity of Tanah Barak without the passing motorbikes and autos. @BaliNews #trasport#roads#Bukit#beaches

Bali News

@balinews · Post #120 · 19.07.2024 г., 11:02

🛣Details about the construction of a district road in Bukit District authorities are set to solve the road issue in Uluwatu by laying a new district road. Construction of the first section from Siligita village to Sawangan in Nusa Dua district has already started. The original idea was to extend the toll road, which now runs from the airport to Nusa Dua, all the way to Uluwatu. Right now, traffic on the main road jl. Uluwatu is difficult because it is both a hub of commerce and the main thoroughfare of the area, used by everyone from locals to construction vehicles and tour buses. The land acquisition budget for 2024 will be $16 million, with the next one already promised to increase to $19 million. According to an insider in Bali's land office, all consideration of new housing development in the green zone on Bukit is now halted just in time for the land acquisition for the new roads. @BaliNews #roads#roads#authorities#Bukit#Uluwatu#NusaDua