2020-03-07 19:47:00 +01:00
|
|
|
|
#pragma once
|
2017-07-13 02:59:01 +02:00
|
|
|
|
|
|
|
|
|
|
#include <QTableWidget>
|
|
|
|
|
|
#include <QMouseEvent>
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
class used in order to get deselection
|
|
|
|
|
|
if you know a simpler way, tell @Megamouse
|
|
|
|
|
|
*/
|
2017-09-05 22:16:22 +02:00
|
|
|
|
class game_list : public QTableWidget
|
|
|
|
|
|
{
|
2017-07-13 02:59:01 +02:00
|
|
|
|
private:
|
2018-03-02 15:40:29 -06:00
|
|
|
|
void mousePressEvent(QMouseEvent *event) override
|
2017-07-13 02:59:01 +02:00
|
|
|
|
{
|
2017-10-05 04:22:02 +02:00
|
|
|
|
if (!indexAt(event->pos()).isValid() || itemAt(event->pos())->data(Qt::UserRole) < 0)
|
2017-07-13 02:59:01 +02:00
|
|
|
|
{
|
|
|
|
|
|
clearSelection();
|
2020-03-07 02:04:11 +01:00
|
|
|
|
setCurrentItem(nullptr); // Needed for currentItemChanged
|
2017-07-13 02:59:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
QTableWidget::mousePressEvent(event);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|