【问题标题】:How to clear all items of QListView如何清除QListView的所有项目
【发布时间】:2021-08-17 18:39:38
【问题描述】:

查了很多,不明白怎么清除QListView的所有项?

我用QStringListModelQStringList 来填充它。

【问题讨论】:

    标签: qt qlistview


    【解决方案1】:

    您可以使用model.setStringList( QStringList{} ),也可以手动删除带有model.removeRows( 0, model.rowCount() ) 的行。

    【讨论】:

      【解决方案2】:

      这对我来说很好。

      model1->removeRows( 0, model1->rowCount());

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-24
        • 2019-06-19
        • 1970-01-01
        相关资源
        最近更新 更多