Qt World Summit: Register Today!

[SOLVED] shortcut to mainwindow methods

  • question 1:
    this->isMinimized(); is not minimizing the window.

    question 2:
    I would like to use a shortcut for the mainwindow method calling but i don't know how to do that.
    @MainWindow *w = new MainWindow();@
    @Mainwindow w@
    in the mainwindow.cpp file, when i run the above 2 code, the exe is not created but i do not get an error. is there a shortcut to call MainWindow.Show(); I would like to use w.show{}; instead.

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;

  • hi,

    first of all, isMinimized returns, whether the window is minimized or not, if you want to minimize it, use showMinimized.

    Second, I don't understand your question about shortcut. What exactly do you mean by that? Where should it be used?

  • just below the following code is where i would like the short cut to the mainwindow method

    so it would look like this...
    MainWindow *w = new MainWindow();@
    MainWindow w;@

    instead of typing MainWindow. all i type is w but when i type w in the mainwindow.cpp i don't get a list of methods to choose from. the exe is created but does not load up and i get no errors.

  • You are the main window. so this would reference the main window. A shortcut is something you put on the desktop :-)

    With your code you create a new MainWindow, so a second one. This is basic C++ and Object orientation.

  • thank you Gerolf. that makes since. no more desktop shortcuts for me :)

Log in to reply