{"id":265247,"date":"2023-03-20T10:53:36","date_gmt":"2023-03-20T02:53:36","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=265247"},"modified":"2023-02-25T20:54:25","modified_gmt":"2023-02-25T12:54:25","slug":"list-linux-listview","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/list-linux-listview.html","title":{"rendered":"\u6559\u4f60\u5982\u4f55\u4f7f\u7528QT\u5236\u4f5c\u4e00\u4e2aListView\u5217\u8868"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528Qt\u5236\u4f5c\u4e00\u4e2aListView\uff0c\u70b9\u51fbListView\u7684Item\u53ef\u4ee5\u7528\u4e8e\u6d4b\u8bd5OpenCV\u7684\u5404\u79cd\u6548\u679c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u53ef\u4ee5\u4e86\u89e3\u4e00\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1\u3001\u6982\u8ff0<\/strong><\/div>\n

\u6848\u4f8b\uff1a\u4f7f\u7528Qt\u5236\u4f5c\u4e00\u4e2aListView\u3002\u70b9\u51fbListView\u7684Item\u53ef\u4ee5\u7528\u4e8e\u6d4b\u8bd5OpenCV\u7684\u5404\u79cd\u6548\u679c<\/p>\n

\u81ea\u5b9a\u4e49\u4e00\u4e2a\uff1aMainListView\u7ee7\u627fQListWidget \u3001MainListViewItem\u7ee7\u627fQListWidgetItem<\/p>\n

2\u3001\u4ee3\u7801\u793a\u4f8b<\/strong><\/div>\n
1.\u81ea\u5b9a\u4e49QListWidget<\/strong><\/span><\/div>\n

mainlistview.h<\/p>\n

class MainListView : public QListWidget\r\n{\r\n    Q_OBJECT\r\npublic:\r\n    explicit MainListView(QWidget *parent = nullptr);\r\nprotected:\r\n    void mousePressEvent(QMouseEvent *event);\r\n    void mouseReleaseEvent(QMouseEvent *event);\r\n    void mouseMoveEvent(QMouseEvent *event);\r\n    void leaveEvent(QEvent *event);\r\nprivate:\r\n    QPoint startPoint;\r\n    MainListViewItem *theHighlightItem = nullptr;\r\n    MainListViewItem *oldHighlightItem = nullptr;\r\n    MainListViewItem *theSelectedItem = nullptr;\r\n    MainListViewItem *oldSelectedItem = nullptr;\r\n    Chapter3Option * option = new Chapter3Option();\r\n  \r\n  \r\nsignals:\r\n  \r\n  \r\npublic slots:\r\n    void updateSelectedIcon();\r\n    void onMainItemClick(QListWidgetItem *item);\r\n};<\/pre>\n

mainlistview.cpp<\/p>\n

#include \"mainlistview.h\"\r\n  \r\nMainListView::MainListView(QWidget *parent) : QListWidget(parent)\r\n{\r\n    setMouseTracking(true);\r\n    \/\/\u8fde\u63a5\u4fe1\u53f7\u4e0e\u69fd\u51fd\u6570\uff0c\u5982\u679c\u9009\u4e2d\u9879\u53d1\u751f\u53d8\u5316\u5219\u89e6\u53d1item\u56fe\u6807\u7684\u66f4\u65b0.\u90fd\u662f\u5f53\u524d\u5bf9\u8c61\u53d1\u751f\r\n    connect(this,&MainListView::itemSelectionChanged,this,&MainListView::updateSelectedIcon);\r\n    connect(this,&MainListView::itemClicked,this,&MainListView::onMainItemClick);\r\n}\r\n  \r\n\/**\r\n * \u5904\u7406\u9f20\u6807hove\u4e8b\u4ef6\uff0citem\u56fe\u6807\u5c31\u53d8\u6210hove\u72b6\u6001\r\n * @brief MainListView::mouseMoveEvent\r\n * @param event\r\n *\/\r\nvoid MainListView::mouseMoveEvent(QMouseEvent *event){\r\n    oldHighlightItem = theHighlightItem;\r\n    theHighlightItem = static_cast(itemAt(event->pos()));\r\n    \/\/\u65e7\u7684hover\u7684item\u56fe\u6807\u56de\u590d\u539f\u72b6(\u6761\u4ef6\u662f\u8be5item\u6ca1\u6709\u88ab\u9009\u4e2d)\r\n    \/\/\u65b0\u7684hover\u7684iten\u56fe\u6807\u53d8\u6210hover\u72b6\u6001(\u6761\u4ef6\u662f\u8be5item\u6ca1\u6709\u88ab\u9009\u4e2d)\r\n    if(oldHighlightItem != theHighlightItem){\r\n       if(oldHighlightItem && !oldHighlightItem->isSelected()) oldHighlightItem->setIcon(oldHighlightItem->mIcon);\r\n       if(theHighlightItem && !theHighlightItem->isSelected()) theHighlightItem->setIcon(theHighlightItem->mIconHover);\r\n    }\r\n}\r\n  \r\n\/**\r\n * \u9f20\u6807\u6309\u4e0b\uff08\u8fd9\u4e2a\u53ef\u4ee5\u5f53\u505aitem\u7684\u70b9\u51fb\u4e8b\u4ef6\uff0c\u80fd\u591f\u6b63\u5e38\u6267\u884c\uff09\r\n * @brief MainListView::mousePressEvent\r\n * @param event\r\n *\/\r\nvoid MainListView::mousePressEvent(QMouseEvent *event){\r\n    if(event->buttons()&Qt::LeftButton){\r\n        startPoint = event->pos();\r\n        MainListViewItem *item = static_cast<\/mainlistviewitem>(itemAt(event->pos()));\r\n        QString filePath = QFileDialog::getOpenFileName(this, tr(\"\u9009\u62e9\u89c6\u9891\"), \"C:\\\\Users\\\\wei.yang\\\\Downloads\\\\opencv_res\", tr(\"Image Files(*.jpg *.png)\"));\r\n        const char *fileRealPath = filePath.toStdString().c_str();\/\/\u5c06QString\u8f6c\u6362\u4e3achar*\r\n        qDebug() <text()<<\"--->\"<pos:\"<mPos;\r\n        switch (item->mPos) {\r\n        case 1:\/\/\u663e\u793a\u539f\u56fe\r\n            option->showSrcImage(fileRealPath);\r\n            break;\r\n        case 2:\/\/\u50cf\u7d20\u53d6\u53cd\r\n            option->pixleReverse(fileRealPath);\r\n            break;\r\n        case 3:\/\/\u56fe\u50cf\u878d\u5408\r\n            option->imageFuse(\"\",\"\");\r\n            break;\r\n        case 4:\/\/\u8c03\u6574\u56fe\u50cf\u4eae\u5ea6\u53ca\u5bf9\u6bd4\u5ea6\r\n            option->increaseBrightnessContrastRatio(fileRealPath);\r\n            break;\r\n        case 5:\/\/\u7ed8\u5236\u7ebf\u3001\u77e9\u5f62\u3001\u692d\u5706\u3001\u5706\u3001\u591a\u8fb9\u5f62\u3001\u6587\u672c\r\n            option->drawShape();\r\n            break;\r\n        case 6:\/\/\u5747\u503c\u6a21\u7cca\uff1a\u7528\u4e8e\u56fe\u50cf\u7684\u964d\u566a\r\n            option->showBlur(fileRealPath);\r\n            break;\r\n        case 7:\/\/\u9ad8\u65af\u6a21\u7cca\uff1a\u7528\u4e8e\u56fe\u50cf\u7684\u964d\u566a\uff0c\u5176\u5bf9\u81ea\u7136\u754c\u7684\u566a\u58f0\u6709\u5f88\u597d\u7684\u6291\u5236\u4f5c\u7528\r\n            option->showGaussianBlue(fileRealPath);\r\n            break;\r\n        case 8:\/\/\u4e2d\u503c\u6ee4\u6ce2\uff1a\u7ec8\u6b62\u6ee4\u6ce2\u7528\u4e8e\u56fe\u50cf\u7684\u964d\u566a\uff0c\u5176\u5bf9\u6912\u76d0\u566a\u58f0\u6709\u5f88\u597d\u7684\u6291\u5236\u4f5c\u7528\uff08\u9ed1\u767d\u70b9\uff09\r\n            option->showMediaBlur(fileRealPath);\r\n            break;\r\n        case 9:\/\/\u53cc\u8fb9\u6ee4\u6ce2\uff1a\u5176\u53ef\u4ee5\u5f88\u597d\u7684\u4fdd\u7559\u8fb9\u7f18\u7684\u540c\u65f6\u5bf9\u5e73\u5766\u533a\u57df\u8fdb\u884c\u964d\u566a\r\n            option->showBilateralFilter(fileRealPath);\r\n            break;\r\n        case 10:\/\/\u63d0\u8d77\u56fe\u50cf\u4e2d\u7684\u82f1\u6587\u5b57\u6bcd\r\n             option->showCleanImage(fileRealPath);\r\n            break;\r\n        case 11:\/\/\u5f62\u6001\u5b66\u5f00\u64cd\u4f5c\r\n            option->showImageOpen(fileRealPath);\r\n            break;\r\n        case 12:\/\/ \u5f62\u6001\u5b66\u95ed\u64cd\u4f5c\r\n            option->showImageClose(fileRealPath);\r\n            break;\r\n        case 13:\/\/\u5f62\u6001\u5b66\u68af\u5ea6\uff08\u57fa\u672c\u68af\u5ea6\uff09\uff1a\u81a8\u80c0\u51cf\u53bb\u8150\u8680\r\n             option->showMorphologicalGradient(fileRealPath);\r\n            break;\r\n        case 14:\/\/\u9876\u5e3d\u64cd\u4f5c\uff1a\u76f8\u5f53\u4e8e\u539f\u56fe\u50cf\u4e0e\u5f00\u64cd\u4f5c\u4e4b\u95f4\u7684\u5dee\u503c\u56fe\u50cf\r\n             option->showTopHat(fileRealPath);\r\n            break;\r\n        case 15:\/\/\u9ed1\u5e3d\u64cd\u4f5c\uff1a\u76f8\u5f53\u4e8e\u539f\u56fe\u50cf\u4e0e\u95ed\u64cd\u4f5c\u4e4b\u95f4\u7684\u5dee\u503c\u56fe\u50cf\r\n             option->showBlackHat(fileRealPath);\r\n            break;\r\n        case 16:\/\/\u5c0f\u6848\u4f8b\uff1a\u63d0\u53d6\u63d0\u53d6\u9879\u76ee\u4e2d\u7684\u5b57\u6bcd\u6216\u8005\u76f4\u7ebf\r\n             option->showLines(fileRealPath,0);\r\n            break;\r\n        case 17:\/\/\u4e0a\u91c7\u6837:\u5229\u7528\u62c9\u666e\u62c9\u65af\u91d1\u5b57\u5854\u8fdb\u884c\u56fe\u50cf\u91cd\u5efa\r\n            option->showPyrUp(fileRealPath);\r\n            break;\r\n        case 18:\/\/\u964d\u91c7\u6837\uff1a\u5229\u7528\u9ad8\u65af\u91d1\u5b57\u5854\u8fdb\u884c\u964d\u91c7\u6837\r\n             option->showPyrDown(fileRealPath);\r\n            break;\r\n        case 19:\/\/\u9ad8\u65af\u4e0d\u540c\uff1a\u628a\u540c\u4e00\u5f20\u56fe\u7247\u518d\u4e0d\u540c\u7684\u53c2\u6570\u4e0b\u505a\u9ad8\u65af\u6a21\u7cca\u4e4b\u540e\u7684\u7ed3\u679c\u76f8\u51cf\uff0c\u5f97\u5230\u7684\u8f93\u51fa\u56fe\u50cf\u79f0\u4e3a\u9ad8\u65af\u4e0d\u540c\r\n            option->showGaussianDiff(fileRealPath);\r\n            break;\r\n        case 20:\/\/\u4f7f\u7528\u81ea\u5b9a\u4e49\u5377\u79ef\u6838filter2D\r\n             option->showCustomKernelFilter2D(fileRealPath,1);\r\n            break;\r\n        case 21:\/\/1.\u5408\u5e76rebort\u548csobel\u7684x\u65b9\u5411\u68af\u5ea6\u548cy\u65b9\u5411\u7684\u68af\u5ea6\r\n             option->showCustomKernelFilter2DMergeXY(fileRealPath);\r\n            break;\r\n        case 22:\/\/\u586b\u5145\u56fe\u50cf\u8fb9\u7f18\r\n            option->showCopyMakeBorder(fileRealPath);\r\n            break;\r\n        case 23:\/\/\u4f7f\u7528Sobel\u548cScharr\u8ba1\u7b97\u56fe\u5f62\u68af\u5ea6\r\n            option->showSobelAndScharr(fileRealPath);\r\n            break;\r\n        case 24:\/\/\u4f7f\u7528\u62c9\u666e\u62c9\u65af\u7b97\u5b50\u663e\u793a\u68af\u5ea6\u56fe\u50cf\r\n             option->showLaplacian(fileRealPath);\r\n            break;\r\n        case 25:\/\/\u8fb9\u7f18\u68c0\u6d4b\r\n            option->showCanny(fileRealPath);\r\n            break;\r\n        }\r\n    }\r\n}\r\n  \r\n\/**\r\n * \u91ca\u653e\u9f20\u6807\r\n * @brief MainListView::mouseReleaseEvent\r\n * @param event\r\n *\/\r\nvoid MainListView::mouseReleaseEvent(QMouseEvent *event){\r\n    \/\/\u5982\u679c\u9f20\u6807\u91ca\u653e\u4f4d\u7f6e\u548c\u5355\u51fb\u4f4d\u7f6e\u76f8\u8ddd\u8d85\u8fc75\u50cf\u7d20\uff0c\u5219\u4e0d\u4f1a\u89e6\u53d1item\u9009\u4e2d\r\n    if((event->pos() - startPoint).manhattanLength() > 5) return;\r\n    MainListViewItem *item = static_cast<\/mainlistviewitem>(itemAt(event->pos()));\r\n    setCurrentItem(item);\r\n  \r\n}\r\n\/**\r\n * \u5904\u7406\u9f20\u6807\u79bb\u5f00\u540e\uff0chover\u56fe\u6807\u56de\u590d\u6b63\u5e38\u72b6\u6001\r\n * @brief MainListView::leaveEvent\r\n * @param event\r\n *\/\r\nvoid MainListView::leaveEvent(QEvent *event){\r\n    Q_UNUSED(event);\r\n    oldHighlightItem = theHighlightItem;\r\n    if(oldHighlightItem && !oldHighlightItem->isSelected()) oldHighlightItem->setIcon(oldHighlightItem->mIcon);\r\n    oldHighlightItem = theHighlightItem = nullptr;\r\n  \r\n}\r\n  \r\nvoid MainListView::updateSelectedIcon(){\r\n    oldSelectedItem = theSelectedItem;\r\n    theSelectedItem = static_cast<\/mainlistviewitem>(currentItem());\r\n  \r\n    \/\/\u4e4b\u524d\u88ab\u9009\u4e2d\u7684item\u56fe\u6807\u56de\u590d\u539f\u6837\r\n    \/\/\u65b0\u88ab\u9009\u4e2d\u7684item\u56fe\u6807\u53d8\u6210hover\u72b6\u6001\r\n    if(oldSelectedItem != theSelectedItem){\r\n        if(oldSelectedItem) oldSelectedItem->setIcon(oldSelectedItem->mIcon);\r\n        if(theSelectedItem) theSelectedItem->setIcon(theSelectedItem->mIconHover);\r\n    }\r\n}\r\n  \r\n  \r\n\/\/\u8fd9\u4e2a\u69fd\u51fd\u6570\u5e76\u6ca1\u6709\u6267\u884c\r\nvoid MainListView::onMainItemClick(QListWidgetItem *item){\r\n    qDebug() << \"\u70b9\u51fb\u4e86item\u7684\u9879\u76ee\";\r\n}<\/mainlistviewitem><\/pre>\n
2.\u81ea\u5b9a\u4e49QListWidgetItem<\/strong><\/span><\/div>\n

mainlistviewitem.h<\/p>\n

class MainListViewItem : public QListWidgetItem\r\n{\r\n     \/\/Q_OBJECT  \/\/\u7531\u4e8eQListWidgetItem\u6ca1\u6709QObject\u5c5e\u6027\uff0c\u6240\u4ee5Q_OBJECT\u9700\u8981\u6ce8\u91ca\u6389\r\npublic:\r\n    explicit MainListViewItem(QString itemTitle,const QIcon &icon, const QIcon &iconHover,int pos,QListWidget *parent = nullptr);\r\n    \/**\r\n     * \u8bbe\u7f6eitem\u7684\u56fe\u6807\r\n     * @brief setItemIcon\r\n     * @param icon\r\n     * @param iconHover\r\n     *\/\r\n\/\/    void setItemIcon(const QIcon &icon,const QIcon &iconHover);\r\npublic:\r\n    QIcon mIcon;\/\/\u9ed8\u8ba4\u56fe\u6807\r\n    QIcon mIconHover;\/\/\u9009\u4e2d\u65f6\u56fe\u6807\r\n    int mPos;\/\/\u7b2c\u4e00\u4e2a\u7f16\u8f91\r\n  \r\nsignals:\r\n  \r\n};<\/pre>\n

mainlistviewitem.cpp<\/p>\n

#include \"mainlistviewitem.h\"\r\n  \r\n\/**\r\n * \u81ea\u5b9a\u4e49\u4e3b\u9875ListView\u7684Item\u9879\r\n * @brief MainListViewItem::MainListViewItem\r\n * @param parent\r\n *\/\r\nMainListViewItem::MainListViewItem(QString itemTitle,const QIcon &icon, const QIcon &iconHover,int pos,QListWidget *parent) : QListWidgetItem(parent)\r\n{\r\n    setText(itemTitle);\r\n    mIcon = icon;\r\n    mIconHover = iconHover;\r\n    setIcon(mIcon);\r\n    setSizeHint(QSize(360,47));\r\n    mPos = pos;\r\n}<\/pre>\n
3.\u4f7f\u7528<\/strong><\/span><\/div>\n
void MainWindow::createListView(QWidget *parent){\r\n    listView = new MainListView(this);\r\n    listView->setFocusPolicy(Qt::NoFocus);  \/\/\u8fd9\u6837\u53ef\u7981\u7528tab\u952e\u548c\u4e0a\u4e0b\u65b9\u5411\u952e\u5e76\u4e14\u9664\u53bb\u590d\u9009\u6846\r\n    listView->setFixedHeight(320);\r\n    listView->setFont(QFont(\"\u5b8b\u4f53\", 14, QFont::DemiBold));\r\n    listView->setFixedSize(QSize(360,480));\r\n    listView->move(0,menuBar()->height());\r\n    listView->setStyleSheet(\r\n                \"{outline:0px;}\"  \/\/\u9664\u53bb\u590d\u9009\u6846\r\n                \"MainListViewItem{background:rgb(245, 245, 247); border:0px; margin:0px 0px 0px 0px;}\"\r\n                \"MainListViewItem::Item{height:40px; border:0px; padding-left:14px; color:rgba(200, 40, 40, 255);}\"\r\n                \"MainListViewItem::Item:hover{color:rgba(40, 40, 200, 255);}\"\r\n                \"MainListViewItem::Item:selected{background:rgb(230, 231, 234); color:rgba(40, 40, 200, 255); border-left:4px solid rgb(180, 0, 0);}\"\r\n                \"QListWidget::Item:selected:active{background:rgb(230, 231, 234); color:rgba(40, 40, 200, 255); border-left:4px solid rgb(180, 0, 0);}\");\r\n  \r\n    new MainListViewItem(\"\u663e\u793a\u539f\u56fe\",QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),1,listView);\r\n    new MainListViewItem(tr(\"\u50cf\u7d20\u53d6\u53cd\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),2,listView);\r\n    new MainListViewItem(tr(\"\u56fe\u50cf\u878d\u5408\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),3,listView);\r\n    new MainListViewItem(tr(\"\u8c03\u6574\u56fe\u50cf\u4eae\u5ea6\u53ca\u5bf9\u6bd4\u5ea6\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),4,listView);\r\n    new MainListViewItem(tr(\"\u7ed8\u5236\u7ebf\u3001\u77e9\u5f62\u3001\u692d\u5706\u3001\u5706\u3001\u591a\u8fb9\u5f62\u3001\u6587\u672c\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),5,listView);\r\n    new MainListViewItem(tr(\"\u5747\u503c\u6a21\u7cca\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),6,listView);\r\n    new MainListViewItem(tr(\"\u9ad8\u65af\u6a21\u7cca\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),7,listView);\r\n    new MainListViewItem(tr(\"\u4e2d\u503c\u6ee4\u6ce2\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),8,listView);\r\n    new MainListViewItem(tr(\"\u53cc\u8fb9\u6ee4\u6ce2\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),9,listView);\r\n    new MainListViewItem(tr(\"\u63d0\u53d6\u56fe\u50cf\u4e2d\u7684\u82f1\u6587\u5b57\u6bcd\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),10,listView);\r\n    new MainListViewItem(tr(\"\u5f62\u6001\u5b66\u5f00\u64cd\u4f5c\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),11,listView);\r\n    new MainListViewItem(tr(\"\u5f62\u6001\u5b66\u95ed\u64cd\u4f5c\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),12,listView);\r\n    new MainListViewItem(tr(\"\u5f62\u6001\u5b66\u68af\u5ea6\uff08\u57fa\u672c\u68af\u5ea6\uff09\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),13,listView);\r\n    new MainListViewItem(tr(\"\u9876\u5e3d\u64cd\u4f5c\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),14,listView);\r\n    new MainListViewItem(tr(\"\u9ed1\u5e3d\u64cd\u4f5c\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),15,listView);\r\n    new MainListViewItem(tr(\"\u5c0f\u6848\u4f8b\uff1a\u63d0\u53d6\u63d0\u53d6\u9879\u76ee\u4e2d\u7684\u5b57\u6bcd\u6216\u8005\u76f4\u7ebf\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),16,listView);\r\n    new MainListViewItem(tr(\"\u4e0a\u91c7\u6837\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),17,listView);\r\n    new MainListViewItem(tr(\"\u964d\u91c7\u6837\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),18,listView);\r\n    new MainListViewItem(tr(\"\u9ad8\u65af\u4e0d\u540c\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),19,listView);\r\n    new MainListViewItem(tr(\"\u4f7f\u7528\u81ea\u5b9a\u4e49\u5377\u79ef\u6838filter2D\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),20,listView);\r\n    new MainListViewItem(tr(\"\u5408\u5e76rebort\u53caSobel\u7684x\u65b9\u5411\u68af\u5ea6\u548cy\u65b9\u5411\u7684\u68af\u5ea6\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),21,listView);\r\n    new MainListViewItem(tr(\"\u586b\u5145\u56fe\u50cf\u8fb9\u7f18\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),22,listView);\r\n    new MainListViewItem(tr(\"\u4f7f\u7528Sobel\u548cScharr\u8ba1\u7b97\u56fe\u5f62\u68af\u5ea6\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),23,listView);\r\n    new MainListViewItem(tr(\"\u4f7f\u7528\u62c9\u666e\u62c9\u65af\u7b97\u5b50\u663e\u793a\u68af\u5ea6\u56fe\u50cf\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),24,listView);\r\n    new MainListViewItem(tr(\"\u8fb9\u7f18\u68c0\u6d4b\"),QIcon(\":res\/icon_main_list.png\"),QIcon(\":res\/icon_main_list.png\"),25,listView);\r\n  \r\n\/\/    connect(listView,&MainListView::itemClicked,listView,&MainListView::onMainItemClick);\r\n}\r\n\/\/\u6700\u540e\u4e00\u6b65\uff1a\u521b\u5efaListView\uff0c\u7136\u540e\u8fd0\u884c\u5c31\u884c\u4e86\r\n createListView(this);<\/pre>\n
3\u3001\u56fe\u7247\u6f14\u793a<\/strong><\/div>\n

\"\"<\/p>\n

\u5230\u6b64\u8fd9\u7bc7\u5173\u4e8eQT\u5b9e\u73b0\u5236\u4f5c\u4e00\u4e2aListView\u5217\u8868\u7684\u793a\u4f8b\u4ee3\u7801\u7684\u6587\u7ae0\u5c31\u4ecb\u7ecd\u5230\u8fd9\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6848\u4f8b\uff1a\u4f7f\u7528Qt\u5236\u4f5c\u4e00\u4e2aListView\u3002\u70b9\u51fbListView\u7684Item\u53ef\u4ee5\u7528\u4e8e\u6d4b\u8bd5OpenCV\u7684\u5404\u79cd\u6548\u679c \u81ea\u5b9a […]<\/p>\n","protected":false},"author":362,"featured_media":131719,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-265247","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/265247","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=265247"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/265247\/revisions"}],"predecessor-version":[{"id":265253,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/265247\/revisions\/265253"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/131719"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=265247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=265247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=265247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}