QList<QRect> QwtDynGridLayout::layoutItems( const QRect &rect, uint numCols ) const { QList<QRect> itemGeometries; if ( numCols == 0 || isEmpty() ) return itemGeometries; uint numRows = itemCount() / numCols; if ( numRows % itemCount() ) numRows++; QVector<int> rowHeight( numRows ); QVector<int> colWidth( numCols ); layoutGrid( numCols, rowHeight, colWidth ); bool expandH, expandV; expandH = expandingDirections() & Qt::Horizontal; expandV = expandingDirections() & Qt::Vertical; if ( expandH || expandV ) stretchGrid( rect, numCols, rowHeight, colWidth ); const int maxCols = d_data->maxCols; d_data->maxCols = numCols; const QRect alignedRect = alignmentRect( rect ); d_data->maxCols = maxCols; const int xOffset = expandH ? 0 : alignedRect.x(); const int yOffset = expandV ? 0 : alignedRect.y(); QVector<int> colX( numCols ); QVector<int> rowY( numRows ); const int xySpace = spacing(); rowY[0] = yOffset + margin(); for ( int r = 1; r < ( int )numRows; r++ ) rowY[r] = rowY[r-1] + rowHeight[r-1] + xySpace; colX[0] = xOffset + margin(); for ( int c = 1; c < ( int )numCols; c++ ) colX[c] = colX[c-1] + colWidth[c-1] + xySpace; const int itemCount = d_data->itemList.size(); for ( int i = 0; i < itemCount; i++ ) { const int row = i / numCols; const int col = i % numCols; QRect itemGeometry( colX[col], rowY[row], colWidth[col], rowHeight[row] ); itemGeometries.append( itemGeometry ); } return itemGeometries; }
void QWellArray::paintEvent(QPaintEvent *e) { QRect r = e->rect(); int cx = r.x(); int cy = r.y(); int ch = r.height(); int cw = r.width(); int colfirst = columnAt(cx); int collast = columnAt(cx + cw); int rowfirst = rowAt(cy); int rowlast = rowAt(cy + ch); if (isRightToLeft()) { int t = colfirst; colfirst = collast; collast = t; } QPainter painter(this); QPainter *p = &painter; QRect rect(0, 0, cellWidth(), cellHeight()); if (collast < 0 || collast >= ncols) collast = ncols-1; if (rowlast < 0 || rowlast >= nrows) rowlast = nrows-1; // Go through the rows for (int r = rowfirst; r <= rowlast; ++r) { // get row position and height int rowp = rowY(r); // Go through the columns in the row r // if we know from where to where, go through [colfirst, collast], // else go through all of them for (int c = colfirst; c <= collast; ++c) { if (ncols*r+c >= ncells) return; // get position and width of column c int colp = columnX(c); // Translate painter and draw the cell rect.translate(colp, rowp); paintCell(p, r, c, rect); rect.translate(-colp, -rowp); } } }
FbxAMatrix LoaderFbxMesh::convertToLeftHanded(FbxAMatrix fbxMatrix) { FbxAMatrix convertionMatrix; FbxVector4 rowX(1.0, 0.0, 0.0, 0.0); FbxVector4 rowY(0.0, 1.0, 0.0, 0.0); FbxVector4 rowZ(0.0, 0.0, -1.0, 0.0); FbxVector4 rowW(0.0, 0.0, 0.0, 1.0); convertionMatrix.SetRow(0, rowX); convertionMatrix.SetRow(1, rowY); convertionMatrix.SetRow(2, rowZ); convertionMatrix.SetRow(3, rowW); FbxAMatrix convertedMatrix = fbxMatrix * convertionMatrix; return convertedMatrix; }