Porting to 4.4

• Aug 27, 2024 - 20:07

Anyone was able to port to 4.4 and could supply an example for diolog type pulgin?


Comments

In reply to by Jojo-Schmitz

thanks but those are useful for porting from 3.6 to 4.x. After i updated to 4.4 today all my plugins seem broken (at least the ones that have a dialog window). I'm trying to make a simple test plugin, using UiComponents, and with only one button to see where the problem could be. All i get is an empty window. Here is what im doing:

import QtQuick 2.2
import QtQuick.Controls 2.15

import MuseScore 3.0
import Muse.UiComponents 1.0 


MuseScore {

title: "TEST TEST TEST"
description: "TEST TEST "
categoryCode: "Composition"
version: "1.1"
pluginType: "dialog"
thumbnailName: "test.jpg"
requiresScore: false

width: 330
height: 250  

onRun: {}

Item {
    id:window
    anchors.fill: parent         

    FlatButton {
        id: tapButton
        accentButton: true
        text: qsTr("Tap!")
        anchors.horizontalCenter: parent.horizontalCenter

    }      
}    
}

For better or worse I winged it a bit and was able to upgrade my 4.3 compatible script to 4.4:

https://github.com/birdwellmusic/PruneStack/blob/master/prunestack-4.4x…

Things to note:
* I referenced the MuseScore logs to pinpoint at least one error and that got me started.
* I chose not to use the version numbers in my script
* From examples, it looked as those most elements need an id attribute, so I added
* At least one error in the log pointed me to invalid properties in my script

Qt's QML reference was a handy reference:
https://doc.qt.io/qt-6/qmltypes.html

I need a better editor and perhaps a visual QML dialog editor to make things better. Maybe someday - for now I just edit and test in Notepad++ and it shows! ;)

In reply to by rob@birdwellmu…

Yes, in 4.4 (or rather with Qt6) you can ommit the version numbers on those import statemenmts, but that'd cause incompatibility with earlier 4.x or 3.x versions.

Instead of

import MuseScore 3.0
import QtQuick 2.2
import QtQuick.Controls 1.1

use

import MuseScore 3.0
import QtQuick 2.9
import QtQuick.Controls 2.2 // or 2.15, for Mu4 only plugins)

Also replace QtQuick.Controls' TextField with TextEdit

Thanks everyone for the replies.
What was throwing me off was how to substitute elements that used Qt.Dialog module, especifically popup windows for errors and/or messages. I used to do that using the MessageDialog{} object.
However, I was able to substitute this with the following without breaking compatibility with 3.x.

 ApplicationWindow {
        id: errorDialog
        title: "WARNING!"
        property var msg: "Warning message here"
        visible: false
        flags: Qt.Dialog | Qt.WindowStaysOnTopHint
        // Qt.WindowStaysOnTopHint => dialog always on top
        // Qt.FramelessWindowHint  => dialog without title bar
        width: 320
        height: 100        

    Label {
        text: errorDialog.msg
        font: ui.theme.bodyFont
        anchors{
            top: parent.top 
            horizontalCenter: parent.horizontalCenter                
            margins:20 
        } 
    }
    Button {               
        text: "Ok!"
        anchors{
            horizontalCenter: parent.horizontalCenter
            bottom: parent.bottom
            margins: 10
        }             
        onClicked: errorDialog.close()            
    }        
}

Do you still have an unanswered question? Please log in first to post your question.