Ananas Library 0.9.5
aForm Class Reference

#include <aform.h>

Inheritance diagram for aForm:

Public Slots

void done (int rc)
 Deprecated.
 
void Show (bool modal=FALSE)
 
bool Close ()
 
void show ()
 Deprecated. See Show()
 
void close ()
 Deprecated.
 
void maximize (bool m)
 
QVariant Value (const QString &name)
 
QVariant DBValue (const QString &name)
 
int SetValue (const QString &name, QVariant value)
 
int SetObjValue (const QString &name, aObject *value)
 
void SetColumnReadOnly (const QString &tname, int numCol, bool ro)
 
int ColIndex (const QString &tname, const QString &colname)
 
int TabCount (const QString &tname)
 
QVariant TabValue (const QString &tname, int row, int col)
 
QVariant TabDBValue (const QString &tname, int row, int col)
 
void TabNewLine (const QString &tname)
 
void TabUpdate (const QString &tname)
 
void SetTabValue (const QString &tname, const QString &colname, int row, QVariant value)
 
void setfocus (QString fname)
 Deprecated.
 
void SetFocus ()
 
ERR_Code UpdateDB ()
 
ERR_Code update ()
 Depticated.
 
int turn_on ()
 Deprecated.
 
int turn_off ()
 Deprecated.
 
int SignIn ()
 
int SignOut ()
 
int Update ()
 
void SetReadOnly (bool status)
 
bool IsReadOnly ()
 
int GetMode ()
 
QString Propis (QString val, bool need_kopeyki=true, bool male=true, const QString &end1="рублей", const QString &end2="рубль", const QString &end3="рубля")
 
QString MoneyToText (QString amount, QString currency)
 
QString ConvertNumber2MoneyFormat (double number)
 
QString ConvertDateFromIso (const QString &ISODate)
 
QString EndOfDay (const QString &ISODate)
 
void SelectByCurrent (aObject *doc)
 
void SetCurrent (aObject *doc)
 Deprecated. See SelectByCurrent() .
 
aObjectCurrent ()
 
QWidget * Widget (QString name)
 
bool FormHasFunction (const QString functionName)
 

Signals

void selected (Q_ULLONG uid)
 
void closeForm (Q_ULLONG)
 
void changedData ()
 
void update (ANANAS_UID)
 

Public Member Functions

 aForm (QWidget *parent, aEngine *eng)
 
 aForm (QWidget *parent, aEngine *eng, Q_ULONG form_mid=0, aWidget *caller=NULL)
 
 aForm (QWidget *parent, aEngine *eng, QString oftype, QObject *aobj=NULL)
 
void init ()
 
QWidget * aParent (QWidget *widget)
 
int New ()
 
int Select (Q_ULLONG id)
 
int SelectGroup (Q_ULLONG id)
 
Q_ULLONG selectedCatId ()
 
Q_ULLONG selectedId ()
 
QVariant tabValue (const QString &tname, int row, int col, bool dbval=false)
 
void setMode (int m)
 

Public Attributes

aEngineengine
 
aDatabasedb
 
aCfgmd
 
aCfgItem mdObj
 
QWidget * parentWidget
 
bool closeAfterSelect
 
QWidget * form
 

Protected Member Functions

virtual void initWidget (QWidget *widget, aDatabase *adb)
 
virtual void initContainer (aWidget *widget, aDatabase *adb)
 
aWidgetparentContainer (QWidget *widget)
 

Detailed Description

Ananas form.

Constructor & Destructor Documentation

◆ aForm() [1/3]

aForm::aForm ( QWidget * parent,
aEngine * eng )

Base form object.

Parameters
parent
eng

References aDatabase::cfg, aEngine::db, and init().

◆ aForm() [2/3]

aForm::aForm ( QWidget * parent,
aEngine * eng,
Q_ULONG form_mid = 0,
aWidget * caller = NULL )
Parameters
parent
eng
form_mid
caller

References aEngine::db, and init().

◆ aForm() [3/3]

aForm::aForm ( QWidget * parent,
aEngine * eng,
QString oftype,
QObject * aobj = NULL )
Parameters
parent
eng
oftype
aobj

References aDatabase::cfg, aEngine::db, and init().

Member Function Documentation

◆ aParent()

