Skip to content

Instantly share code, notes, and snippets.

@symroc
Created August 10, 2020 21:55
Show Gist options
  • Save symroc/8d150e1ccc2918da5e9a5262f5fcd021 to your computer and use it in GitHub Desktop.
Save symroc/8d150e1ccc2918da5e9a5262f5fcd021 to your computer and use it in GitHub Desktop.
How To subclass QListWidgetItem
#ifndef LWI_H
#define LWI_H
#include <QListWidgetItem>
#include <QListWidget>
#include <QString>
#include "f2t.h"
class lwi : public QListWidgetItem {
public:
lwi(QListWidget* parent):QListWidgetItem(parent){}
private:
bool operator<(const QListWidgetItem &other)const {
uint self=your_customized_function(text());
uint comp=your_customized_function(other.text());
return self < comp;
}
};
#endif // LWI_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment