#ifndef MYLISTWIDGET_H
#define MYLISTWIDGET_H
#include <QListWidget>
#include <QObject>

class MyListWidget : public QListWidget
{
    Q_OBJECT
public:
    MyListWidget(QWidget *parent = nullptr);
    void setUserListWidget(bool isUserListWidget);
    inline void setMaxHeight(int nMaxHeight) { m_nMaxHeight = nMaxHeight; }
    inline int maxHeight() { return m_nMaxHeight; }

protected:
    bool eventFilter(QObject *obj, QEvent *event);

private:
    //  标志位，记录前一个选中的item
    int m_lastRow = -1;
    bool m_isUserListWidget = false;
    int m_nMaxHeight = -1;
};

#endif // MYLISTWIDGET_H
