Skip to content
Snippets Groups Projects
Instrument.qml 826 B
Newer Older
  • Learn to ignore specific revisions
  • /** This file is part of Nootka (http://nootka.sf.net)               *
     * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com)          *
     * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
    
      id: root
      property Item instrument: null
    
      height: GLOB.instrument.type === Tinstrument.Piano ? Math.min(nootkaWindow.height / 5, nootkaWindow.fontSize * 12) : nootkaWindow.height / 4
    
      width: nootkaWindow.width
    
      Component.onCompleted: {
    
        var i = GLOB.instrument.type === Tinstrument.Piano ? "Piano" : "Guitar"
        var c = Qt.createComponent("qrc:/" + i + ".qml")
    
        instrument = c.createObject(root, {"anchors.fill": root})
        instrument.onNoteChanged.connect(callNote)
    
    
      function callNote() { root.note(instrument.note) }