Workspace 6.21.5
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ColumnTextFormatter Class Reference

#include <Tools/Widgets/columntextformatter.h>

Public Member Functions

 ColumnTextFormatter (QColor colourA, QColor colourB, QColor colourMissing, QBrush gradientBrush, int maxLength, int nameColumn, int columnA, int columnB, const QStringList &eltsWithAttributeNamedChildren, const QStringList &eltsWithTagNamedChildren, const QStringList &eltsWithAttributesAsChildren, int stringHighlightRole, QWidget *parentWidget)
 
void formatText (QString valueInA, QString valueInB, QMap< QTreeWidgetItem *, QPair< HighlightingTextEdit *, HighlightingTextEdit * > > &widgetItemMap, QTreeWidgetItem *newItem)
 
bool formatXmlArray (QString valueInA, QString valueInB, QString elementInA, QString elementInB, QTreeWidgetItem *newItem, int recursionLevel=0)
 
QWidget * parentWidget ()
 
void setMaxLength (int length)
 

Static Public Member Functions

static bool getAsXml (const QString &str, QString &taggedText)
 Tests a fragment of text to see if it is xml or partial xml format, if so returns it in xml format (with an outer tag set added)
 
static bool isJsonFormat (const QString &text)
 
static bool isXmlFragment (const QString &text)
 

Public Attributes

QColor colourA_
 
QColor colourB_
 
QColor colourMissing_
 
int columnA_
 
int columnB_
 
QBrush gradientBrush_
 
int maxLength_
 
int maxNumLines_
 
int nameColumn_
 
int stringHighlightRole_
 

Protected Member Functions

bool setStringHighlightData (QTreeWidgetItem &item, const QString &valueInA, const QString &valueInB)
 

Protected Attributes

QSet< QString > eltsWithAttributeNamedChildren_
 
QSet< QString > eltsWithAttributesAsChildren_
 
QSet< QString > eltsWithTagNamedChildren_
 
bool indentChildName_ {false}
 
QWidget * parentWidget_
 

Detailed Description

Colours an item containing a pair of text elements, creates child elements if the text is long

Constructor & Destructor Documentation

◆ ColumnTextFormatter()

ColumnTextFormatter ( QColor  colourA,
QColor  colourB,
QColor  colourMissing,
QBrush  gradientBrush,
int  maxLength,
int  nameColumn,
int  columnA,
int  columnB,
const QStringList eltsWithAttributeNamedChildren,
const QStringList eltsWithTagNamedChildren,
const QStringList eltsWithAttributesAsChildren,
int  stringHighlightRole,
QWidget *  parentWidget 
)
inline

Member Function Documentation

◆ formatText()

void formatText ( QString  valueInA,
QString  valueInB,
QMap< QTreeWidgetItem *, QPair< HighlightingTextEdit *, HighlightingTextEdit * > > &  widgetItemMap,
QTreeWidgetItem *  newItem 
)

Formats an array of elements where they are in xml format, creating a child widget item for each name Note: this does not automatically create further child elements if individual elements are big

Parameters
valueInAthe value in workflowA as a string
valueInBthe value in workflowB as a string
widgetItemMapmap of created widgets corresponding to witdget items, these need to be added to the parent widget
newItemThe parent item to be expanded

◆ formatXmlArray()

bool formatXmlArray ( QString  valueInA,
QString  valueInB,
QString  elementInA,
QString  elementInB,
QTreeWidgetItem *  newItem,
int  recursionLevel = 0 
)

Formats an array of elements where they are in xml format, creating a child widget item for each name Note: this does not automatically create further child elements if individual elements are big

Parameters
valueInAthe value in workflowA as a string
valueInBthe value in workflowB as a string
elementInAthe value in workflowA as an element in xml format
elementInBthe value in workflowB as an element in xml format
newItemThe parent item to be expanded
recursionLevelThe recursion level in the XML

◆ getAsXml()

bool getAsXml ( const QString &  str,
QString &  taggedText 
)
static
Parameters
strText fragment being tested
taggedTextIf it can be construed as xml, returns the original text, enclosed in a dummy xml tag set if necessary
Returns
true if the string carries a non-empty value, and is either xml or can be xml if enclosed by xml tags

◆ isJsonFormat()

bool isJsonFormat ( const QString &  text)
static

◆ isXmlFragment()

bool isXmlFragment ( const QString &  text)
static

◆ parentWidget()

QWidget * parentWidget ( )
inline

◆ setMaxLength()

void setMaxLength ( int  length)

◆ setStringHighlightData()

bool setStringHighlightData ( QTreeWidgetItem &  item,
const QString &  valueInA,
const QString &  valueInB 
)
protected

Member Data Documentation

◆ colourA_

QColor colourA_

◆ colourB_

QColor colourB_

◆ colourMissing_

QColor colourMissing_

◆ columnA_

int columnA_

◆ columnB_

int columnB_

◆ eltsWithAttributeNamedChildren_

QSet<QString> eltsWithAttributeNamedChildren_
protected

◆ eltsWithAttributesAsChildren_

QSet<QString> eltsWithAttributesAsChildren_
protected

◆ eltsWithTagNamedChildren_

QSet<QString> eltsWithTagNamedChildren_
protected

◆ gradientBrush_

QBrush gradientBrush_

◆ indentChildName_

bool indentChildName_ {false}
protected

◆ maxLength_

int maxLength_

◆ maxNumLines_

int maxNumLines_

◆ nameColumn_

int nameColumn_

◆ parentWidget_

QWidget* parentWidget_
protected

◆ stringHighlightRole_

int stringHighlightRole_