Qt World Summit: Submit your Presentation

Qt Script - new angle ?

  • Hi,

    I'm using Qt Script only. In other words just a .js and .ui file.
    This because Qt Script is all that our vendor custom-functions, support.
    So no full blown Qt, for us :-/

    I'm familiar with Qt Scripting such as the following, that updates the text in a label,
    in response to changes to a dial:

    var label = myDialog.findChild("label_Foo");
    var dial = myDialog.findChild("dial_Foo");


    My I ask though, if I've added a conical gradient to my label, via a stylesheet,
    and want to call setAngle( ) of the gradient, in response to changes to the dial,
    to whiz around the gradient, is that possible, from just Qt Script ?

    Stumbling around a bit, I've tried the following.
    Also same with : or :: or -> instead of . after the Foo.

    var gradient = myDialog.findChild("label_Foo.QConicalGradient");

    I've tried also the following.
    Also same with : or :: or -> instead of . after the connect, each place.

    var label = myDialog.findChild("label_Foo");

    But all throw errors.
    I'm sure not surprisingly given the comic element of some of the syntax I've been trying.

    Best regards,


  • Hi,

    And if I can't call setAngle, from Qt Script, then I'd settle just for dynamic change to a stylesheet.
    Specifically, the angle number, below.
    Or the whole stylesheet text, with just the angle number altered.

    background-color: qconicalgradient(cx:0.5, cy:0.7, angle:90.0, stop:0.499 red, stop:0.5 grey);

    Provided, dynamic change to a stylesheet, actually results in a change on-screen.
    And reasonably good update rate.
    I'd settle for 10 a second :-)

    Best regards,


Log in to reply