+bool DolphinDetailsView::isAboveExpandingToggle(const QPoint& pos) const
+{
+ // QTreeView offers no public API to get the information whether an index has an
+ // expanding toggle and what boundaries the toggle has. The following approach
+ // also assumes a toggle for file items.
+ if (itemsExpandable()) {
+ const QModelIndex index = QTreeView::indexAt(pos);
+ if (index.isValid() && (index.column() == KDirModel::Name)) {
+ QRect rect = nameColumnRect(index);
+ const int toggleSize = rect.height();
+ if (isRightToLeft()) {
+ rect.moveRight(rect.right());
+ } else {
+ rect.moveLeft(rect.x() - toggleSize);
+ }
+ rect.setWidth(toggleSize);
+
+ QStyleOption opt;
+ opt.initFrom(this);
+ opt.rect = rect;
+ rect = style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, this);
+
+ return rect.contains(pos);
+ }
+ }
+ return false;
+}
+