MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / rowColToIndex

Method rowColToIndex

qcustomplot/qcustomplot.cpp:4499–4515  ·  view source on GitHub ↗

! Converts the given \a row and \a column to the linear index used by some methods of \ref QCPLayoutGrid and \ref QCPLayout. The way the cells are indexed depends on \ref setFillOrder. If it is \ref foRowsFirst, the indices increase left to right and then top to bottom. If it is \ref foColumnsFirst, the indices increase top to bottom and then left to right. For the returned index to

Source from the content-addressed store, hash-verified

4497 \see indexToRowCol
4498*/
4499int QCPLayoutGrid::rowColToIndex(int row, int column) const
4500{
4501 if (row >= 0 && row < rowCount())
4502 {
4503 if (column >= 0 && column < columnCount())
4504 {
4505 switch (mFillOrder)
4506 {
4507 case foRowsFirst: return column*rowCount() + row;
4508 case foColumnsFirst: return row*columnCount() + column;
4509 }
4510 } else
4511 qDebug() << Q_FUNC_INFO << "row index out of bounds:" << row;
4512 } else
4513 qDebug() << Q_FUNC_INFO << "column index out of bounds:" << column;
4514 return 0;
4515}
4516
4517/*!
4518 Converts the linear index to row and column indices and writes the result to \a row and \a

Callers

nothing calls this directly

Calls 2

rowCountFunction · 0.85
columnCountFunction · 0.85

Tested by

no test coverage detected