Qt 4.8
Public Functions | Public Variables | Private Functions | List of all members
QTextTableData Class Reference
Inheritance diagram for QTextTableData:
QTextFrameData QTextFrameLayoutData

Public Functions

QFixed bottomPadding (const QTextFormat &format) const
 
void calcRowPosition (int row)
 
QFixedPoint cellPosition (const QTextTableCell &cell) const
 
QRectF cellRect (const QTextTableCell &cell) const
 
QFixed cellWidth (int column, int colspan) const
 
QFixed leftPadding (const QTextFormat &format) const
 
QFixed paddingProperty (const QTextFormat &format, QTextFormat::Property property) const
 
QFixed rightPadding (const QTextFormat &format) const
 
QFixed topPadding (const QTextFormat &format) const
 
void updateTableSize ()
 
- Public Functions inherited from QTextFrameData
 QTextFrameData ()
 
- Public Functions inherited from QTextFrameLayoutData
virtual ~QTextFrameLayoutData ()
 

Public Variables

QFixed cellPadding
 
QFixed cellSpacing
 
QVector< QFixedcellVerticalOffsets
 
QMultiHash< int, QTextFrame * > childFrameMap
 
QVector< QFixedcolumnPositions
 
qreal deviceScale
 
QFixed headerHeight
 
QVector< QFixedheights
 
QVector< QFixedmaxWidths
 
QVector< QFixedminWidths
 
QVector< QFixedrowPositions
 
QVector< QFixedwidths
 
- Public Variables inherited from QTextFrameData
QFixed border
 
QFixed bottomMargin
 
QFixed contentsHeight
 
QFixed contentsWidth
 
QTextLayoutStructcurrentLayoutStruct
 
QFixed effectiveBottomMargin
 
QFixed effectiveTopMargin
 
QList< QPointer< QTextFrame > > floats
 
bool layoutDirty
 
QFixed leftMargin
 
QFixed maximumWidth
 
QFixed minimumWidth
 
QFixed oldContentsWidth
 
QFixed padding
 
QFixedPoint position
 
QFixed rightMargin
 
QFixedSize size
 
bool sizeDirty
 
QFixed topMargin
 

Private Functions

QFixedPoint cellPosition (int row, int col) const
 

Detailed Description

Definition at line 161 of file qtextdocumentlayout.cpp.

Functions

◆ bottomPadding()

QFixed QTextTableData::bottomPadding ( const QTextFormat format) const
inline

Definition at line 209 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutCell(), and QTextDocumentLayoutPrivate::layoutTable().

210  {
212  }
QFixed paddingProperty(const QTextFormat &format, QTextFormat::Property property) const

◆ calcRowPosition()

void QTextTableData::calcRowPosition ( int  row)
inline

Definition at line 185 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

186  {
187  if (row > 0)
188  rowPositions[row] = rowPositions.at(row - 1) + heights.at(row - 1) + border + cellSpacing + border;
189  }
QVector< QFixed > heights
QVector< QFixed > rowPositions
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350

◆ cellPosition() [1/2]

QFixedPoint QTextTableData::cellPosition ( const QTextTableCell cell) const
inline

Definition at line 224 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::hitTest().

225  {
226  const QTextFormat fmt = cell.format();
227  return cellPosition(cell.row(), cell.column()) + QFixedPoint(leftPadding(fmt), topPadding(fmt));
228  }
QTextCharFormat format() const
Returns the cell&#39;s character format.
Definition: qtexttable.cpp:153
int column() const
Returns the number of the column in the table that contains this cell.
Definition: qtexttable.cpp:201
The QTextFormat class provides formatting information for a QTextDocument.
Definition: qtextformat.h:129
int row() const
Returns the number of the row in the table that contains this cell.
Definition: qtexttable.cpp:184
QFixed leftPadding(const QTextFormat &format) const
QFixedPoint cellPosition(const QTextTableCell &cell) const
QFixed topPadding(const QTextFormat &format) const

◆ cellPosition() [2/2]

QFixedPoint QTextTableData::cellPosition ( int  row,
int  col 
) const
inlineprivate

Definition at line 233 of file qtextdocumentlayout.cpp.

234  { return QFixedPoint(columnPositions.at(col), rowPositions.at(row) + cellVerticalOffsets.at(col + row * widths.size())); }
QVector< QFixed > rowPositions
QVector< QFixed > columnPositions
QVector< QFixed > cellVerticalOffsets
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< QFixed > widths
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ cellRect()

QRectF QTextTableData::cellRect ( const QTextTableCell cell) const

Definition at line 273 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::drawFrame(), and QTextDocumentLayoutPrivate::hitTest().

