Skip to content

Commit

Permalink
feat: add "target" argument for DTabBar::tabDroped
Browse files Browse the repository at this point in the history
Change-Id: I58310eac5c52f14e96a7e23ca8ce756a2135b333
  • Loading branch information
zccrs committed Jan 26, 2018
1 parent e532d32 commit bcd009a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/widgets/dtabbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,15 @@ class DTabBarPrivate : public QTabBar, public DObjectPrivate

void DTabBarPrivate::startDrag(int tabIndex)
{
Qt::DropAction action = drag->exec(Qt::MoveAction, Qt::MoveAction);
Qt::DropAction action = drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction);

if (action == Qt::IgnoreAction) {
Q_EMIT q_func()->tabReleaseRequested(tabIndex);
} else if (drag->target() != this) {
Q_EMIT q_func()->tabDroped(tabIndex, action);
if (DTabBarPrivate *tbp = qobject_cast<DTabBarPrivate*>(drag->target()))
Q_EMIT q_func()->tabDroped(tabIndex, action, tbp->q_func());
else
Q_EMIT q_func()->tabDroped(tabIndex, action, drag->target());
}

drag->setProperty("_d_DTabBarPrivate_drity", true);
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dtabbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class DTabBar : public QWidget, public DObject
void tabBarDoubleClicked(int index);
void tabAddRequested();
void tabReleaseRequested(int index);
void tabDroped(int index, Qt::DropAction action);
void tabDroped(int index, Qt::DropAction action, QObject *target);

public Q_SLOTS:
void setCurrentIndex(int index);
Expand Down

0 comments on commit bcd009a

Please sign in to comment.