MainWindow::MainWindow()
{
QAction *openAction
= fileMenu
->addAction
(tr
("&Open..."));
QAction *saveAction
= fileMenu
->addAction
(tr
("&Save As..."));
QAction *quitAction
= fileMenu
->addAction
(tr
("E&xit"));
setupModel();
setupViews();
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
menuBar()->addMenu(fileMenu);
statusBar();
openFile(":/Charts/qtdata.cht");
setWindowTitle(tr("Chart"));
resize(870, 550);
}
MainWindow::MainWindow()
{
QMenu *fileMenu = new QMenu(tr("&File"), this);
QAction *openAction = fileMenu->addAction(tr("&Open..."));
openAction->setShortcuts(QKeySequence::Open);
QAction *saveAction = fileMenu->addAction(tr("&Save As..."));
saveAction->setShortcuts(QKeySequence::SaveAs);
QAction *quitAction = fileMenu->addAction(tr("E&xit"));
quitAction->setShortcuts(QKeySequence::Quit);
setupModel();
setupViews();
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect (model,SIGNAL(dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight)),this,SLOT(display(const QModelIndex & topLeft, const QModelIndex & bottomRight)));
menuBar()->addMenu(fileMenu);
statusBar();
openFile(":/Charts/qtdata.cht");
setWindowTitle(tr("Chart"));
resize(870, 550);
}
To copy to clipboard, switch view to plain text mode
I am therefore expecting the following function written by my own (and added to prive slot in MainWindow.h) will be executed once I change data in the table view:
void display(const QModelIndex & topLeft, const QModelIndex & bottomRight);
To copy to clipboard, switch view to plain text mode
Bookmarks