MyListWidgetItem.h
#ifndef MYLISTWIDGETITEM_H
#define MYLISTWIDGETITEM_H
#include <QListWidgetItem>
#include<QString>
#include <QListWidget>
#include <QIcon>
class MyListWidgetItem:public QListWidgetItem//自定义控件
{
public:
MyListWidgetItem(QIcon icon,QString string);
~MyListWidgetItem();
void setIndex(int ind);
int getIndex();
signals:
void itemClicked(MyListWidgetItem*);
private:
int index;
//QListWidgetItem *item;
};
#endif
MyListWidgetItem.cpp
#include "MyListWidgetItem.h"
MyListWidgetItem::MyListWidgetItem(QIcon icon, QString string): QListWidgetItem(icon, string