Commit 69296e5a authored by Carsten Fuhrmann's avatar Carsten Fuhrmann

fixed the blue hue and surrounding around selected items,

problem: hover died.
parent 6dcf08af
......@@ -5,6 +5,7 @@
#include <QFile>
#include <QApplication>
ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent)
: QTreeWidget(parent)
{
......@@ -13,17 +14,22 @@ ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent)
setHeaderHidden(true);
setExpandsOnDoubleClick(false);
m_delegate = new MyItemDelegate;
setItemDelegate(m_delegate);
QFile styleSheet("plugins\\qtTsOverlay\\tree.styl");
styleSheet.open(QIODevice::ReadOnly);
setStyleSheet(styleSheet.readAll());
styleSheet.close();
setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
ChannelTree::~ChannelTree()
{
delete m_delegate;
}
void ChannelTree::mousePressEvent(QMouseEvent * event)
......
......@@ -6,6 +6,8 @@
#include <QLabel>
#include <QPushButton>
#include <QIcon>
#include <QItemDelegate>
#include <QPainter>
enum TreeState {
full,
......@@ -14,6 +16,26 @@ enum TreeState {
class ChannelListWidget;
class MyItemDelegate : public QItemDelegate
{
public:
void paint(QPainter * painter, const QStyleOptionViewItem & oStyleOption, const QModelIndex & index) const
{
QStyleOptionViewItem oStyleOpt = oStyleOption;
if (oStyleOpt.state & QStyle::State_Selected) {
oStyleOpt.state ^= QStyle::State_Selected;
}
if (oStyleOpt.state & QStyle::State_HasFocus) {
oStyleOpt.state ^= QStyle::State_HasFocus;
}
// Paint
QItemDelegate::paint(painter, oStyleOpt, index);
}
};
class ChannelTree : public QTreeWidget
{
Q_OBJECT
......@@ -31,6 +53,7 @@ private:
bool doMove = false;
QPoint m_oldPosition;
QWidget *m_parent;
MyItemDelegate* m_delegate;
};
......
QTreeWidget, * {
border-style:none;
QTreeWidget {
color:rgb(255,255,255);
background-color:rgba(0,0,0,0);
selection-background-color:transparent;
}
QTreeWidget::item {
border-style:none;
QTreeWidget::item:hover {
border:none;
border-radius:5px;
color:rgb(255,255,255);
background-color:transparent
}
QTreeWidget::item:hover,QTreeWidget::item:hover:selected {
background-color:rgba(255,255,255,100);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment