Using CSS properties?

Post Reply
Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Using CSS properties?

Post by Nyyrazzilyss »

I'm trying to figure out how to use CSS properties with echo.

In particular, the intent is I have a lot of pre-rendered .png files i'm using for buttons. I would like to change them to all be generated realtime from a table.

A sample button:

Image

This is using the AvQest font, I was able to make it work by copying it into the fonts folder.

label:echo([[<p style="font-size:20px;font-style:bold;font-family: 'AvQest'"><b><center><font color="red">XXX</font></center></b></p>]])

works to print 'XXX' to a label at 20px in bold with that font. What i'm trying to do now is add the 'text-shadow' property ( https://www.w3schools.com/cssref/css3_p ... shadow.asp ) to it - No luck there. I'm guessing i'm not formatting the :echo properly?

label:echo([[<h1 "text-shadow: 2px 2px #FF0000"><p style="font-size:20px;font-style:bold;font-family: 'AvQest'"><b><center><font color="black">XXX</font></center></b></p></h1>]])

Doesn't work - The letters display in black, but the shadow isn't applied. Suggestions?

(edit)

I tried using the buttons option to build a button/the stylesheet that way.

color: white; background-color: red;
font-size: 40px;
padding: 6px;
border-radius: 5px;

(all worked)

Neither box-shadow or text-shadow properties had any effect though.

(edit2)

I found a post from 2010 that indicated there was no support at that time for text shadows.
viewtopic.php?f=5&t=92&start=90
I'm guessing that's still the case?

(edit3)

Reading through the thread, it's what Qt currently supports in stylesheets that's usable http://doc.qt.io/qt-5/stylesheet-reference.html that doesn't currently support it :(

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Using CSS properties?

Post by Vadi »

Yep, I think you found the answer.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Using CSS properties?

Post by SlySven »

From what I remember when I was playing with toolbars/menus/buttons you do have to consider the order of declaring the styles when you start using pseudo-states and sub-controls like, say :hover or :selected otherwise one will override another but in not the way you want - I do not recall the details precisely though. :(

Post Reply