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. CloseEvent gives invalid use or incomplete 'struct QCloseEvent'
Forum Updated to NodeBB v4.3 + New Features

CloseEvent gives invalid use or incomplete 'struct QCloseEvent'

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 7.2k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    nackasha
    wrote on last edited by
    #1

    Hello,

    I am trying to override CloseEvent but i am getting the following error

    invalid use of incomplete type 'struct QCloseEvent'
    forward declaration of 'struct QCloseEvent'

    Here is my code:

    fullscreendial.h

    @#ifndef FULLSCREENDIAL_H
    #define FULLSCREENDIAL_H

    #include <QDialog>

    namespace Ui {
    class fullScreenDial;
    }

    class fullScreenDial : public QDialog
    {
    Q_OBJECT

    public:
    explicit fullScreenDial(QWidget *parent = 0);
    ~fullScreenDial();

    private:
    Ui::fullScreenDial *ui;

    protected:
    void closeEvent(QCloseEvent *);
    void reject();
    };

    #endif // FULLSCREENDIAL_H
    @

    fullscreendial.cpp

    @#include "fullscreendial.h"
    #include "ui_fullscreendial.h"

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

    // int x=1;
    }

    fullScreenDial::~fullScreenDial()
    {
    delete ui;
    }

    void fullScreenDial::closeEvent( QCloseEvent * event) {

             event->ignore();
     }
    

    void fullScreenDial::reject()
    {
    }
    @

    Can you please let me know what I am doing wrong ?

    Many thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      You're just missing the corresponding #include. :-)

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nackasha
        wrote on last edited by
        #3

        Thank you Peppe. I am a newbie, kindly asking, can you please elaborate. #include what ? and put where ?

        Many thanks Peppe

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nackasha
          wrote on last edited by
          #4

          Ahhhhhhhhhhh got it :) many thanks Peppe

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            @
            #include <QCloseEvent>
            @
            at the top of your implementation file should do it.

            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