QWidget * aForm::aParent ( QWidget * widget)

Return ananas contaner object for widget. Use for widget->init() function.

◆ Close

bool aForm::Close ( )
slot

Close form. Delete this pointer after close.

References aLog::print().

Referenced by close(), and Show().

◆ ColIndex

int aForm::ColIndex ( const QString & tname,
const QString & colname )
slot

Return column index in table

Parameters
tname.
tname- Table name.
colname- Column name.
Returns
Column index.

References wDBTable::getDefFields(), aLog::print(), and Widget().

◆ ConvertDateFromIso

QString aForm::ConvertDateFromIso ( const QString & ISODate)
slot

Convert date to local format.

Parameters
ISODate- date in ISO format
Returns
- date in local format

References aService::Date2Print().

◆ ConvertNumber2MoneyFormat

QString aForm::ConvertNumber2MoneyFormat ( double number)
slot

Get value of attribute

Parameters
name- Name of attribute. aDataField* aForm::getAttribute(const QString &name) { QString oname, aname; aWidget *w = mainWidget; QVariant v; aDataField *f = 0;

oname = name.section(".",0,0); aname = name.section(".",1); if ( oname.isEmpty() ) aname = oname; else { } v = w->value( aname ); f = new aDataField( this, aname ); return f; }

Sets attribute value

Not implemented

Parameters
name- Name of attribute. int aForm::setAttribute(const QString &name, aDataField *value) { return 1; }

Convert number to currensy format.

Parameters
number- number to convert
Returns
- rounded number
See also
Propis()

References aService::convertNumber2MoneyFormat().

◆ Current

aObject * aForm::Current ( )
slot

Return current data object of form.

Returns
- current data object
See also
SelectByCurrent()

◆ DBValue

QVariant aForm::DBValue ( const QString & name)
slot

Getting widgets value, inherited aWidget.

Parameters
name- Widget name. For wDBField this parameter must be name field of metadata.

Пример кода для размещения в модуле экранной формы. Экранная форма содержит одну кнопку с именем Button1. При нажатии на кнопку в окно сообщений будет выведено значение атрибута "Покупатель" редактируемого бизнес объекта.

function on_button(buttonName) // обработчик нажатия кнопки
{
if(buttonName=="Button1") // Button1 - имя кнопки, данное ей в дизайнере
{
// Получаем значение атрибута "Покупатель" редактируемого бизнес объекта
contragent = DBValue("Покупатель");
// Выводим в окно сообщений, полученное значение
StatusMessage(contragent);
}
}
QVariant DBValue(const QString &name)
Definition aform.cpp:889

References aLog::print(), and Widget().

◆ EndOfDay

QString aForm::EndOfDay ( const QString & ISODate)
slot

Date of end day.

Returns
- date

◆ GetMode

int aForm::GetMode ( )
slot

Get form mode. 0 - new, 1- edit, 2- browse

Returns
- mode

◆ init()

void aForm::init ( )

Init form, reparent central widget of form, if it needed. Evaluate script module.

References initContainer(), aLog::print(), and SetReadOnly().

Referenced by aForm(), aForm(), and aForm().

◆ initContainer()

void aForm::initContainer ( aWidget * widget,
aDatabase * adb )
protectedvirtual

Recursive init all form containers and widgets.

References aWidget::createToolBar(), aWidget::init(), initContainer(), initWidget(), and parentContainer().

Referenced by init(), and initContainer().

◆ initWidget()

void aForm::initWidget ( QWidget * widget,
aDatabase * adb )
protectedvirtual

Init container object, that not inherits from aWidget.

Referenced by initContainer().

◆ IsReadOnly

bool aForm::IsReadOnly ( )
slot

Geting form readonly flag.

Returns
true if form open in read only mode.

◆ maximize

void aForm::maximize ( bool m)
slot

Maximize window

◆ MoneyToText

QString aForm::MoneyToText ( QString amount,
QString currency )
slot

◆ New()

int aForm::New ( )
Returns

Referenced by aEngine::openForm().

◆ parentContainer()

aWidget * aForm::parentContainer ( QWidget * w)
protected
Parameters
w
Returns

Referenced by initContainer().

◆ Propis

QString aForm::Propis ( QString val,
bool need_kopeyki = true,
bool male = true,
const QString & end1 = "рублей",
const QString & end2 = "рубль",
const QString & end3 = "рубля" )
slot

