4 : QTableWidget(parent),
5 m_previousColorRow(-1),
6 m_previousClickRow(-1),
7 m_backgroundColor(255, 255, 255, 0)
9 setAttribute(Qt::WA_TranslucentBackground);
13 QHeaderView *headerView = horizontalHeader();
14 headerView->setMinimumSectionSize(0);
15 headerView->setVisible(
false);
16 headerView->resizeSection(0, 20);
17 headerView->resizeSection(1, 247);
18 headerView->resizeSection(2, 45);
19 verticalHeader()->setVisible(
false);
21 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
23 setMouseTracking(
true);
30 setFrameShape(QFrame::NoFrame);
31 setEditTriggers(QAbstractItemView::NoEditTriggers);
32 setSelectionBehavior(QAbstractItemView::SelectRows);
33 setSelectionMode(QAbstractItemView::SingleSelection);
34 setFocusPolicy(Qt::NoFocus);
36 QPalette plt = palette();
37 plt.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255, 150)));
38 #if defined Q_OS_UNIX && !TTK_QT_VERSION_CHECK(5,7,0) //Fix linux selection-background-color stylesheet bug
39 plt.setBrush(QPalette::Highlight, QColor(20, 20, 20, 20));
43 connect(
this, SIGNAL(cellEntered(
int,
int)), SLOT(
itemCellEntered(
int,
int)));
44 connect(
this, SIGNAL(cellClicked(
int,
int)), SLOT(
itemCellClicked(
int,
int)));
55 for(
const QModelIndex &index : selectedIndexes())
57 rows.insert(index.row());
61 std::sort(indexs.begin(), indexs.end());
98 QTableWidget::leaveEvent(event);
104 for(
int i = 0; i < columnCount(); ++i)
106 QTableWidgetItem *it = item(row, i);
109 it->setBackground(color);