#include <indexeditor.h>
Public Member Functions | |
| IndexEditor (QWidget *parent=0) | |
| ~IndexEditor () | |
| void | newIndex () |
| void | editIndex () |
Public Attributes | |
| QSqlDatabase | db |
| QString | dbName |
| QString | tableName |
| QString | indexName |
| bool | isNew |
Definition at line 10 of file indexeditor.h.
| IndexEditor::IndexEditor | ( | QWidget * | parent = 0 ) |
[explicit] |
Definition at line 4 of file indexeditor.cpp.
:
QDialog(parent),
ui(new Ui::IndexEditor)
{
ui->setupUi(this);
}
| IndexEditor::~IndexEditor | ( | ) |
Definition at line 11 of file indexeditor.cpp.
{
delete ui;
}
| void IndexEditor::editIndex | ( | ) |
Definition at line 41 of file indexeditor.cpp.
References db, dbName, indexName, isNew, and tableName.
{
loadColumns();
isNew = false;
ui->txtIndexName->setReadOnly(true);
QTreeWidgetItem *par = ui->lstColumns->invisibleRootItem();
for (int i = 0; i < par->childCount(); i++) {
QTreeWidgetItem *it = par->child(i);
QSqlQuery qu(db);
if (qu.exec(tr("show keys from `%1`.`%2`").arg(dbName, tableName))) {
while (qu.next()) {
QSqlRecord rec = qu.record();
if (rec.value("Key_name") == indexName && rec.value("Column_name") == it->text(0)) {
it->setCheckState(0, Qt::Checked);
}
}
}
}
}
| void IndexEditor::newIndex | ( | ) |
Definition at line 35 of file indexeditor.cpp.
References isNew.
{
loadColumns();
isNew = true;
ui->txtIndexName->setText("New Index");
}
| QSqlDatabase IndexEditor::db |
Definition at line 20 of file indexeditor.h.
Referenced by editIndex().
| QString IndexEditor::dbName |
Definition at line 21 of file indexeditor.h.
Referenced by editIndex().
| QString IndexEditor::indexName |
Definition at line 23 of file indexeditor.h.
Referenced by editIndex().
| bool IndexEditor::isNew |
Definition at line 24 of file indexeditor.h.
Referenced by editIndex(), and newIndex().
| QString IndexEditor::tableName |
Definition at line 22 of file indexeditor.h.
Referenced by editIndex().
1.7.2