Subversion Repositories Scribus

Rev

Rev 1641 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1641 cbradney 1
/****************************************************************************
2
** ui.h extension file, included from the uic-generated form implementation.
3
**
4
** If you want to add, delete, or rename functions or slots, use
5
** Qt Designer to update this file, preserving your code.
6
**
7
** You should not define a constructor or destructor in this file.
8
** Instead, write your code in functions called init() and destroy().
9
** These will automatically be called by the form's constructor and
10
** destructor.
11
*****************************************************************************/
12
 
13
void DocumentItemAttributes::init()
14
{
15
        //blah
16
}
17
 
18
void DocumentItemAttributes::destroy()
19
{
20
        //blah2
21
}
22
 
23
 
24
void DocumentItemAttributes::setup(QMap<int, ObjectAttribute> *docItemAttrs)
25
{
26
        localAttributes=*docItemAttrs;
27
        attributesTable->setNumRows(docItemAttrs->count());
28
        for(QMap<int, ObjectAttribute>::Iterator it = docItemAttrs->begin(); it!= docItemAttrs->end(); ++it)
29
        {
30
                uint i=0;
31
                QTableItem *item = new QTableItem(attributesTable, QTableItem::WhenCurrent, it.data().name);
32
                attributesTable->setItem(it.key(), i++, item);
33
                QTableItem *item1 = new QTableItem(attributesTable, QTableItem::WhenCurrent, it.data().type);
34
                attributesTable->setItem(it.key(), i++, item1);
35
                QTableItem *item2 = new QTableItem(attributesTable, QTableItem::WhenCurrent, it.data().value);
36
                attributesTable->setItem(it.key(), i++, item2);
37
                QTableItem *item3 = new QTableItem(attributesTable, QTableItem::WhenCurrent, it.data().parameter);
38
                attributesTable->setItem(it.key(), i++, item3);
39
 
40
                attributesTable->verticalHeader()->setLabel(it.key(), QString("%1").arg(it.key()));
41
        }
42
}
43
 
44
 
45
QMap<int, ObjectAttribute> DocumentItemAttributes::getNewAttributes()
46
{
47
        return localAttributes;
48
}
49
 
50
 
51
void DocumentItemAttributes::tableItemChanged( int row, int col )
52
{
53
        if (localAttributes.contains(row))
54
        {
55
                switch (col)
56
                {
57
                        case 0:
58
                                localAttributes[row].name=attributesTable->text(row, col);
59
                                break;
60
                        case 1:
61
                                localAttributes[row].type=attributesTable->text(row, col);
62
                                break;
63
                        case 2:
64
                                localAttributes[row].value=attributesTable->text(row, col);
65
                                break;
66
                        case 3:
67
                                localAttributes[row].parameter=attributesTable->text(row, col);
68
                                break;
69
                        default:
70
                                break;
71
                }
72
        }
73
}