diff --git a/src/serviceitemdelegate.cpp b/src/serviceitemdelegate.cpp index af66ce1..e514d15 100644 --- a/src/serviceitemdelegate.cpp +++ b/src/serviceitemdelegate.cpp @@ -22,7 +22,13 @@ void ServiceItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o const int column(index.column()); painter->setRenderHint(QPainter::Antialiasing); - painter->setPen(QColor("#303030")); + + if (option.state & QStyle::State_Selected) { + painter->fillRect(option.rect, QColor("#D0E8FA")); + painter->setPen(QColor("#000000")); + } else { + painter->setPen(QColor("#303030")); + } // painting each column item. if (column == 0) { diff --git a/src/serviceview.cpp b/src/serviceview.cpp index 424cb99..d95431a 100644 --- a/src/serviceview.cpp +++ b/src/serviceview.cpp @@ -8,7 +8,7 @@ ServiceView::ServiceView(QWidget *parent) : QTreeView(parent) { setEditTriggers(QAbstractItemView::NoEditTriggers); - setSelectionMode(QAbstractItemView::NoSelection); + setSelectionMode(QAbstractItemView::SingleSelection); setSelectionBehavior(QAbstractItemView::SelectRows); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);