Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/KisNodeView.cpp
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Line(s) | 147 | { | |||
---|---|---|---|---|---|
189 | */ | 189 | */ | ||
190 | Qt::KeyboardModifiers globalModifiers = QApplication::keyboardModifiers(); | 190 | Qt::KeyboardModifiers globalModifiers = QApplication::keyboardModifiers(); | ||
191 | if (!event && globalModifiers != Qt::NoModifier) { | 191 | if (!event && globalModifiers != Qt::NoModifier) { | ||
192 | return QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows; | 192 | return QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows; | ||
193 | } | 193 | } | ||
194 | 194 | | |||
195 | return QAbstractItemView::selectionCommand(index, event); | 195 | return QAbstractItemView::selectionCommand(index, event); | ||
196 | } | 196 | } | ||
197 | | ||||
197 | QRect KisNodeView::visualRect(const QModelIndex &index) const | 198 | QRect KisNodeView::visualRect(const QModelIndex &index) const | ||
198 | { | 199 | { | ||
199 | QRect rc = QTreeView::visualRect(index); | 200 | QRect rc = QTreeView::visualRect(index); | ||
201 | if (layoutDirection() == Qt::RightToLeft) | ||||
202 | rc.setRight(width()); | ||||
203 | else | ||||
200 | rc.setLeft(0); | 204 | rc.setLeft(0); | ||
201 | return rc; | 205 | return rc; | ||
202 | } | 206 | } | ||
203 | 207 | | |||
204 | QRect KisNodeView::originalVisualRect(const QModelIndex &index) const | 208 | QRect KisNodeView::originalVisualRect(const QModelIndex &index) const | ||
205 | { | 209 | { | ||
206 | return QTreeView::visualRect(index); | 210 | return QTreeView::visualRect(index); | ||
207 | } | 211 | } | ||
208 | 212 | | |||
209 | QModelIndex KisNodeView::indexAt(const QPoint &point) const | 213 | QModelIndex KisNodeView::indexAt(const QPoint &point) const | ||
210 | { | 214 | { | ||
211 | KisNodeViewColorScheme scm; | 215 | KisNodeViewColorScheme scm; | ||
212 | 216 | | |||
213 | QModelIndex index = QTreeView::indexAt(point); | 217 | QModelIndex index = QTreeView::indexAt(point); | ||
214 | if (!index.isValid() && point.x() < scm.visibilityColumnWidth()) { | 218 | if (!index.isValid()) { | ||
215 | index = QTreeView::indexAt(point + QPoint(scm.visibilityColumnWidth(), 0)); | 219 | // Middle is a good position for both LTR and RTL layouts | ||
220 | // First reset x, then get the x in the middle | ||||
221 | index = QTreeView::indexAt(point - QPoint(point.x(), 0) + QPoint(width() / 2, 0)); | ||||
216 | } | 222 | } | ||
217 | 223 | | |||
218 | return index; | 224 | return index; | ||
219 | } | 225 | } | ||
220 | 226 | | |||
221 | bool KisNodeView::viewportEvent(QEvent *e) | 227 | bool KisNodeView::viewportEvent(QEvent *e) | ||
222 | { | 228 | { | ||
223 | if (model()) { | 229 | if (model()) { | ||
▲ Show 20 Lines • Show All 350 Lines • Show Last 20 Lines |