File indexing completed on 2024-04-21 05:45:27
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef SINGLECLICKSELECTIONPROXYSTYLE_H 0009 #define SINGLECLICKSELECTIONPROXYSTYLE_H 0010 0011 #include <QProxyStyle> 0012 0013 namespace SelectionMode 0014 { 0015 0016 /** 0017 * @brief A simple proxy style to temporarily make single click select and not activate 0018 * 0019 * @see QProxyStyle 0020 */ 0021 class SingleClickSelectionProxyStyle : public QProxyStyle 0022 { 0023 public: 0024 inline int 0025 styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override 0026 { 0027 if (hint == QStyle::SH_ItemView_ActivateItemOnSingleClick) { 0028 return 0; 0029 } 0030 return QProxyStyle::styleHint(hint, option, widget, returnData); 0031 } 0032 }; 0033 0034 } 0035 0036 #endif // SINGLECLICKSELECTIONPROXYSTYLE_H