QML: encoder.is_turned

13»

Comments

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,627 mod

    What's the code you are using for live deck play button look like?

  • oviwan
    oviwan Member Posts: 111 Helper

    Wire { enabled: active && deckType == DeckType.Live; from: "%surface%.play"; to: ButtonScriptAdapter { onPress: play_pause() } }

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,627 mod
    edited March 2023

    Try this:

    Wire { enabled: active && deckType == DeckType.Live; from: "%surface%.play"; to: ButtonScriptAdapter { brightness: 0.0; onPress: play_pause() } }
    

    Brightness can be any value between 0 and 1. You can use any numeric variable (including booleans) in place of the number, like for example ' brightness: deckPlayingProp.value '. If you use it on a button with several RGB values available, you can also add in for example ' color: "Blue"; '.

  • oviwan
    oviwan Member Posts: 111 Helper

    Thanks, will try!

    2 more questions... can I use the brightness parameter in my scripts? And what's the approach for sharing data between qml files (say between deck.qml and transportButtons.qml. Are there global variables I can declare or is there a better way?

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,627 mod

    If you are sharing data in the form of variables, you can do it like this:

    S3deck.qml

    Module
    {
      id: module
      property bool active: false
      
      property bool shift: false
      property string surface: ""
    
      property int deckIdx: 0
    
    ...
    
     //------------------------------------SUBMODULES------------------------------------------//
    
     S3Transport
     {
       name: "transport"
       surface: module.surface
       deckIdx: module.deckIdx
       active: module.active
       shift: module.shift
     }
    
    

    S3Transport.qml

    Module
    {
      id: module
      property string surface: "" // e.g. "s4mk3.left"
      property int deckIdx: 0 // Traktor deck 1..4
      property bool active: false
      property bool shift: false
    
    ...
    

    You can also use Traktor's global variables and assign their values as well as manipulate them locally like this:

     AppProperty { id: deckPlayingProp; path: "app.traktor.decks." + deckIdx + ".play"; }
    

    and in a different module you can define it (if you like) with a different name, pointing to the same global variable.

    AppProperty { id: deckPlayingDifferent; path: "app.traktor.decks." + deckIdx + ".play"; }
    


    Then you can use 'deckPlayingProp.value ' or 'deckPlayingDifferent.value ' directly somewhat like a pointer.

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,627 mod

    No idea about brightness in scripts. But you can use boolean logic instead of the number, like this:

    brightness: hideBottomPanel.value ? 0.0 : 1.0
    
  • oviwan
    oviwan Member Posts: 111 Helper

    Didn't have a chance to test it yet. Will let you know. Thanks!

  • oviwan
    oviwan Member Posts: 111 Helper

    @Sûlherokhh finally had a chance to try it and it seems to be working. Thanks!

This discussion has been closed.
Back To Top