qdataFrameModel
function creates a
DataFrameModel
, an implementation of
QAbstractItemModel
using a data.frame
. This makes it
easy and fast to display and edit a data.frame
in a
QTableView
or any other derivative of
QAbstractItemView
. The qdataFrame
and
qdataFrame<-
functions allow one to get and set the
data.frame
underlying the model after construction.qdataFrameModel(df, parent=NULL, useRoles=FALSE,
editable=character(), ...)
qdataFrame(model) <- value
qdataFrame(model)
data.frame
that provides the data of the modelqdataFrame<-
,
which actually loads the data.frame
into the model.DataFrameModel
instanceQObject
data.frame
that should be editabledata.frame
that provides the data of the modelqdataFrameModel
: An instance of C++ DataFrameModel
editable
qdataFrameModel
: While a simple data.frame can be displayed as a textual table,
fancier tables require multiple data columns mapped to a single
model column, each playing a separate 'role'. To specify
additional roles, pass useRoles = TRUE
. A role may be any
string; those used by Qt are listed in the Qt::ItemDataRole
enumeration. The display
and edit
roles are reserved
(see below). See the documentation of the
QStyledItemDelegate
class for its expected data types for
each role.A simple way to encode this is in the column name, syntax:
[.headerName1][.headerName2][.etc].role
.
Examples:
.carColor.background
(background color for carColor column).foreground
(foreground color for all columns).firstName.lastName.font
(special font for first and last
name columns)