MCPcopy Create free account
hub / github.com/NetHack/NetHack / findRawCol

Method findRawCol

outdated/win/Qt3/qt3tableview.cpp:1622–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1620
1621
1622int QtTableView::findRawCol( int xPos, int *cellMaxX, int *cellMinX ,
1623 bool goOutsideView ) const
1624{
1625 int c = -1;
1626 if ( nCols == 0 )
1627 return c;
1628 if ( goOutsideView || xPos >= minViewX() && xPos <= maxViewX() ) {
1629 if ( xPos < minViewX() ) {
1630#if defined(QT_CHECK_RANGE)
1631 qWarning( "QtTableView::findRawCol: (%s) internal error: "
1632 "xPos < minViewX() && goOutsideView "
1633 "not supported. (%d,%d)",
1634 name( "unnamed" ), xPos, xOffs );
1635#endif
1636 return -1;
1637 }
1638 if ( cellW ) { // uniform cell width
1639 c = (xPos - minViewX() + xCellDelta)/cellW; //cell offs from left
1640 if ( cellMaxX )
1641 *cellMaxX = (c + 1)*cellW + minViewX() - xCellDelta - 1;
1642 if ( cellMinX )
1643 *cellMinX = c*cellW + minViewX() - xCellDelta;
1644 c += xCellOffs; // absolute cell index
1645 } else { // variable cell width
1646 QtTableView *tw = (QtTableView *)this;
1647 c = xCellOffs;
1648 int w = minViewX() - xCellDelta; //##arnt3
1649 int oldW = w;
1650 Q_ASSERT( c < nCols );
1651 while ( c < nCols ) {
1652 oldW = w;
1653 w += tw->cellWidth( c ); // Start of next cell
1654 if ( xPos < w )
1655 break;
1656 c++;
1657 }
1658 if ( cellMaxX )
1659 *cellMaxX = w - 1;
1660 if ( cellMinX )
1661 *cellMinX = oldW;
1662 }
1663 }
1664 return c;
1665}
1666
1667
1668/*!

Callers

nothing calls this directly

Calls 1

cellWidthMethod · 0.45

Tested by

no test coverage detected