简体   繁体   English

Qt重构QStandardItemModel

[英]Qt Re-factoring QStandardItemModel

I think I have made a big mistake. 我想我犯了一个大错误。 QtCreater does not recognize QStandardItemModel anymore, I highlighted QStandardItemModel, and hit "Refactor" -> "rename Symbol under cursor" and renamed it QAbstractItemModel. QtCreater不再识别QStandardItemModel,我突出显示了QStandardItemModel,然后单击“重构”->“在光标下重命名符号”,并将其重命名为QAbstractItemModel。 With the intention of refacting whatever was named QStandardItemModel with QAbstractItemModel in the class, like you can do in eclipse. 意图用类中的QAbstractItemModel来代替名为QStandardItemModel的任何东西,就像您可以在eclipse中一样。 I seem to have done more however. 但是,我似乎做得更多。

Any suggestions on how to fix this :( 对于如何解决这个问题,有任何的建议吗 :(

Here is a snippet; 这是一个片段;

#ifndef LISTMANAGER_H
#define LISTMANAGER_H
#include <QString>
#include <QList>
#include <QStandardItemModel>


    class listManager: QObject
    {
        Q_OBJECT
    public:
        listManager();
        listManager(QList<QString> list);
        QAbstractItemModel* listManager::getmodelview();
        QAbstractItemModel* listManager::getclassmodelView();
    public:
        QStandardItemModel *courseModel = new QStandardItemModel(0,0);
        QStandardItemModel *classModel = new QStandardItemModel(0,0);

    };

    #endif // LISTMANAGER_H

QStandardItemModel stays black and dosent turn purple, meaning it hasn't been recognized by the compiler. QStandardItemModel保持黑色,并且剂量变为紫色,这意味着编译器尚未识别它。

There is an output of around 80 errors, most of them internal qstandarditemmode, or qabstractitemodel errors. 输出大约80个错误,其中大多数是内部qstandarditemmode或qabstractitemodel错误。

I un-installed Qt Creator, restarted and re-installed. 我卸载了Qt Creator,重新启动并重新安装。 I can use QStandardItemModel again. 我可以再次使用QStandardItemModel。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM