summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Trellis/QtDNDTabBar.h')
-rw-r--r--Swift/QtUI/Trellis/QtDNDTabBar.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.h b/Swift/QtUI/Trellis/QtDNDTabBar.h
new file mode 100644
index 0000000..6de04d5
--- /dev/null
+++ b/Swift/QtUI/Trellis/QtDNDTabBar.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014-2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <QTabBar>
+
+#include <Swift/QtUI/QtTabWidget.h>
+
+namespace Swift {
+
+class QtDNDTabBar : public QTabBar {
+ Q_OBJECT
+ public:
+ explicit QtDNDTabBar(QWidget* parent = nullptr);
+ virtual ~QtDNDTabBar();
+
+ int getDragIndex() const;
+ QString getDragText() const;
+ QWidget* getDragWidget() const;
+
+ virtual QSize sizeHint() const;
+
+ friend class QtTabWidget;
+ signals:
+ void onDropSucceeded();
+
+ protected:
+ virtual void dragEnterEvent(QDragEnterEvent* dragEnterEvent);
+ virtual void dropEvent(QDropEvent* dropEvent);
+ virtual bool event(QEvent* event);
+ virtual QSize tabSizeHint(int index) const;
+
+ private:
+ int defaultTabHeight;
+ int dragIndex = -1;
+ QString dragText;
+ QWidget* dragWidget = nullptr;
+};
+
+}