Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string list and int list error :Cannot find delegate with name... #59

Open
WangYG79 opened this issue Jul 31, 2024 · 0 comments
Open

Comments

@WangYG79
Copy link

WangYG79 commented Jul 31, 2024

The code :

    // property set
    QtnPropertySet *propertyStr = new QtnPropertySet(m_propertySet);
    m_propertySet->addChildProperty(propertyStr);
    propertyStr->setName("string 3 style");

    // lineEdit ok
    auto strEdit = qtnCreateProperty<QtnPropertyQString>(propertyStr);
    strEdit->setName("title");
    strEdit->setValue("no title");

    // file ok
    auto strFile = qtnCreateProperty<QtnPropertyQString>(propertyStr);
    strFile->setName("select path");
    QtnPropertyDelegateInfo fileDeleg;
    fileDeleg.name = "File";
    fileDeleg.attributes["acceptMode"] = QFileDialog::AcceptOpen;
    fileDeleg.attributes["defaultSuffix"] = "Text File | *.txt";
    fileDeleg.attributes["fileMode"] = QFileDialog::ExistingFile;
    fileDeleg.attributes["options"] = QFileDialog::ExistingFile;
    fileDeleg.attributes["viewMode"] = QFileDialog::Detail;
    strFile->setDelegateInfo(fileDeleg);

    // list error
    auto strList = qtnCreateProperty<QtnPropertyQString>(propertyStr);
    strList->setName("Device Type");
    QtnPropertyDelegateInfo listDeleg;
    listDeleg.name = "List";
    listDeleg.attributes["items"] = QStringList() << "Single device" << "Net devicee" << "Other device";
    strList->setDelegateInfo(listDeleg);

    // intList error
    auto intValue3 = qtnCreateProperty<QtnPropertyInt>(propertyStr, "int_List");
    intValue3->setMaxValue(9);
    intValue3->setMinValue(0);
    intValue3->setValue(3);
    QList<int> IntList;
    for(int i = 0; i < 10; i++) {
        IntList.append(i);
    }
    QtnPropertyDelegateInfo intNewDeleg3("IntList");
    intNewDeleg3.attributes.insert("values", QVariant::fromValue(IntList));
    intValue3->setDelegateInfo(intNewDeleg3);

Two Error when running:

13:16:42: Starting E:\learn\qt\mytest\build-demo1-Desktop_Qt_5_15_2_MSVC2019_32bit-Debug\debug\demo1.exe...
Cannot find delegate with name "IntList" for property "int_List"
Did you forget to register "IntList" delegate for QtnPropertyInt type?
Cannot find delegate with name "List" for property "Device Type"
Did you forget to register "List" delegate for QtnPropertyQString type?

Can you tell me how to solve the 2 errors?
Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant