# HG changeset patch # User Chris Cannam # Date 1213261380 0 # Node ID 2669267fb7eac687870a81e5b6937ecf74e07c4c # Parent 33c2f268c9505b6163bbdfd7f41953a55fb89f95 * sorting arbitrary columns in data editor diff -r 33c2f268c950 -r 2669267fb7ea widgets/ModelDataTableDialog.cpp --- a/widgets/ModelDataTableDialog.cpp Wed Jun 11 16:13:25 2008 +0000 +++ b/widgets/ModelDataTableDialog.cpp Thu Jun 12 09:03:00 2008 +0000 @@ -31,12 +31,18 @@ #include ModelDataTableDialog::ModelDataTableDialog(TabularModel *model, QWidget *parent) : - QDialog(parent) + QMainWindow(parent) { setWindowTitle(tr("Data Editor")); + QToolBar *toolbar = addToolBar(tr("Toolbar")); + CommandHistory::getInstance()->registerToolbar(toolbar); + + QFrame *mainFrame = new QFrame; + setCentralWidget(mainFrame); + QGridLayout *grid = new QGridLayout; - setLayout(grid); + mainFrame->setLayout(grid); QGroupBox *box = new QGroupBox; box->setTitle(tr("Layer Data")); @@ -54,8 +60,8 @@ m_tableView->verticalHeader()->hide(); // m_tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); -// m_tableView->setShowGrid(false); m_tableView->setSortingEnabled(true); + m_tableView->sortByColumn(0, Qt::AscendingOrder); m_table = new ModelDataTableModel(model); m_tableView->setModel(m_table); @@ -66,7 +72,7 @@ this, SLOT(viewPressed(const QModelIndex &))); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close); - connect(bb, SIGNAL(rejected()), this, SLOT(reject())); + connect(bb, SIGNAL(rejected()), this, SLOT(close())); grid->addWidget(bb, 2, 0); grid->setRowStretch(2, 0); diff -r 33c2f268c950 -r 2669267fb7ea widgets/ModelDataTableDialog.h --- a/widgets/ModelDataTableDialog.h Wed Jun 11 16:13:25 2008 +0000 +++ b/widgets/ModelDataTableDialog.h Thu Jun 12 09:03:00 2008 +0000 @@ -16,7 +16,7 @@ #ifndef _MODEL_DATA_TABLE_DIALOG_H_ #define _MODEL_DATA_TABLE_DIALOG_H_ -#include +#include class TabularModel; class ModelDataTableModel; @@ -24,7 +24,7 @@ class QModelIndex; class Command; -class ModelDataTableDialog : public QDialog +class ModelDataTableDialog : public QMainWindow { Q_OBJECT