Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #ifndef MUSE_DOCK_DOCKTABBAR_H
24 : #define MUSE_DOCK_DOCKTABBAR_H
25 :
26 : #include <QQuickItem>
27 :
28 : #include "kddockwidgets/src/qtquick/views/TabBar.h"
29 :
30 : namespace KDDockWidgets::Core {
31 : class TabBar;
32 : }
33 :
34 : namespace muse::dock {
35 : class DockTabBar : public KDDockWidgets::QtQuick::TabBar
36 : {
37 : Q_OBJECT
38 :
39 : public:
40 : explicit DockTabBar(KDDockWidgets::Core::TabBar* controller, QQuickItem* parent = nullptr);
41 :
42 : // The following is a hack (see PR #29794)- revisit this system when updating KDDockWidgets
43 : Q_PROPERTY(bool tabChangedOnClick READ tabChangedOnClick CONSTANT)
44 :
45 : Q_INVOKABLE void setDraggableMouseArea(QQuickItem* mouseArea);
46 : Q_INVOKABLE void doubleClicked(QPoint pos) const;
47 :
48 0 : bool tabChangedOnClick() const { return m_tabChangedOnClick; }
49 :
50 : protected:
51 : bool event(QEvent* event) override;
52 :
53 : private:
54 : void onMousePressRelease(const QMouseEvent* mouseEvent);
55 :
56 : QQuickItem* m_draggableMouseArea = nullptr;
57 : int m_indexOfPressedTab = -1;
58 :
59 : bool m_tabChangedOnClick = false;
60 : };
61 : }
62 :
63 : #endif // MUSE_DOCK_DOCKTABBAR_H
|