summaryrefslogtreecommitdiffstats
blob: cda1847eb9b52a004c2c7b9b868ea1e743bc7f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (c) 2010-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#include <Swift/QtUI/QtTabWidget.h>

#include <Swift/QtUI/Trellis/QtDNDTabBar.h>

namespace Swift {

QtTabWidget::QtTabWidget(QWidget* parent) : QTabWidget(parent) {

}

QtTabWidget::~QtTabWidget() {

}

QTabBar* QtTabWidget::tabBar() {
    return QTabWidget::tabBar();
}

void QtTabWidget::setTabBar(QTabBar* tabBar) {
    QTabWidget::setTabBar(tabBar);
    if (dynamic_cast<QtDNDTabBar*>(tabBar)) {
        setAcceptDrops(true);
    }
    else {
        setAcceptDrops(false);
    }
}

void QtTabWidget::dragEnterEvent(QDragEnterEvent* event) {
    QtDNDTabBar* dndTabBar = dynamic_cast<QtDNDTabBar*>(tabBar());
    if (dndTabBar) {
        dndTabBar->dragEnterEvent(event);
    }
}

void QtTabWidget::dropEvent(QDropEvent* event) {
    QtDNDTabBar* dndTabBar = dynamic_cast<QtDNDTabBar*>(tabBar());
    if (dndTabBar) {
        dndTabBar->dropEvent(event);
    }
}

}