hsqml-datamodel-0.2.0.2: HsQML (Qt5) data model.

Copyright(c) Marcin Mrotek, 2015
LicenseBSD3
Maintainermarcin.jan.mrotek@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010
Extensions
  • ScopedTypeVariables
  • ExplicitForAll

Graphics.QML.DataModel

Description

Main module. Should be enough for most uses.

Synopsis

Documentation

registerHaskellModel :: IO () Source

Register the HaskellModel in QML's type system, so it can be used in .qml documents.

setupDataModel :: forall a. (SetupColumns a, CountFields a) => IO (DataModel a) Source

Create a data model handle that can be passed to HaskellModel.

finalizeDataModel :: DataModel a -> IO () Source

Free a data model handle.

setRowCountCallback :: DataModel a -> RowCountCallback -> IO () Source

Replace the row count callback of a data model handle.

setDataCallback :: QtTable a => DataModel a -> DataCallback a -> IO () Source

Replace the data callback of a data model handle.

setHeaderDataCallback :: DataModel a -> HeaderDataCallback -> IO () Source

Replace the header data callback of a data model handle. Not used by any QML views.

data DataModel a Source

A data model handle.

delegate :: DataModel a -> HmDelegateHandle Source

Identifier of the handle.

data HmDelegateHandle Source

Identifier of a HaskellModel delegate handle.

class QtTable t where Source

A class of types with columns that can be indexed by an integer. A generic implementation is provided for all single constructor types.

Minimal complete definition

Nothing

Methods

getColumn :: Int -> t -> IO QtVariant Source

class SetupColumns t where Source

A class of types that can provide a template to setup the QT HaskellModel. A generic implementation is provided for all proxyle constructor types.

Minimal complete definition

Nothing

Methods

setupColumns :: HmDelegateHandle -> proxy t -> IO () Source

data ColumnIndexException Source

Exception thrown when QML tries to acces a column that is not available. Shouldn't really happen.

Constructors

ColumnIndexNegative Int

QML called for a negative column index.

ColumnIndexOutOfBounds Int Int

QML called for a column index that is too high.

type RowCountCallback = IO Int Source

Used by QML to query the number of rows in a model.

type DataCallback a = Int -> IO a Source

Used by QML to obtain a row at the given index.

type HeaderDataCallback = Int -> IO String Source

Used by QML to obtain the name of the column at the given index.