Qt: Minimize application from child widget

David

I have an application in Qt and whenever I want to minimize the application I use

this->showMinimized();

However this line will not work inside a child widget (other than in the child's constructor where 'parent' is available).

Other than setting up a signal and slot, is there a way to minimize the application from a child widget? I'm trying to avoid signals and slots as I'm starting to have a tons of them.

Thanks in advance!

Nejat

You can set the window state to minimized. If the parent widget of your child widget is your application main window you should call in your child widget :

this->parentWidget()->setWindowState(Qt::WindowMinimized);

It is also possible to save a pointer to the main window in the constructor of your child widget :

QWidget * myParent;

MyWidget::MyWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MyWidget)
{
    ui->setupUi(this);

    this->myParent = parent;

   ...

}

and call whenever you want to minimize the application :

this->myParent->setWindowState(Qt::WindowMinimized);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Qt: Minimize application from child widget

From Dev

pyqt - position child widget from qt designer near parent

From Dev

Qt adding child widget in resizeEvent

From Dev

A new Qt widget application will not compile

From Dev

adjust size after child widget resized in Qt

From Dev

Qt custom widget not showing child widgets

From Dev

minimize application and starts from where user left

From Dev

Minimize and Normalize winform from console application

From Dev

How to minimize an application window from command line

From Dev

Remove QGraphicsEffect from child widget

From Dev

Using theme for my Qt widget application

From Dev

Mac: Programmatically un-minimize Application A from application B

From Dev

Qt Translucent background causes child widget to be 'imprinted' in parent

From Dev

Qt viewport widget is not expanding during new child widgets addition to QBoxLayout

From Dev

Qt widget stacking child layouts on top of each other

From Dev

python call parent method from child widget

From Dev

Qt widget background differs from Linux to Windows

From Dev

populate python qt widget with items from class

From Dev

Qt5 Widget Properties from UI

From Dev

How to call parent widget function from child widget in Flutter

From Dev

Can't access a control in a widget from another widget in Qt

From Dev

How to minimize the application to system tray on close from ApplicationWindow object?

From Dev

Creating a PDF from a QT application

From Dev

Creating a PDF from a QT application

From Dev

set size text box and button in Qt Widget Application

From Dev

Minimize fullscreen application

From Dev

Minimize application android

From Dev

Minimize fullscreen application

From Dev

open an application minimize in java

Related Related

  1. 1

    Qt: Minimize application from child widget

  2. 2

    pyqt - position child widget from qt designer near parent

  3. 3

    Qt adding child widget in resizeEvent

  4. 4

    A new Qt widget application will not compile

  5. 5

    adjust size after child widget resized in Qt

  6. 6

    Qt custom widget not showing child widgets

  7. 7

    minimize application and starts from where user left

  8. 8

    Minimize and Normalize winform from console application

  9. 9

    How to minimize an application window from command line

  10. 10

    Remove QGraphicsEffect from child widget

  11. 11

    Using theme for my Qt widget application

  12. 12

    Mac: Programmatically un-minimize Application A from application B

  13. 13

    Qt Translucent background causes child widget to be 'imprinted' in parent

  14. 14

    Qt viewport widget is not expanding during new child widgets addition to QBoxLayout

  15. 15

    Qt widget stacking child layouts on top of each other

  16. 16

    python call parent method from child widget

  17. 17

    Qt widget background differs from Linux to Windows

  18. 18

    populate python qt widget with items from class

  19. 19

    Qt5 Widget Properties from UI

  20. 20

    How to call parent widget function from child widget in Flutter

  21. 21

    Can't access a control in a widget from another widget in Qt

  22. 22

    How to minimize the application to system tray on close from ApplicationWindow object?

  23. 23

    Creating a PDF from a QT application

  24. 24

    Creating a PDF from a QT application

  25. 25

    set size text box and button in Qt Widget Application

  26. 26

    Minimize fullscreen application

  27. 27

    Minimize application android

  28. 28

    Minimize fullscreen application

  29. 29

    open an application minimize in java

HotTag

Archive