20 Commits

Author SHA1 Message Date
Nyall Dawson
a6156d9221 Layouts have a name 2017-07-18 12:42:05 +10:00
Nyall Dawson
ab79b1560c [layout] Add measurement unit handling to QgsLayout
Allows layouts to convert from various units to their
own native units

Also added a QgsLayoutContext to QgsLayout.
2017-07-18 12:42:05 +10:00
Nyall Dawson
cd380f616c Add measurement converter and dpi to layout context 2017-07-18 12:42:05 +10:00
Nyall Dawson
b2b35dd084 Add a context class for layouts
Stores information relating to the current context (such as
associated feature and layer) and rendering settings for a layout.
2017-07-18 12:42:05 +10:00
Nyall Dawson
cf488d34a4 Split layout item registry into two separate registries
Instead of relying on forward declared c++ classes from
gui in QgsLayoutItemRegistry, instead create a
QgsLayoutItemGuiRegistry which handles registration
of all the GUI specific behavior relating to layout items.

Remove all GUI related code from QgsLayoutItemRegistry.

This creates a cleaner split between core/gui code, and
given that there'll be a lot of gui specific behavior
which needs to be handled by a registry it makes sense
to keep this isolated in gui.

It also plays nicer with the sip bindings, which can't
handle forward declared gui classes in core.
2017-07-11 11:06:36 +10:00
Nyall Dawson
179c51c953 Don't auto populate QgsLayoutItemRegistry
Initially create an empty registry, allow it to be populated
at a later stage.
2017-07-11 11:06:36 +10:00
Nyall Dawson
db62a745eb Add a temporary layout item type for testing 2017-07-11 11:06:36 +10:00
Nyall Dawson
3843b5ef37 Create rubber band classes for layout views
c++ QgsLayoutItem metadata classes can directly register
a function which creates a QgsLayoutViewRubberBand for the item
subclass.

Python code cannot utilise this shortcut (due to inaccessibility
of forward declared gui classes from core Python classes), so
there's a separate gui registry utility class added for registering
prototypes for rubber bands for already registered item types.
2017-07-11 11:06:36 +10:00
Nyall Dawson
4ebea75e6a Subclass QMouseEvent to QgsLayoutViewMouseEvent
For easy access to mouse event coordinates in layout coordinate
space (and future use with snapped item coordinates)
2017-07-11 11:06:35 +10:00
Nyall Dawson
ada01d8671 Fix build warnings 2017-07-03 15:00:00 +10:00
Nyall Dawson
7972092311 Update docs, sip 2017-07-03 14:21:40 +10:00
Nyall Dawson
c228132cbb Layout designers listen out for new item types in registry and
auto create actions for adding new items of the newly registered type

This avoids hard-coding in available item types into layout UI classes,
and allows designers to handle plugin-supplied item types
2017-07-03 13:57:42 +10:00
Nyall Dawson
97e8d9cf9e Emit signal when new layout item types are added to registry 2017-07-03 13:29:23 +10:00
Nyall Dawson
d23abf955a Add registration of item types to QgsLayoutItemRegistry 2017-07-03 13:22:15 +10:00
Nyall Dawson
4f21afac0f Shell layout designer dialog 2017-07-03 12:14:56 +10:00
Nyall Dawson
18b2b5240b Add some base classes for layouts 2017-06-30 17:01:52 +10:00
Nyall Dawson
cd979d8ab0 [layout] Create a page size registry for layout
Adds a new QgsPageSize class and QgsPageSizeRegistry registry
(attached to QgsApplication), which stores and manages known
page sizes
2017-06-30 16:23:18 +10:00
Nyall Dawson
8791aacd74 Modernise some code 2017-06-26 11:17:04 +10:00
Nyall Dawson
2bc8ff322e Add missing docs 2017-06-26 11:14:58 +10:00
Nyall Dawson
6a54130f0b [layout] Add layout measurement and size classes
These classes are used for storing measurements for a layout
(QgsLayoutMeasurement), sizes for a layout (QgsLayoutSize)
and points in a layout (QgsLayoutPoint)

They support storing a measurement unit alongside a measurement
length/size. A new class QgsLayoutMeasurementConverter handles
conversion between different units, including converting to and
from pixels via a specified DPI property.
2017-06-23 18:00:17 +10:00