[Interest] Calling QMainWindow::close() vs. clicking on close button in title bar

Igor Mironchik igor.mironchik at gmail.com
Wed Oct 31 20:30:34 CET 2018


Hi,

I can suggest

void Main3DWindow::closeEvent(QCloseEvent *e)
{
     hide();

     e->ignore();
}

On 31.10.2018 21:13, Andy wrote:
> Thanks Giuseppe.
>
> Reported with example code here: 
> https://bugreports.qt.io/browse/QTBUG-71519
>
> I wasn't sure what to use for Components, but my main issue is with 
> Qt3D not working properly in this context.
>
> ---
> Andy Maloney  // https://asmaloney.com
> twitter ~ @asmaloney <https://twitter.com/asmaloney>
>
>
>
> On Wed, Oct 31, 2018 at 6:03 AM Giuseppe D'Angelo via Interest 
> <interest at qt-project.org <mailto:interest at qt-project.org>> wrote:
>
>     Il 30/10/18 13:53, Andy ha scritto:
>     > Turns out that if you have a QMainWindow containing a QWindow
>     (e.g. by
>     > using QWidget::createWindowContainer()):
>     >
>     >    - if you call QMainWindow::close(), the QWindow receives
>     QEvent::Hide
>     > and does the right thing
>     >    - if you click the close button in the title bar, the QWindow
>     > receives QEvent::Close which calls QWindow::destroy()
>     >
>     > This is not what I would expect. Is this by design?
>     >
>     > The QWidget::createWindowContainer docs don't mention this as a
>     limitation.
>
>     Smells like a bug to me, please report it.
>
>     HTH,
>
>     -- 
>     Giuseppe D'Angelo | giuseppe.dangelo at kdab.com
>     <mailto:giuseppe.dangelo at kdab.com> | Senior Software Engineer
>     KDAB (France) S.A.S., a KDAB Group company
>     Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
>     KDAB - The Qt, C++ and OpenGL Experts
>
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/interest
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181031/cd779641/attachment.html>


More information about the Interest mailing list