class ScQtUtil

This Class provides some multiple used methods. More...

Definition#include <scqtutil.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

This Class provides some multiple used methods.

It is normally inherited by classes using listviews as editors, e.g.

It contains various methods, and will be splitted in the near future to several classes.

const char * chomp ( const char *src )

chomp

deletes all hanging linefeeds and returns the string.

src : source string

Returns: : the converted string

const char * convBinStrToAsciiStr ( const unsigned char *src, int lenstr )

convBinStrToAsciiStr

converts a BINARY String into an ASCII string containing the information bytewise (e.g. 0x01,0xfa,0xab).

src : source string
@p *len : the string length (return)

Returns: : the converted string

unsigned char * convAsciiStrToBinStr ( const char *src, int *lenstr )

convAsciiStrToBinStr

converts an ASCII String Line into an unsigned char string containing the binary information.

The AsciiLine is a comma separated string of bytes / substrings follwing the following rules:
0x00,x21,123
0x : hexadecimal byte, x hexadecimal, no leading : decimal byte

src : source string
@p *len : the string length (return)

Returns: : the converted string

QString & convStrToLine ( const QString &src )

convStrToLine

converts a MultiLine string containing e.g. linefeeds into one QString by replacing the linefeed through an ASCII Sequence.

This class is used to prepare e.g. comment field contents for data file storage (one line).

src : source string (MultiLineString

Returns: : the converted string (linefeed replaced)

QString & convStrToMultiLine ( const QString &src )

convStrToMultiLine

does the opposit conversion than convStrLine. The line read from e.g. a data file is converted back to a MultiLineString (shown e.g. in MultiLineEdits).

src : source string (SingleLineString

Returns: : the converted string (linefeed back in place)

QString  getWord ( const QString &linestr, int x )

getWord

returns the word at prosition x from the string. Separators are blank and tab.

linestr : the string to be searched for word x
x : the position where to grabe the word from

Returns: : the found word (or null string)

QString  getDayAndMonth ( const QString &dstr=0 )

getDayAndMonth

returns string "day.month" from the datestring. At the moment this works only for the date format dd.mm.yyyy.

dstr : the date string

Returns: : the string "dd.mm"

int  getDayFromDate ( const QString &dstr )

getDayFromDate

returns the dates day as a number (int).

dstr : the date string

Returns: : the day

int  getMonFromDate ( const QString &dstr )

getMonFromDate

returns the dates mounth as a number (int).

dstr : the date string

Returns: : the month

int  getYearFromDate ( const QString &dstr )

getYearFromDate

returns the dates year as a number (int).

dstr : the date string

Returns: : the year

void  resizeFonts ( const QString &FONTSTR=0, int FONTSIZE=10 )

resizeFonts

resizes and defines all application fonts.

FONTSTR : the font to be used
FONTSIZE : the size to be used

void  defComboBox ( QComboBox *com=0, const QString &dstr=0 )

defComboBox

defines the actual element of the combobox.

This element is set to selected.

com : the combobox
dstr : the string, which is the actual element
If null, empty or not found in the combobox, the box stay, as is.

QString  getTextFromListView ( QListView *ql, const QString &searchstr, int col )

getTextFromListView

returns the string found in column col in the listview line which contains searchstr as the first element.

The method searches in the listviews column 0 for the element which matches searchstr. If found the string from column col is returned.

ql : the listview which is searched
searchstr : the string, which must match column 0 string
col : the column to get the string from

Returns: : the found string (or a string "not found")

QString  getTextFromListViewSection ( QListView *ql, const QString §ionstr, const QString &searchstr, int col )

getTextFromListViewSection

returns the string found in column col in the listview line which contains searchstr as the first element. The line is searched only as a sibling of the section string.

The method searches in the listviews column 0 for the element which matches sectionstr. If found the searchstr is searched in the siblings. If found the string from column col is returned.

ql : the listview which is searched
sectionstr : the string, which must be found as a section (column 0)
searchstr : the string, which must match column 0 string
col : the column to get the string from

Returns: : the found string (or a string "not found")

QListViewItem * getListViewItemByText ( QListView *ql, const QString &searchstr, int col )

getListViewItemByText

returns the ListViewItem of the line which contains the string searchstring in the column col.

The method searches in the listviews column col for the element which matches searchstr. If found the ListViewItem is returned.

ql : the listview which is searched
searchstr : the string, which must match column 0 string
col : the column to get the string from

Returns: : the found ListViewItem (or 0)

QListViewItem * getListViewItemByTextSection ( QListView *ql, const QString §ionstr, const QString &searchstr, int col )

getListViewItemByTextSection

returns the ListViewItem of the line which contains the string searchstring in the column col below the parent string sectionstr.

The method searches in the listviews column 0 for the element which matches sectionstr. If found the searchstr is searched in the siblings. If found the ListViewItem is returned.

ql : the listview which is searched
sectionstr : the string, which must be found as a section (column 0)
searchstr : the string, which must match column 0 string
col : the column to get the string from

Returns: : the found ListViewItem (or 0)

 ScQtUtil ( )

ScQtUtil

 ~ScQtUtil ()

~ScQtUtil