00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <QStringList>
00021
00022 #include "DeptItem.h"
00023
00024 DeptItem::DeptItem(Department * DeptObj, RootItem *parent, int cc)
00025 :RootItem(parent, cc)
00026 {
00027 RTTI = DEPT_ITEM;
00028 itemData = DeptObj;
00029 setColumnOrder(2, COL_NAME, COL_ABBREV);
00030 GUIPref * pref = GUIPref::Instance();
00031 setTextColour(2
00032 ,pref->getColour(GUIPref::CT_DEPARTMENT_TEXT,0)
00033 ,pref->getColour(GUIPref::CT_DEPARTMENT_TEXT,1));
00034 setBGColour(2
00035 ,pref->getColour(GUIPref::CT_DEPARTMENT_BG,0)
00036 ,pref->getColour(GUIPref::CT_DEPARTMENT_BG,1));
00037 }
00038
00039 DeptItem::DeptItem(DeptItem & di)
00040 :RootItem(di)
00041 {
00042 setColumnOrder(2, COL_NAME, COL_ABBREV);
00043 GUIPref * pref = GUIPref::Instance();
00044 setTextColour(2
00045 ,pref->getColour(GUIPref::CT_DEPARTMENT_TEXT,0)
00046 ,pref->getColour(GUIPref::CT_DEPARTMENT_TEXT,1));
00047 setBGColour(2
00048 ,pref->getColour(GUIPref::CT_DEPARTMENT_BG,0)
00049 ,pref->getColour(GUIPref::CT_DEPARTMENT_BG,1));
00050 }
00051
00052 QVariant DeptItem::data(int column) const
00053 {
00054 if (column >= columnCount())
00055 return "";
00056 switch ((Columns)(col_order[column]))
00057 {
00058 case COL_NAME:
00059 return getDeptName();
00060 case COL_ABBREV:
00061 return getDeptAbbrev();
00062 case COL_FACULTY:
00063 return getFacName();
00064 case COL_INSTITUTE:
00065 return getInstName();
00066 }
00067 return "";
00068 }
00069
00070 bool DeptItem::setData(int column, const QVariant & value)
00071 {
00072 if (column >= columnCount())
00073 return false;
00074 switch ((Columns)(col_order[column]))
00075 {
00076 case COL_NAME:
00077 return setDeptName(value.toString());
00078 case COL_ABBREV:
00079 return setDeptAbbrev(value.toString());
00080 default:
00081 return false;
00082 }
00083 }