diff options
| author | Eugene Popov <[email protected]> | 2021-08-30 14:18:21 +0000 |
|---|---|---|
| committer | Nate Graham <[email protected]> | 2021-08-30 14:18:21 +0000 |
| commit | b712c9fc4631c85c469e3ff64d67f4abc9a8a542 (patch) | |
| tree | 558b2e78654ebdea7a6c993a89cc2abf4c46437a /src/dolphintabpage.h | |
| parent | 99cc976a8564cbdae63e4261fcb2292a33148dbc (diff) | |
[Split view] Reset splitter position on double click
This commit makes Dolphin to reset the position of the Split View splitter
on double-click.
BUG: 206525
FIXED-IN: 21.12
Diffstat (limited to 'src/dolphintabpage.h')
| -rw-r--r-- | src/dolphintabpage.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h index 57a0c3344..f1a784eb7 100644 --- a/src/dolphintabpage.h +++ b/src/dolphintabpage.h @@ -11,12 +11,13 @@ #include <QPointer> #include <QUrl> #include <QWidget> +#include <QSplitter> class DolphinNavigatorsWidgetAction; class DolphinViewContainer; -class QSplitter; class QVariantAnimation; class KFileItemList; +class DolphinTabPageSplitter; enum Animated { WithAnimation, @@ -185,7 +186,7 @@ private: void startExpandViewAnimation(DolphinViewContainer *expandingContainer); private: - QSplitter* m_splitter; + DolphinTabPageSplitter *m_splitter; QPointer<DolphinNavigatorsWidgetAction> m_navigatorsWidget; QPointer<DolphinViewContainer> m_primaryViewContainer; @@ -199,4 +200,34 @@ private: bool m_active; }; +class DolphinTabPageSplitterHandle : public QSplitterHandle +{ + Q_OBJECT + +public: + explicit DolphinTabPageSplitterHandle(Qt::Orientation orientation, QSplitter *parent); + +protected: + bool event(QEvent *event) override; + +private: + void resetSplitterSizes(); + + // Sometimes QSplitterHandle doesn't receive MouseButtonDblClick event. + // We can detect that MouseButtonDblClick event should have been + // received if we receive two MouseButtonRelease events in a row. + bool m_mouseReleaseWasReceived; +}; + +class DolphinTabPageSplitter : public QSplitter +{ + Q_OBJECT + +public: + explicit DolphinTabPageSplitter(Qt::Orientation orientation, QWidget *parent); + +protected: + QSplitterHandle* createHandle() override; +}; + #endif // DOLPHIN_TAB_PAGE_H |
