Results 1 to 6 of 6

Thread: Python / PyQt5 MDI Window focus problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2015
    Location
    Montevideo, UY
    Posts
    4
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Re: Python / PyQt5 MDI Window focus problem

    Quote Originally Posted by anda_skoa View Post
    You are closig the "active sub window" of the mdi area.
    That will always be an mdi sub window, not any dialog._
    As i could understand from the docs, the next lines creates a subwindow in the mdiarea containing the dialog.

    Qt Code:
    1. capturafm = dialgABM(self, ABM_ALTA, self.desc, self.campos, self.dialgx, self.dialgy, self.nombre)
    2. globvar.mdiArea.addSubWindow(capturafm)
    To copy to clipboard, switch view to plain text mode 

    You are suggesting to create an mdisubwindow and then activate it?
    dialgABM should return a QMdiSubWindow object and then globvar.mdiarea.setActiveSubwindow( capturafm )


    Quote Originally Posted by anda_skoa View Post
    Btw, in you create a widget as "central widget" but then don't use it as such.
    Just create the mdi area.

    Cheers,
    _
    Ok, noted and corrected.

    Many thanks for your help.

    Best regards.

    Ariel Pereira

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Python / PyQt5 MDI Window focus problem

    I am afraid I don't understand.

    If you want a QMdiArea subwindow, why derive from QDialog?
    You only do that if you want a dialog.

    Cheers,
    _

  3. #3
    Join Date
    Sep 2015
    Location
    Montevideo, UY
    Posts
    4
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Re: Python / PyQt5 MDI Window focus problem

    Dear anda_skoa,

    Thanks for your message.

    I've changed the class from QDialog to QWidget, but still having the same behaviour.
    For your guidance, find a preview.jpg file where it is shown the behaviour of the app (both windows "Clientes" and "Clientes > Nuevo" have focus at the same time).

    I'm also attaching a test file (mainwindow.ui) created with QtCreator, and a p.py file created with pyuic5, with two added lines that links the QWidgets to the mdiarea.
    As I can understand from this sample, the subwindows are created in the addSubWindow mehtod, and they contain a QWidget object.
    I've been following the idea of this file into the app but still having the same result.

    Any help will be welcome.

    Regards.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by apereira; 18th September 2015 at 18:26.

  4. #4
    Join Date
    Sep 2015
    Location
    Montevideo, UY
    Posts
    4
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Re: Python / PyQt5 MDI Window focus problem

    Got it!!

    It was a setFocus call that was causing this problem ... don't know exactly why ... but after comenting the line the window focus problem has gone.
    The setFocus was used to force the focus to be on a certain QLineEdit, but it seems that something else is going on.

    Thanks for your help.


    Regards.

Similar Threads

  1. Replies: 0
    Last Post: 26th July 2015, 04:45
  2. Replies: 3
    Last Post: 14th February 2012, 15:47
  3. Embedding PyQt4 into an Application running Python via Boost::Python
    By GreyHound in forum Installation and Deployment
    Replies: 1
    Last Post: 6th February 2012, 06:48
  4. Window Focus Problem
    By waynew in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2010, 13:34
  5. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.