@@ -322,6 +322,11 @@ class QgsComposerTableV2: QgsComposerMultiFrame
322
322
*/
323
323
virtual bool calculateMaxColumnWidths();
324
324
325
+ /** Calculates the maximum height of text shown in rows.
326
+ * @note added in QGIS 2.12
327
+ */
328
+ virtual bool calculateMaxRowHeights();
329
+
325
330
/** Returns total width of table contents.
326
331
* @returns table width
327
332
* @see totalHeight
@@ -333,37 +338,110 @@ class QgsComposerTableV2: QgsComposerMultiFrame
333
338
* @returns total height
334
339
* @see totalWidth
335
340
*/
336
- double totalHeight() const;
341
+ //not const, as needs to call calculateMaxRowHeights()
342
+ double totalHeight();
343
+
344
+ /** Calculates how many content rows would be visible within a frame of the specified
345
+ * height.
346
+ * @param frameHeight height of frame
347
+ * @param firstRow index of first row visible in frame (where 0 = first row in table)
348
+ * @param includeHeader set to true if frame would include a header row
349
+ * @param includeEmptyRows set to true to also include rows which would be empty in the returned count. For instance,
350
+ * if the frame would include all table content rows and have space left for extra rows then setting this parameter
351
+ * to true would also include a count of these extra blank rows.
352
+ * @returns number of visible content rows (excluding header row)
353
+ * @note added in QGIS 2.12
354
+ */
355
+ int rowsVisible( double frameHeight, int firstRow, bool includeHeader, bool includeEmptyRows ) const;
356
+
357
+ /** Calculates how many content rows are visible within a given frame.
358
+ * @param frameIndex index number for frame
359
+ * @param firstRow index of first row visible in frame (where 0 = first row in table)
360
+ * @param includeEmptyRows set to true to also include rows which would be empty in the returned count. For instance,
361
+ * if the frame would include all table content rows and have space left for extra rows then setting this parameter
362
+ * to true would also include a count of these extra blank rows.
363
+ * @returns number of visible content rows (excludes header rows)
364
+ * @note added in QGIS 2.12
365
+ */
366
+ int rowsVisible( int frameIndex, int firstRow, bool includeEmptyRows ) const;
367
+
368
+ /** Calculates a range of rows which should be visible in a given frame.
369
+ * @param frameIndex index number for frame
370
+ * @returns row range
371
+ * @note added in QGIS 2.12
372
+ */
373
+ QPair<int, int> rowRange( int frameIndex ) const;
374
+
375
+ /** Draws the horizontal grid lines for the table.
376
+ * @param painter destination painter for grid lines
377
+ * @param firstRow index corresponding to first row shown in frame
378
+ * @param lastRow index corresponding to last row shown in frame. If greater than the number of content rows in the
379
+ * table, then the default row height will be used for the remaining rows.
380
+ * @param drawHeaderLines set to true to include for the table header
381
+ * @see drawVerticalGridLines
382
+ * @note added in QGIS 2.12
383
+ */
384
+ void drawHorizontalGridLines( QPainter* painter, int firstRow, int lastRow, bool drawHeaderLines ) const;
385
+
386
+ /** Draws the vertical grid lines for the table.
387
+ * @param painter destination painter for grid lines
388
+ * @param maxWidthMap QMap of int to double, where the int contains the column number and the double is the
389
+ * maximum width of text present in the column.
390
+ * @param firstRow index corresponding to first row shown in frame
391
+ * @param lastRow index corresponding to last row shown in frame. If greater than the number of content rows in the
392
+ * table, then the default row height will be used for the remaining rows.
393
+ * @param hasHeader set to true if table frame includes header cells
394
+ * @param mergeCells set to true to merge table content cells
395
+ * @note not available in python bindings
396
+ * @see drawVerticalGridLines
397
+ * @see calculateMaxColumnWidths
398
+ * @note not available in python bindings
399
+ * @note added in QGIS 2.12
400
+ */
401
+ //void drawVerticalGridLines( QPainter* painter, const QMap<int, double>& maxWidthMap, int firstRow, int lastRow, bool hasHeader, bool mergeCells = false ) const;
402
+
403
+ /** Recalculates and updates the size of the table and all table frames.
404
+ */
405
+ void recalculateTableSize();
406
+
407
+ /** Checks whether a table contents contains a given row
408
+ * @param contents table contents to check
409
+ * @param row row to check for
410
+ * @returns true if contents contains rows
411
+ */
412
+ bool contentsContainsRow( const QgsComposerTableContents &contents, const QgsComposerTableRow &row ) const;
413
+
414
+ //deprecated methods
337
415
338
416
/** Calculates how many content rows are visible within a given frame
339
417
* @param frameIndex index number for frame
340
418
* @returns number of visible content rows (excludes header rows)
341
419
*/
342
- int rowsVisible( const int frameIndex ) const;
420
+ int rowsVisible( const int frameIndex ) const /Deprecated/ ;
343
421
344
422
/** Calculates how many content rows would be visible within a specified
345
423
* height.
346
424
* @param frameHeight height of frame
347
425
* @param includeHeader set to true if frame would include a header row
348
426
* @returns number of visible content rows (excluding header row)
349
427
*/
350
- int rowsVisible( const double frameHeight, const bool includeHeader ) const;
428
+ int rowsVisible( const double frameHeight, const bool includeHeader ) const /Deprecated/ ;
351
429
352
430
/** Calculates a range of rows which should be visible in a given
353
431
* frame extent.
354
432
* @param extent visible extent
355
433
* @param frameIndex index number for frame
356
434
* @returns row range
357
435
*/
358
- QPair<int, int> rowRange( const QRectF &extent, const int frameIndex ) const;
436
+ QPair<int, int> rowRange( const QRectF &extent, const int frameIndex ) const /Deprecated/ ;
359
437
360
438
/** Draws the horizontal grid lines for the table.
361
439
* @param painter destination painter for grid lines
362
440
* @param rows number of rows shown in table
363
441
* @param drawHeaderLines set to true to include for the table header
364
442
* @see drawVerticalGridLines
365
443
*/
366
- void drawHorizontalGridLines( QPainter* painter, const int rows, const bool drawHeaderLines ) const;
444
+ void drawHorizontalGridLines( QPainter* painter, const int rows, const bool drawHeaderLines ) const /Deprecated/ ;
367
445
368
446
/** Draws the vertical grid lines for the table.
369
447
* @param painter destination painter for grid lines
@@ -377,17 +455,7 @@ class QgsComposerTableV2: QgsComposerMultiFrame
377
455
* @see calculateMaxColumnWidths
378
456
* @note not available in python bindings
379
457
*/
380
- // void drawVerticalGridLines( QPainter* painter, const QMap<int, double>& maxWidthMap, const int numberRows, const bool hasHeader, const bool mergeCells = false ) const;
381
-
382
- /** Recalculates and updates the size of the table and all table frames.
383
- */
384
- void recalculateTableSize();
458
+ // void drawVerticalGridLines( QPainter* painter, const QMap<int, double>& maxWidthMap, const int numberRows, const bool hasHeader, const bool mergeCells = false ) const /Deprecated/;
385
459
386
- /** Checks whether a table contents contains a given row
387
- * @param contents table contents to check
388
- * @param row row to check for
389
- * @returns true if contents contains rows
390
- */
391
- bool contentsContainsRow( const QgsComposerTableContents &contents, const QgsComposerTableRow &row ) const;
392
460
393
461
};
0 commit comments