Results 1 to 2 of 2

Thread: Accessing Menubar in the sourcecode.

  1. #1
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Accessing Menubar in the sourcecode.

    Hi,

    In my app, I have a menubar already created int he UI file. But when I try to write Signal Slot for the menubar actions, i can't find them unlike for other widgets with
    ui->label
    . I have two actions "Fileload" and "Exit". I want to access them into the code like

    Qt Code:
    1. connect(ui->menuBar->Fileload, SIGNAL(triggered()), this, SLOT(callthefunction));
    To copy to clipboard, switch view to plain text mode 

    Please tell me how can I do this.

    Thank You,
    Baluk

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Accessing Menubar in the sourcecode.

    You will have action objects for the actions:
    ui->actionFileLoad or similar.
    Designer already associated the action with your menus.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    baluk (19th November 2010)

Similar Threads

  1. [QT] MenuBar
    By iVo1d in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2010, 13:14
  2. Erase menubar
    By lixo1 in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2009, 16:04
  3. Bar on menubar?
    By zgulser in forum Qt Tools
    Replies: 6
    Last Post: 14th January 2009, 08:07
  4. menuBar() Problem
    By Cutey in forum Qt Programming
    Replies: 9
    Last Post: 25th January 2007, 11:50
  5. Using the menubar
    By Steve in forum Newbie
    Replies: 10
    Last Post: 27th February 2006, 15:59

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.