From dc8ddb03c174197203528b24fd7273cf4d468a63 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Wed, 31 Jan 2018 19:56:31 +0100 Subject: [PATCH] TabTreeModel: Don't allow to move pinned tabs --- src/lib/tabwidget/tabtreemodel.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/tabwidget/tabtreemodel.cpp b/src/lib/tabwidget/tabtreemodel.cpp index 02692eb5f..d697e8e5f 100644 --- a/src/lib/tabwidget/tabtreemodel.cpp +++ b/src/lib/tabwidget/tabtreemodel.cpp @@ -108,10 +108,15 @@ WebTab *TabTreeModel::tab(const QModelIndex &index) const Qt::ItemFlags TabTreeModel::flags(const QModelIndex &index) const { - if (!index.isValid()) { + TabTreeModelItem *it = item(index); + if (!it || !it->tab) { return Qt::ItemIsDropEnabled; } - return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; + Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable; + if (!it->tab->isPinned()) { + flags |= Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; + } + return flags; } QVariant TabTreeModel::data(const QModelIndex &index, int role) const