Convert number to russian language text format.

Parameters
val- number to convert
need_kopeyki- wtite to output decimal part
male- male
end1- end1
end2- end2
end3- end3
Returns
- text representetion of number
See also
Propis()

References aService::number2money().

◆ Select()

int aForm::Select ( Q_ULLONG id)
Parameters
id
Returns

Referenced by aEngine::openForm().

◆ SelectByCurrent

void aForm::SelectByCurrent ( aObject * doc)
slot

References aLog::print(), and aObject::select().

Referenced by SetCurrent().

◆ SetColumnReadOnly

void aForm::SetColumnReadOnly ( const QString & tname,
int numCol,
bool ro )
slot

Setting column readonly flag. When column readonly, user can't edit value of this column.

Parameters
tname- Table name.
numCol- Column number.
ro- ‘Readonly’ flag value.

References aLog::print(), and Widget().

◆ SetCurrent

void aForm::SetCurrent ( aObject * doc)
slot

Deprecated. See SelectByCurrent() .

References SelectByCurrent().

◆ setMode()

void aForm::setMode ( int m)

Sets form mode.

See also
GetMode()

Referenced by aEngine::openForm().

◆ SetObjValue

int aForm::SetObjValue ( const QString & name,
aObject * value )
slot

Setting form widgets value of object type.

See also
SetValue(...)
Parameters
tname- Widget name.

◆ SetReadOnly

void aForm::SetReadOnly ( bool status)
slot

Seting form readonly flag. When form readonly we can't edit database fields, and make updatе action

Parameters
status- New readonly flag.

References aLog::print().

Referenced by init(), and aEngine::openForm().

◆ SetTabValue

void aForm::SetTabValue ( const QString & tname,
const QString & colname,
int row,
QVariant value )
slot

References aLog::print(), and Widget().

◆ SetValue

int aForm::SetValue ( const QString & name,
QVariant value )
slot

Setting form widgets value.

See also
aWidget::setValue()
Parameters
name- Widget name.
value- Widget value.

◆ Show

void aForm::Show ( bool modal = FALSE)
slot

Show form. Move it in left top corner of workspace. modal parameter determins is form modal or not.

References Close().

Referenced by aEngine::openForm(), and show().

◆ SignIn

int aForm::SignIn ( )
slot

Turn on document.

References aLog::print().

Referenced by turn_on().

◆ SignOut

int aForm::SignOut ( )
slot

Turn off document. Do nothing.

Referenced by turn_off().

◆ TabCount

int aForm::TabCount ( const QString & tname)
slot

Count table row.

Parameters
tname- Table name.
Returns
- Number rows of table.

References aLog::print(), and Widget().

◆ TabDBValue

QVariant aForm::TabDBValue ( const QString & tname,
int row,
int col )
slot

References tabValue().

◆ TabNewLine

void aForm::TabNewLine ( const QString & tname)
slot

References aLog::print(), and Widget().

◆ TabUpdate

void aForm::TabUpdate ( const QString & tname)
slot
Parameters
tname

References aLog::print(), and Widget().

◆ TabValue

QVariant aForm::TabValue ( const QString & tname,
int row,
int col )
slot

References tabValue().

◆ tabValue()

QVariant aForm::tabValue ( const QString & tname,
int row,
int col,
bool dbval = false )
Parameters
tname
row
col
dbval
Returns

References wDBTable::getDefIdList(), wDBTable::getFieldType(), aLog::print(), and Widget().

Referenced by TabDBValue(), and TabValue().

◆ Update

int aForm::Update ( )
slot

◆ UpdateDB

ERR_Code aForm::UpdateDB ( )
slot

Update object.

References aWidget::Update(), and update().

Referenced by update().

◆ Value

QVariant aForm::Value ( const QString & name)
slot

◆ Widget

QWidget * aForm::Widget ( QString name)
slot

do nothing.

char* aForm::formMetaObjectId(QString filename){ if (filename==""){ } return aot_doc; return ""; }

Return form widget pointer by name.

Referenced by ColIndex(), DBValue(), SetColumnReadOnly(), SetTabValue(), TabCount(), TabNewLine(), TabUpdate(), and tabValue().


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