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)
63 void AttributeDialog::setBranch (BranchObj *bo)
68 void AttributeDialog::setMode (const AttributeDialogMode &m)
74 title= QApplication::translate("Attribute Dialog","AttributeDialog - Edit definitions", 0, QApplication::UnicodeUTF8);
76 title= QApplication::translate("Attribute Dialog","AttributeDialog - Edit %1", 0, QApplication::UnicodeUTF8).arg("objname");
77 setWindowTitle(title);
80 void AttributeDialog::updateTable()
84 // Update list of keys and values
85 QStringList keyList=table->getKeys();
87 for (int i=0; i<keyList.count();i++)
89 aw=new AttributeWidget (this);
90 aw->setKey (keyList.at(i) );
91 // FIXME aw->setValues (table->getValues (keyList.at(i) ));
93 tableLayout->addWidget (aw);
96 // Update attributes in dialog from data in selected branch
102 void AttributeDialog::addKey()
104 AttributeWidget *aw1=new AttributeWidget (this);
106 tableLayout->addWidget (aw1);
110 void AttributeDialog::closeEvent( QCloseEvent* ce )
112 ce->accept(); // can be reopened with show()
114 emit (windowClosed() );