Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Calling new window from menu bar
QtWS25 Last Chance

[SOLVED]Calling new window from menu bar

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 5.0k Views
  • 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 Offline
    J Offline
    jaszczomb
    wrote on last edited by
    #1

    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
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      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
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        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
        0
        • J Offline
          J Offline
          jaszczomb
          wrote on last edited by
          #4

          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
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jaszczomb
              wrote on last edited by
              #6

              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
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved