Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED]Calling new window from menu bar

    General and Desktop
    4
    6
    4621
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jaszczomb last edited by

      Hello everyone
      I'm writing a program in Qt and I've placed menu bar in it. What i want to do is call "About author" window form it. There goes my problem: How do I create new window that shows info about me?
      I know that I have to connect signal from menu button with a slot that will call new window, but I don't know how to create new window and so on.
      I'll be very grateful for any help

      PS. Sorry if it has been already answered but i didn't find anything.

      1 Reply Last reply Reply Quote 0
      • K
        koahnig last edited by

        If you are using "QMenuBar":http://doc.qt.nokia.com/4.7/qmenubar.html you could use one of the signals. With triggered for instance you can pass the signal to a method displaying the about text.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply Reply Quote 0
        • A
          andre last edited by

          A window is just a class. So, like any other class, you can create a new instance on either the stack or the heap, depending on what you want to achieve. If you subclass QDialog for your "About Author" display, I would do something like this:

          @
          //declared as slot in the header
          void showAboutAuthor()
          {
          AboutAuthorWindow aboutAuthor;
          aboutAuthor.exec();
          }
          @

          1 Reply Last reply Reply Quote 0
          • J
            jaszczomb last edited by

            Thanks a lot :)
            I'll try it and tell if something will go wrong

            EDIT
            Did You mean about something like that:
            @
            void MainWindow::aboutMe()
            {
            QDialog info(this);
            info.exec();
            }@

            1 Reply Last reply Reply Quote 0
            • T
              tobias.hunger last edited by

              I think Andre just used AboutAuthorWindow to refer to whatever class you want to use for the about author window.

              1 Reply Last reply Reply Quote 0
              • J
                jaszczomb last edited by

                Yeah, I've archived what I wanted. I've made new class like Andre said, and added another form to my project to make it look how i wanted.
                Thank you very much :]

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post