Mantid
Loading...
Searching...
No Matches
QtBasicNavigation.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8
10
11QModelIndex below(QModelIndex const &index) { return index.sibling(index.row() + 1, index.column()); }
12
13QModelIndex above(QModelIndex const &index) { return index.sibling(index.row() - 1, index.column()); }
14
15QModelIndex leftOf(QModelIndex const &index) { return index.sibling(index.row(), index.column() - 1); }
16
17QModelIndex rightOf(QModelIndex const &index) { return index.sibling(index.row(), index.column() + 1); }
18
19bool hasCellOnTheLeft(QModelIndex const &index) { return index.column() > 0; }
20
21bool hasCellOnTheRight(QModelIndex const &index) { return index.column() + 1 < index.model()->columnCount(); }
22
23bool hasRowAbove(QModelIndex const &index) { return index.row() > 0; }
24
25bool hasRowBelow(QModelIndex const &index) { return index.row() + 1 < index.model()->rowCount(index.parent()); }
26
27QModelIndex firstCellOnRowOf(QModelIndex const &index) { return index.sibling(index.row(), 0); }
28
29bool areOnSameRow(QModelIndex const &a, QModelIndex const &b) {
30 return a.parent() == b.parent() && a.row() == b.row() && a.model() == b.model();
31}
32} // namespace MantidQt::MantidWidgets::Batch
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
bool hasCellOnTheLeft(QModelIndex const &index)
bool hasRowAbove(QModelIndex const &index)
QModelIndex leftOf(QModelIndex const &index)
QModelIndex rightOf(QModelIndex const &index)
QModelIndex firstCellOnRowOf(QModelIndex const &index)
bool hasRowBelow(QModelIndex const &index)
QModelIndex above(QModelIndex const &index)
bool hasCellOnTheRight(QModelIndex const &index)
QModelIndex below(QModelIndex const &index)
bool areOnSameRow(QModelIndex const &a, QModelIndex const &b)