Skip to content

Instantly share code, notes, and snippets.

@elpaso
Last active March 12, 2018 10:51
Show Gist options
  • Save elpaso/a8c1572ae5f403c10cf963ac05cce643 to your computer and use it in GitHub Desktop.
Save elpaso/a8c1572ae5f403c10cf963ac05cce643 to your computer and use it in GitHub Desktop.
layouts-text-table

QGIS Enhancement: New Layout Widget to Populate a Text Table

Date 2018/03/12

Author Alessandro Pasotti (@elpaso), Nyall Dawson (@nyalldawson )

Contact elpaso at itopen dot it, nyall dot dawson at gmail dotcom

maintainer @elpaso, @nyalldawson

Version QGIS 3.2

Summary

Create a layout widget to populate a text table.

In layouts there's a class QgsLayoutItemTextTable - it's a subclass of the same base class used by the layout attribute table, which just fills a table with a given list-of-list of values.

It's used only by the georeferencer for making reports, and not exposed in the layout designer. This is solely because there's no interface for populating the table.

Proposed Solution

The proposed solution adds a new layout widget to populate the text table.

The widget will look pretty much the same of the current attribute table widget, but instead of reading values from a vector layer, values will be manually entered by the user in a simple table with add/remove columns/rows buttons.

A refresh button and ok/cancel will be also added.

MOCKUP GOES HERE

Affected Files

Affected files are mainly in layouts: a new abstract base class will be created to hold common functionality shared between the two (attribute and text) tables, companion widgets hierarchy will be also created.

Further developments

In addition to the simple table editor, we could eventually implement the following features:

  • import/export of table data from/to CSV (and maybe JSON too)
  • individual cell formatting (color, font, bg color etc.)
  • copy paste from a spreadsheet application
  • QGIS expressions in cells
  • table column sorting
  • undo-redo stack for table actions (useful in conjunction with sorting, formatting etc.)
  • more spreadsheet-like capabilities

Performance Implications

None

Backwards Compatibility

No issues.

Votes

(required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment