Subversion Repositories OpenInventory

Compare Revisions

Regard whitespace Rev 67 → Rev 68

/trunk/ClassEditor/classeditor.ui
155,6 → 155,22
<height>27</height>
</rect>
</property>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>Поле</string>
</property>
<widget class="QMenu" name="menu_4">
<property name="title">
<string>Удалить поля</string>
</property>
<addaction name="action_removeAllFields"/>
<addaction name="separator"/>
<addaction name="action_removeSelectedFields"/>
</widget>
<addaction name="action_8"/>
<addaction name="separator"/>
<addaction name="menu_4"/>
</widget>
<widget class="QMenu" name="menu">
<property name="title">
<string>Класс</string>
163,9 → 179,9
<property name="title">
<string>Удалить классы</string>
</property>
<addaction name="action_3"/>
<addaction name="action_removeAllClasses"/>
<addaction name="separator"/>
<addaction name="action_4"/>
<addaction name="action_removeSelectedClasses"/>
</widget>
<addaction name="newClassAction"/>
<addaction name="separator"/>
175,22 → 191,6
<addaction name="action_showAlias"/>
<addaction name="action_showInstance"/>
</widget>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>Поле</string>
</property>
<widget class="QMenu" name="menu_4">
<property name="title">
<string>Удалить поля</string>
</property>
<addaction name="action_11"/>
<addaction name="separator"/>
<addaction name="action_13"/>
</widget>
<addaction name="action_8"/>
<addaction name="separator"/>
<addaction name="menu_4"/>
</widget>
<addaction name="menu"/>
<addaction name="menu_2"/>
</widget>
208,12 → 208,12
<string>Новый класс</string>
</property>
</action>
<action name="action_3">
<action name="action_removeAllClasses">
<property name="text">
<string>Удалить все классы</string>
</property>
</action>
<action name="action_4">
<action name="action_removeSelectedClasses">
<property name="text">
<string>Удалить выбранные классы</string>
</property>
223,12 → 223,12
<string>Новое поле</string>
</property>
</action>
<action name="action_11">
<action name="action_removeAllFields">
<property name="text">
<string>Удалить все поля</string>
</property>
</action>
<action name="action_13">
<action name="action_removeSelectedFields">
<property name="text">
<string>Удалить выделенные поля</string>
</property>
/trunk/ClassEditor/classeditor.cpp
202,10 → 202,10
// model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
////////////////////model->select();
mymodel->select();
modelForDescription->setFilter(tr("ClassIdentifer = 1"));
modelForDescription->select();
 
 
 
 
/////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
 
255,14 → 255,27
selectionModel->select(selection, QItemSelectionModel::Select);
 
 
QString class_indx;
QString str_fltr = tr("ClassIdentifer = ");
class_indx = mymodel->data(mymodel->index(0,0)).toString();
str_fltr.append(class_indx);
 
modelForDescription->setFilter(str_fltr);
modelForDescription->select();
 
 
 
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex)));
connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex)));
connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool)));
connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool)));
connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool)));
connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû
connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ
connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ
connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ
connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû
connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âûäåëåííûå êëàññû
}
 
 
382,7 → 395,7
 
 
 
 
// äîáàâëÿåì íîâûé êëàññ
void ClassEditor::on_pushButton_clicked(){
//int i;
//i++;
408,6 → 421,7
filter_str = tr("ClassIdentifer = ");
filter_str.append(tmp_str);
modelForDescription->setFilter(filter_str);
modelForDescription->select();
ui->tableView_2->resizeColumnsToContents();
i++;
}
414,12 → 428,31
 
 
 
void ClassEditor::on_pushButton_2_clicked(){
int i;
i++;
void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ"
QModelIndex model_index;
QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
QModelIndexList indexes = selectionModel->selectedIndexes();
QList<int> selectedRows;
selectedRows.clear();
foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
 
}
qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå
 
 
for (int m =0; m < selectedRows.size(); ++m){
 
ClassEditor::removeClass(selectedRows.at(m));
 
 
 
}
mymodel->submitAll();
ClassEditor::modelForDescription->select();
 
}
 
void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå"
int i;
i++;
427,6 → 460,8
ClassEditor::modelForDescription->select();
ui->tableView_2->resizeColumnsToContents();
}
 
 
void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå"
int i;
i++;
494,8 → 529,39
ui->tableView->resizeColumnsToContents();
}
 
void ClassEditor::on_action_showInstance_triggered(bool is_checked){
void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ"
if (is_checked) ui->tableView->showColumn(3);
else ui->tableView->hideColumn(3);
ui->tableView->resizeColumnsToContents();
}
 
 
 
void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû"
int row;
row = ClassEditor::mymodel->rowCount();
for (int m=0; m < row; ++m){
ClassEditor::removeClass(0);
//ClassEditor::mymodel->removeRows(0, row);
}
ClassEditor::mymodel->submitAll();
ClassEditor::modelForDescription->select();
}
 
void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row
QModelIndex index_tmp;
QString tmp_str, filter_str;
index_tmp = ui->tableView->model()->index(class_row, 0);
tmp_str = ui->tableView->model()->data(index_tmp).toString();
currClassID = tmp_str;
// ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
filter_str = tr("ClassIdentifer = ");
filter_str.append(tmp_str);
modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé
ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà
mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ
mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ
ui->tableView->resizeColumnsToContents();
ui->tableView_2->resizeColumnsToContents();
 
}
/trunk/ClassEditor/classeditor.h
58,7 → 58,8
void on_tableView_clicked(const QModelIndex & index );
void on_myModel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight );
void on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight );
 
void on_action_removeAllClasses(); // óäàëèòü âñå êëàññû
void removeClass(int class_row); // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row
};
 
#endif // CLASSEDITOR_H