Menu

[c54480]: / attributedialog.cpp  Maximize  Restore  History

Download this file

119 lines (89 with data), 3.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "attributedialog.h"
#include "attributewidget.h"
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
AttributeDialog::AttributeDialog (QWidget *parent):QDialog (parent)
{
if (this->objectName().isEmpty())
this->setObjectName(QString::fromUtf8("AttributeDialog"));
QSize size(468, 75);
size = size.expandedTo(this->minimumSizeHint());
this->resize(size);
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
this->setSizePolicy(sizePolicy);
vboxLayout = new QVBoxLayout(this);
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
tableLayout = new QVBoxLayout();
tableLayout->setObjectName(QString::fromUtf8("tableLayout"));
hboxLayout = new QHBoxLayout();
hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
addButton = new QPushButton(this);
addButton->setObjectName(QString::fromUtf8("addButton"));
hboxLayout->addWidget(addButton);
spacerItem = new QSpacerItem(111, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addItem(spacerItem);
closeButton = new QPushButton(this);
closeButton->setObjectName(QString::fromUtf8("closeButton"));
hboxLayout->addWidget(closeButton);
vboxLayout->addLayout(tableLayout);
vboxLayout->addLayout(hboxLayout);
setWindowTitle(QApplication::translate("AttributeDialog", "Attributes", 0, QApplication::UnicodeUTF8));
addButton->setText(QApplication::translate("AttributeDialog", "Add key", 0, QApplication::UnicodeUTF8));
closeButton->setText(QApplication::translate("AttributeDialog", "Close", 0, QApplication::UnicodeUTF8));
connect (addButton, SIGNAL (clicked()), this, SLOT (addKey()));
connect (closeButton, SIGNAL (clicked()), this, SLOT (accept()));
table=NULL;
}
void AttributeDialog::setTable (AttributeTable *t)
{
table=t;
}
void AttributeDialog::setBranch (BranchObj *bo)
{
branch=bo;
}
void AttributeDialog::setMode (const AttributeDialogMode &m)
{
mode=m;
QString title;
if (mode==Definition)
title= QApplication::translate("Attribute Dialog","AttributeDialog - Edit definitions", 0, QApplication::UnicodeUTF8);
else
title= QApplication::translate("Attribute Dialog","AttributeDialog - Edit %1", 0, QApplication::UnicodeUTF8).arg("objname");
setWindowTitle(title);
}
void AttributeDialog::updateTable()
{
if (table)
{
// Update list of keys and values
QStringList keyList=table->getKeys();
AttributeWidget *aw;
for (int i=0; i<keyList.count();i++)
{
aw=new AttributeWidget (this);
aw->setKey (keyList.at(i) );
// TODO aw->setValues (table->getValues (keyList.at(i) ));
aw->show();
tableLayout->addWidget (aw);
}
// Update attributes in dialog from data in selected branch
// TODO
}
}
void AttributeDialog::addKey()
{
AttributeWidget *aw1=new AttributeWidget (this);
aw1->show();
tableLayout->addWidget (aw1);
}
void AttributeDialog::closeEvent( QCloseEvent* ce )
{
ce->accept(); // can be reopened with show()
hide();
emit (windowClosed() );
return;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.