Avogadro  1.1.0
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Attributes
Avogadro::TextMatrixEditor Class Reference

Widget to edit 3x3 matrices in plain text. More...

#include <avogadro/textmatrixeditor.h>

Inheritance diagram for Avogadro::TextMatrixEditor:
Inheritance graph
[legend]

List of all members.

Public Slots

void setMatrix (const Eigen::Matrix3d &mat)
 Set the matrix. This will update the text.
void resetMatrix ()
 Reset the text to the last known good matrix.

Signals

void isInvalid ()
 Emitted when the text cannot be parsed into a matrix.
void isValid ()
 Emitted when the text has been parsed into a matrix.

Public Member Functions

 TextMatrixEditor (QWidget *parent=0)
 Constructor.
virtual ~TextMatrixEditor ()
 Destructor.
QRegExpdelimiters ()
const QRegExpdelimiters () const
Eigen::Matrix3d matrix () const

Protected Slots

bool validate ()
void markAsInvalid ()
 Turn the text red.
void markAsValid ()
 Reset the text appearance.

Protected Attributes

QTextCharFormatm_charFormat
 Stores the text properties while invalid.
QRegExpm_delimiters
 Acceptable column separators. See class definition for default.
Eigen::Matrix3d m_matrix
 Stores the current (or last known good) matrix.

Detailed Description

Widget to edit 3x3 matrices in plain text.

Author:
David C. Lonie

TextMatrixEditor is a QTextEdit that displays and allows editing of a 3x3 matrix as plain text. Input is validated with each keystroke, and the text turns red if the input is invalid. The matrix can be set/get with matrix() and setMatrix(). The delimiters used to separate columns can be set and accessed through the pointer returned by delimiters(). The default delimiter regexp is QRegExp("\\s+|,|;|\\||\[|\]|\\{|\\}|\(|\)|\\&|/|<|>"). resetMatrix() will replace the text with the last known good matrix.


Member Function Documentation

Returns:
Allowed column separators. See class definition for default.
Returns:
Allowed column separators. See class definition for default
Eigen::Matrix3d Avogadro::TextMatrixEditor::matrix ( ) const
Returns:
The current matrix

References m_matrix.

bool Avogadro::TextMatrixEditor::validate ( ) [protected, slot]

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