<commit_before>
#include <QMouseEvent>
#include <QModelIndex>
#include <QItemSelectionModel>
#include "PGTATreeView.h"

PGTATreeView::PGTATreeView(QWidget *parent) :
    QTreeView(parent)
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    setDragDropMode(QAbstractItemView::DragDrop);
    setDefaultDropAction(Qt::MoveAction);
    setDragEnabled(true);
    setDropIndicatorShown(true);
}

PGTATreeView::~PGTATreeView()
{
}

void PGTATreeView::mousePressEvent(QMouseEvent *event)
    {
        QModelIndex item = indexAt(event->pos());
        bool selected = selectionModel()->isSelected(indexAt(event->pos()));
        QTreeView::mousePressEvent(event);
        if ((item.row() == -1 && item.column() == -1) || selected)
        {
            clearSelection();<commit_msg>Fixed issue where right clicking on a track item would clear the selection.<commit_after>
#include <QMouseEvent>
#include <QModelIndex>
#include <QItemSelectionModel>
#include "PGTATreeView.h"

PGTATreeView::PGTATreeView(QWidget *parent) :
    QTreeView(parent)
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    setDragDropMode(QAbstractItemView::DragDrop);
    setDefaultDropAction(Qt::MoveAction);
    setDragEnabled(true);
    setDropIndicatorShown(true);
}

PGTATreeView::~PGTATreeView()
{
}

void PGTATreeView::mousePressEvent(QMouseEvent *event)
    {
        QModelIndex item = indexAt(event->pos());
        bool selected = selectionModel()->isSelected(indexAt(event->pos()));
        QTreeView::mousePressEvent(event);
        Qt::MouseButton button = event->button();
        if ((item.row() == -1 && item.column() == -1) || (selected && (button == Qt::LeftButton)))
        {
            clearSelection();
{'fraction_non_alphanumeric': 0.1419316843345112, 'fraction_numerical': 0.002355712603062426, 'mean_word_length': 4.534201954397394, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4209513', 'n_tokens_mistral': 534, 'n_tokens_neox': 537, 'n_words': 86}