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