This commit is contained in:
DavidXanatos 2022-07-20 09:35:07 +02:00
parent 1218f9e6b6
commit 84331eb32e
5 changed files with 15 additions and 11 deletions

View File

@ -2452,15 +2452,6 @@ void CSandMan::SetUITheme()
GetFileView()->GetTree()->setPalette(QApplication::palette());
}
// this makes the selection look a bit nicer but breaks keyboard navigation
/*QPalette p = GetBoxView()->GetTree()->palette();
p.setColor(QPalette::Highlight, QApplication::palette().color(QPalette::Highlight));
p.setColor(QPalette::HighlightedText, QApplication::palette().color(QPalette::HighlightedText));
GetBoxView()->GetTree()->setFocusPolicy(Qt::NoFocus);
GetBoxView()->GetTree()->setPalette(p);
GetFileView()->GetTree()->setFocusPolicy(Qt::NoFocus);
GetFileView()->GetTree()->setPalette(p);*/
m_DarkTheme = bDark;
CTreeItemModel::SetDarkMode(bDark);

View File

@ -384,5 +384,15 @@ protected:
CPanelWidgetEx* m_pRecoveryLog;
};
#include <QStyledItemDelegate>
class CTreeItemDelegate : public QStyledItemDelegate
{
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem opt(option);
opt.state &= ~QStyle::State_HasFocus;
QStyledItemDelegate::paint(painter, opt, index);
}
};
extern CSandMan* theGUI;

View File

@ -23,6 +23,7 @@ CFileView::CFileView(QWidget *parent)
QStyle* pStyle = QStyleFactory::create("windows");
m_pTreeView->setStyle(pStyle);
m_pTreeView->setItemDelegate(new CTreeItemDelegate());
m_pTreeView->setExpandsOnDoubleClick(false);

View File

@ -63,6 +63,7 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
QStyle* pStyle = QStyleFactory::create("windows");
m_pSbieTree->setStyle(pStyle);
m_pSbieTree->setItemDelegate(new CTreeItemDelegate());
m_pSbieTree->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pSbieTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnMenu(const QPoint &)));

View File

@ -119,10 +119,11 @@ CMonitorList::CMonitorList(QWidget* parent)
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
#ifdef WIN32
QStyle* pStyle = QStyleFactory::create("windows");
m_pTreeList->setStyle(pStyle);
#endif
m_pTreeList->setItemDelegate(new CTreeItemDelegate());
m_pTreeList->setExpandsOnDoubleClick(false);
m_pTreeList->setSortingEnabled(true);