Results 1 to 1 of 1

Thread: Open new window on menu action.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Open new window on menu action.

    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.

    Qt Code:
    1. void MainWindow::editTableTrucchi() {
    2. qDebug() << "Table Editor for table trucchi Evoked";
    3. TableEditor editor("trucchi");
    4. editor.show();
    5. }
    To copy to clipboard, switch view to plain text mode 

    This funciton is called from QAction

    Qt Code:
    1. editTableTrucchiAct = new QAction(tr("Trucchi"), this);
    2. connect(editTableTrucchiAct, SIGNAL(triggered()), this, SLOT(editTableTrucchi()));
    To copy to clipboard, switch view to plain text mode 

    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

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

    Qt Code:
    1. void MainWindow::editTableTrucchi() {
    2. qDebug() << "Table Editor for table trucchi Evoked";
    3. TableEditor *editor = new TableEditor("trucchi");
    4. editor -> show();
    5. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by l0ner; 19th June 2011 at 20:10. Reason: resolved
    BlogBits | YouTube | Flickr | MAL | Last.fm | Web Profile
    CLI is not an UI, it's a way of life!

Similar Threads

  1. Replies: 0
    Last Post: 8th March 2011, 22:08
  2. Replies: 4
    Last Post: 16th February 2011, 15:46
  3. Replies: 2
    Last Post: 20th April 2010, 21:27
  4. Menu open action -reg
    By jsmith in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2009, 11:07
  5. Action-Menu-Button
    By hgedek in forum Newbie
    Replies: 1
    Last Post: 1st October 2007, 16:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.