Description Usage Arguments Details Value Note Author(s)
The 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.
1 2 3 4 | qdataFrameModel(df, parent=NULL, useRoles=FALSE,
editable=character(), ...)
qdataFrame(model) <- value
qdataFrame(model)
|
df |
The |
... |
Extra arguments passed to |
model |
|
parent |
The parent |
useRoles |
Whether to interpret column names as indicating alternative roles; see details. |
editable |
Character vector of column names in the
|
value |
A |
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)
The set of model columns is derived from the unique header names.
Display-role columns are those not prefixed by a period. If the
column name in the data matches a string in the editable
argument, the data is used for both the edit and display roles.
qdataFrameModel
: An instance of C++ DataFrameModel
Calling the headerData
method on
DataFrameModel
from R will not yield the expected result,
because Smoke does not know of DataFrameModel and thus misses the
override of the non-pure virtual. We can special case this if
need-be.
Michael Lawrence
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.