Results 1 to 6 of 6

Thread: Ignoring "editingFinished" when closing application

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Ignoring "editingFinished" when closing application

    Hi,

    I have an application that contains a QLineEdit and a slot that recives "editingFinished" from this QLineEdit.
    When closing the application using "X" button, the signal is emmited and the slot is called. In this case I want to ignore this signal. Is it possible?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Ignoring "editingFinished" when closing application

    Hi,

    I don't exactly know if it will work, but try
    Qt Code:
    1. //main.cpp
    2. ..
    3. QApplication a(argc, argv);
    4. ...
    5. a.connect(&a, SIGNAL(lastWindowClosed()), yourMainClass, SLOT(yourQuitSlot()));
    6. ...
    To copy to clipboard, switch view to plain text mode 

    and look if you can disconnect the connection from your QLineEdit bevor "editingFinished" is emitted.


    Lykurg

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Ignoring "editingFinished" when closing application

    Hi,

    Don't think would work because the focus of QLineEdit is lost(producing editFinished) before the close signal is emmited.

    Thanks,
    Òscar Llarch i Galán

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Ignoring "editingFinished" when closing application

    Override closeEvent() of the window and call QObject::blockSignals(true) on the line edit.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Ignoring "editingFinished" when closing application

    Hi,

    Thanks, works perfectly.
    Òscar Llarch i Galán

  6. #6
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Ignoring "editingFinished" when closing application

    Hi,

    I have another problem:
    When I change the application using the mouse or Alt+Tab:
    The QLineEdit let's me introduce a code. This code is used as index to get information from a QList. If I have no text on the QLineEdit and change the application, the QLineEdit emits a finishEdit signal that tries to index the QList, and as it don't find the code, I make a QMessageBox that show that the "Code introduced" is not valid. This QMessageBox is showed many times until the application hangs.

    I use this approach because I want a step by step application(without QWizard), that the first step is to get the information indexed by the code introduced.

    Thanks,
    Òscar Llarch i Galán

Similar Threads

  1. QSkinWindows Classes
    By kernel_panic in forum Qt-based Software
    Replies: 45
    Last Post: 20th April 2010, 13:35
  2. application freezes without crashing (and closing)
    By nass in forum Qt Programming
    Replies: 15
    Last Post: 25th September 2007, 12:21
  3. dll + application
    By fpujol in forum Qt Programming
    Replies: 11
    Last Post: 15th April 2007, 19:37
  4. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 06:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.