Public Member Functions

TableEditor Class Reference

Simple editor for edititng smartlet tables. More...

#include <tableeditor.h>

Inheritance diagram for TableEditor:
Inheritance graph
[legend]
Collaboration diagram for TableEditor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TableEditor (const QString &tableName, QWidget *parent=0)
 ~TableEditor ()

Detailed Description

Simple editor for edititng smartlet tables.

Use with caution and do not try to open it for large tables!


Constructor & Destructor Documentation

TableEditor::TableEditor ( const QString tableName,
QWidget parent = 0 
)

                                                                         : QDialog(parent)
{
    qDebug() << "TableEditor: Constructor initiated";
    setWindowTitle(tr("Cached Table"));

    model = new QSqlTableModel(this, Database::staticCon());
    model->setTable(tableName);
    model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    model->select();

    QTableView *view = new QTableView;
    view->setModel(model);
    view->resizeColumnsToContents();
    view->resizeRowsToContents();    

    submitButton = new QPushButton(tr("Submit"));
    submitButton->setDefault(true);
    addNewRecordButton = new QPushButton(tr("&Add Record"));
    revertButton = new QPushButton(tr("&Revert"));
    quitButton = new QPushButton(tr("Quit"));

    buttonBox = new QDialogButtonBox(Qt::Vertical);
    buttonBox->addButton(submitButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(addNewRecordButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(revertButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);

    connect(addNewRecordButton, SIGNAL(clicked()),this, SLOT(addNewRecord()));
    connect(submitButton, SIGNAL(clicked()), this, SLOT(submit()));
    connect(revertButton, SIGNAL(clicked()), model, SLOT(revertAll()));
    connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(view);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);
}

TableEditor::~TableEditor (  ) 

{
    qDebug() << "TableEditor: Destructor initiated";
}


The documentation for this class was generated from the following files: