From: Olivier Goffart Date: Wed, 16 Oct 2019 08:29:37 +0000 (+0200) Subject: AccountSettings: limit the clickable region of the 'add folder' button X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~155 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4424eb7f07a625aae00ecac99e40e18f08049ae1;p=nextcloud-desktop.git AccountSettings: limit the clickable region of the 'add folder' button Issue #7326 --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 4a4f4d5c0..2e412e991 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -483,6 +483,16 @@ void AccountSettings::slotFolderListClicked(const QModelIndex &indx) { if (indx.data(FolderStatusDelegate::AddButton).toBool()) { // "Add Folder Sync Connection" + QTreeView *tv = _ui->_folderList; + auto pos = tv->mapFromGlobal(QCursor::pos()); + QStyleOptionViewItem opt; + opt.initFrom(tv); + auto btnRect = tv->visualRect(indx); + auto btnSize = tv->itemDelegate(indx)->sizeHint(opt, indx); + auto actual = QStyle::visualRect(opt.direction, btnRect, QRect(btnRect.topLeft(), btnSize)); + if (!actual.contains(pos)) + return; + if (indx.flags() & Qt::ItemIsEnabled) { slotAddFolder(); } else {