PDA

View Full Version : Open new window on menu action.



l0ner
19th June 2011, 20:01
Hi. I'm new here, and new to Qt.

I have app which uses sqlite database to store it's data. What I want to do is open a new window with table editor, when i select an option from menu in the main window. Honestly I don't know how to do it. I tired to create a new function in my main window which would call the editor, but this doesn't seems to work.


void MainWindow::editTableTrucchi() {
qDebug() << "Table Editor for table trucchi Evoked";
TableEditor editor("trucchi");
editor.show();
}

This funciton is called from QAction


editTableTrucchiAct = new QAction(tr("Trucchi"), this);
connect(editTableTrucchiAct, SIGNAL(triggered()), this, SLOT(editTableTrucchi()));


Like this it doesn't work.

I'd like to know how to do it properly.
You can view whole code here: http://code.google.com/p/neurohelper/source/browse/?r=3 (http://code.google.com/p/neurohelper/source/browse/?r=3#svn%2Ftrunk)

Edit: resolved it myself. Instead of calling the TableEditor like i did before it shold be called like this:



void MainWindow::editTableTrucchi() {
qDebug() << "Table Editor for table trucchi Evoked";
TableEditor *editor = new TableEditor("trucchi");
editor -> show();
}