274 {
275  const int row = cell.row();
276  const int rowSpan = cell.rowSpan();
277  const int column = cell.column();
278  const int colSpan = cell.columnSpan();
279 
280  return QRectF(columnPositions.at(column).toReal(),
281  rowPositions.at(row).toReal(),
282  (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).toReal(),
283  (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).toReal());
284 }
QVector< QFixed > heights
QVector< QFixed > rowPositions
QVector< QFixed > columnPositions
int rowSpan() const
Returns the number of rows this cell spans.
Definition: qtexttable.cpp:218
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
int column() const
Returns the number of the column in the table that contains this cell.
Definition: qtexttable.cpp:201
int row() const
Returns the number of the row in the table that contains this cell.
Definition: qtexttable.cpp:184
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
qreal toReal() const
Definition: qfixed_p.h:77
QVector< QFixed > widths
int columnSpan() const
Returns the number of columns this cell spans.
Definition: qtexttable.cpp:228
static qreal toReal(Register *reg, int type, bool *ok=0)

◆ cellWidth()

QFixed QTextTableData::cellWidth ( int  column,
int  colspan 
) const
inline

Definition at line 181 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

182  { return columnPositions.at(column + colspan - 1) + widths.at(column + colspan - 1)
183  - columnPositions.at(column); }
QVector< QFixed > columnPositions
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< QFixed > widths

◆ leftPadding()

QFixed QTextTableData::leftPadding ( const QTextFormat format) const
inline

Definition at line 214 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::drawTableCell(), and QTextDocumentLayoutPrivate::layoutTable().

215  {
217  }
QFixed paddingProperty(const QTextFormat &format, QTextFormat::Property property) const

◆ paddingProperty()

QFixed QTextTableData::paddingProperty ( const QTextFormat format,
QTextFormat::Property  property 
) const
inline

Definition at line 193 of file qtextdocumentlayout.cpp.

194  {
195  QVariant v = format.property(property);
196  if (v.isNull()) {
197  return cellPadding;
198  } else {
200  return QFixed::fromReal(v.toReal() * deviceScale);
201  }
202  }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
Definition: qvariant.cpp:3102
static QFixed fromReal(qreal r)
Definition: qfixed_p.h:70
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913
QVariant property(int propertyId) const
Returns the property specified by the given propertyId.
const char * property
Definition: qwizard.cpp:138
qreal toReal(bool *ok=0) const
Returns the variant as a qreal if the variant has type() Double , QMetaType::Float ...
Definition: qvariant.cpp:2740

◆ rightPadding()

QFixed QTextTableData::rightPadding ( const QTextFormat format) const
inline

Definition at line 219 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

220  {
222  }
QFixed paddingProperty(const QTextFormat &format, QTextFormat::Property property) const

◆ topPadding()

QFixed QTextTableData::topPadding ( const QTextFormat format) const
inline

Definition at line 204 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::drawTableCell(), QTextDocumentLayoutPrivate::layoutCell(), and QTextDocumentLayoutPrivate::layoutTable().

205  {
207  }
QFixed paddingProperty(const QTextFormat &format, QTextFormat::Property property) const

◆ updateTableSize()

void QTextTableData::updateTableSize ( )

Definition at line 261 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

262 {
265  const QFixed effectiveLeftMargin = this->leftMargin + border + padding;
266  const QFixed effectiveRightMargin = this->rightMargin + border + padding;
267  size.height = contentsHeight == -1
269  : effectiveTopMargin + contentsHeight + effectiveBottomMargin;
270  size.width = effectiveLeftMargin + contentsWidth + effectiveRightMargin;
271 }
QVector< QFixed > heights
QVector< QFixed > rowPositions
QFixed width
Definition: qfixed_p.h:207
T & last()
Returns a reference to the last item in the vector.
Definition: qvector.h:262
QFixed height
Definition: qfixed_p.h:208

Properties

◆ cellPadding

QFixed QTextTableData::cellPadding

◆ cellSpacing

QFixed QTextTableData::cellSpacing

◆ cellVerticalOffsets

QVector<QFixed> QTextTableData::cellVerticalOffsets

◆ childFrameMap

QMultiHash<int, QTextFrame *> QTextTableData::childFrameMap

◆ columnPositions

QVector<QFixed> QTextTableData::columnPositions

◆ deviceScale

qreal QTextTableData::deviceScale

Definition at line 165 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

◆ headerHeight

QFixed QTextTableData::headerHeight

◆ heights

QVector<QFixed> QTextTableData::heights

Definition at line 169 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

◆ maxWidths

QVector<QFixed> QTextTableData::maxWidths

Definition at line 167 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

◆ minWidths

QVector<QFixed> QTextTableData::minWidths

Definition at line 166 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().

◆ rowPositions

QVector<QFixed> QTextTableData::rowPositions

◆ widths

QVector<QFixed> QTextTableData::widths

Definition at line 168 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::layoutTable().


The documentation for this class was generated from the following file: