1 #include "attributedialog.h"
3 #include "attributewidget.h"
5 #include <QtGui/QApplication>
6 #include <QtGui/QButtonGroup>
8 AttributeDialog::AttributeDialog (QWidget *parent):QDialog (parent)
10 if (this->objectName().isEmpty())
11 this->setObjectName(QString::fromUtf8("AttributeDialog"));
13 size = size.expandedTo(this->minimumSizeHint());
15 QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
16 sizePolicy.setHorizontalStretch(0);
17 sizePolicy.setVerticalStretch(0);
18 sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
19 this->setSizePolicy(sizePolicy);
21 vboxLayout = new QVBoxLayout(this);
22 vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
24 tableLayout = new QVBoxLayout();
25 tableLayout->setObjectName(QString::fromUtf8("tableLayout"));
27 hboxLayout = new QHBoxLayout();
28 hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
29 addButton = new QPushButton(this);
30 addButton->setObjectName(QString::fromUtf8("addButton"));
32 hboxLayout->addWidget(addButton);
34 spacerItem = new QSpacerItem(111, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
36 hboxLayout->addItem(spacerItem);
38 closeButton = new QPushButton(this);
39 closeButton->setObjectName(QString::fromUtf8("closeButton"));
41 hboxLayout->addWidget(closeButton);
43 vboxLayout->addLayout(tableLayout);
44 vboxLayout->addLayout(hboxLayout);
48 setWindowTitle(QApplication::translate("AttributeDialog", "Attributes", 0, QApplication::UnicodeUTF8));
49 addButton->setText(QApplication::translate("AttributeDialog", "Add key", 0, QApplication::UnicodeUTF8));
50 closeButton->setText(QApplication::translate("AttributeDialog", "Close", 0, QApplication::UnicodeUTF8));
52 connect (addButton, SIGNAL (clicked()), this, SLOT (addKey()));
53 connect (closeButton, SIGNAL (clicked()), this, SLOT (accept()));
58 void AttributeDialog::setTable (AttributeTable *t)
64 void AttributeDialog::setBranch (BranchObj *bo)
70 void AttributeDialog::addKey()
72 AttributeWidget *aw1=new AttributeWidget (this);
74 tableLayout->addWidget (aw1);
78 void AttributeDialog::closeEvent( QCloseEvent* ce )
80 ce->accept(); // can be reopened with show()
82 emit (windowClosed() );
86 void AttributeDialog::updateTable()
90 // Update list of keys and values
91 QStringList keyList=table->getKeys();
94 for (i=0; i<keyList.count();i++)
96 aw=new AttributeWidget (this);
97 aw->setKey (keyList.at(i) );
98 aw->setValues (table->getValues (keyList.at(i) ));
100 tableLayout->addWidget (aw);
103 // Update attributes in dialog from data in selected branch