Description Details Author(s) See Also Examples
Represents an instance of a class, as a special type of
environment
. In this case, the members are methods and, for
QObject
-derivatives, properties.
The ordinary environment
API is supported, with restrictions on
assignments. Retrieve objects with $
or get
. Replacing a
method is not supported. For QObject
instances, the members
include the properties, which may be set through assignment, e.g.,
with the $<-
method.
C++ operators are also supported, with the familiar syntax. Most C++
operators have obvious R equivalents. Two exceptions are the >>
and <<
operators, which are defined as the infix functions
%>>%
and %<<%
in R.
Some classes in the Qt API are light-weight, and their instances are
usually treated as values. For some of the most prevalent of these
types, we define coercion methods to convenient R equivalents. Below,
we list the R type corresponding to each Qt type. Coercion methods are
defined for the conventional generic for the type,
e.g., as.integer
for integers. For those types with a variant
ending in F
, like QSizeF
, the F
variant yields
double values in R, while QSize
would be integer.
QRect(F)
=> matrix
QPoint(F)
=> vector
, integer
(double
)
QSize(F)
=> vector
, integer
(double
)
QPolygon(F)
=> matrix
QTransform
=> matrix
QColor
=> matrix
Michael Lawrence
RQtClass
(for constructing instances)
1 2 3 4 5 6 7 8 | widget <- Qt$QWidget()
widget$setWindowTitle("Hello World")
widget$windowTitle # access a property
widget$windowTitle <- "Hello Again"
size <- qsize(2L, 3L)
as.integer(size * 2) # operators work too
as.integer(size) * 2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.