DanaLea73 wrote:can someone explain some of this code to me? here are 2 lines from the code for these gauges..
Sure thing. The reason for this is that for these gauges you have 2 sets of backgrounds. One is the background that will be shown when the gauge is empty or partially full.
The other is for the color of the gauge itself. So, if the gauge is 100%, the gauge color will show. If the gauge is 0%, then the background will show, and if the gauge is partial, then the amount will be shown by the gauge color, and the rest wil show the background color.
setGaugeStyleSheet("hp_bar", [[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f04141, stop: 0.1 #ef2929, stop: 0.49 #cc0000, stop: 0.5 #a40000, stop: 1 #cc0000);
Ok, some of this information is in the QTdocs, and other you can see just from reading the code, so I'm not sure why everyone is so uptight about explaining it.
Basically, You are seeing the discription of, in this case, a Linear Gradient. What that means is that you have a gradual shift of colors going from left to right. The docs give other options, but what this is saying is that you want a linear gradient, one color top to bottom (x1 and x2 are both zero), and the gradient along the horizontal goes all the way across (y1 is zero and y2 is one (it uses a range of 0 to 1 to set position)). The next annotations are places where the colors change.
stop: 0 #f04141 is the notation that says that the stop is (in this case) the left hand side of the bar -- position zero, and the color is in standard rrggbb hex notation for colors.
So you have (in hex notation) f0 of red, 41 of green, and 41 of blue.
The next notation of
stop: 0.1 #ef2929 gives the same info. New color different place to put it. And it continues until you reach the 1.0 (or just simply 1) position on the right of the bar.
[[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bd3333, stop: 0.1 #bd2020, stop: 0.49 #990000, stop: 0.5 #700000, stop: 1 #990000);
The first has 5 color codes, the second also have 5 color codes. what are each of these colors? One of them has to be when it's maxed, one for depleted.. and it has to do with the stop numbers.. I need plain english. also, why is there a second line of code, also seemingly called "background color", but with different colors. If I can understand the code I can tweek it.
Thanks in advance.
-Cera
p.p.s. so far, I hate Lau. understanding breeds love. right?
I hope that I have helped your understanding of this.
As for lua, well, it has it's quirks like any other programming language. And there is a learning curve involved. Keep in mind that lua stores everything in tables, and that you are manipulating those tables whenever you have information to save, retrieve, or process.
HTH,
Knute