Important: Please read the Qt Code of Conduct -

[SOLVED]Calling new window from menu bar

  • 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.

  • If you are using "QMenuBar": you could use one of the signals. With triggered for instance you can pass the signal to a method displaying the about text.

  • 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;

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

    Did You mean about something like that:
    void MainWindow::aboutMe()
    QDialog info(this);

  • Moderators

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

  • 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 :]

Log in to reply