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. QDialog CloseEvent
Forum Updated to NodeBB v4.3 + New Features

QDialog CloseEvent

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 612 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.
  • Ketan__Patel__0011K Offline
    Ketan__Patel__0011K Offline
    Ketan__Patel__0011
    wrote on last edited by Ketan__Patel__0011
    #1

    Hello Friends And Qt Experts

    I Want to connect close Event for my QDialog Box
    Here My Code::

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::closeEvent(QCloseEvent *event)
    {
        if(event->type() == QEvent::Close)
        {
            event->ignore();
            QMessageBox::information(this, " ", "Close Event Call");
        }
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        Dlg = new QDialog(this); /// I want to Disable Alt+F4 Key
        Dlg->installEventFilter(this);
        Dlg->setMinimumWidth(250);
        Dlg->setMaximumWidth(250);
        Dlg->setMinimumHeight(250);
        Dlg->setMaximumHeight(250);
        Dlg->show();
    }
    
    

    i want to disable Alt+F4 Key for my QDialog Box

    right now when my QDialog Box is open that time i am pressing Alt+F4 Key and my QDialog Box is closed.
    but when i try to close my MainWindow using Alt+F4 Key that time i got My Message From closeEvent Function

    Please Help me to solve this problem.
    Thanks in Advance.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      n-2204
      wrote on last edited by
      #2

      https://stackoverflow.com/questions/10369826/how-can-i-disable-alt-f4-window-closing-using-qt

      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