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 malfunction in modality mode
Forum Updated to NodeBB v4.3 + New Features

QDialog malfunction in modality mode

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.8k Views 2 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.
  • BuccaneerB Offline
    BuccaneerB Offline
    Buccaneer
    wrote on last edited by Buccaneer
    #1

    Hi everyone!
    I want to create a child widget with option to block parent widget.
    Many advise to create QDialog with exec_ method and I tried that.
    I even tried to set setWindowModality(QtCore.Qt.ApplicationModal)
    As result the child widget is always on top of parent, but if I click on parent the child loses his focus. And the parent widget still can be moved on screen or even minimized in trey.
    What's the point of such modality if it's not block parent absolutely?
    Qt 4.8

    mrjjM 1 Reply Last reply
    0
    • BuccaneerB Buccaneer

      Hi everyone!
      I want to create a child widget with option to block parent widget.
      Many advise to create QDialog with exec_ method and I tried that.
      I even tried to set setWindowModality(QtCore.Qt.ApplicationModal)
      As result the child widget is always on top of parent, but if I click on parent the child loses his focus. And the parent widget still can be moved on screen or even minimized in trey.
      What's the point of such modality if it's not block parent absolutely?
      Qt 4.8

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      @Buccaneer
      Hi
      When you create your dialog, do you give the parent in the constructor ?
      Dialog mydia( Parent );
      Also, did you call QDialog constructor from your class?
      MyDialog::MyDialog(QWidget *parent) :..
      QDialog(parent),
      So the flags get set ?

      BuccaneerB 1 Reply Last reply
      0
      • mrjjM mrjj

        @Buccaneer
        Hi
        When you create your dialog, do you give the parent in the constructor ?
        Dialog mydia( Parent );
        Also, did you call QDialog constructor from your class?
        MyDialog::MyDialog(QWidget *parent) :..
        QDialog(parent),
        So the flags get set ?

        BuccaneerB Offline
        BuccaneerB Offline
        Buccaneer
        wrote on last edited by Buccaneer
        #3

        @mrjj
        I make my project in python with PyQt
        No I didn't set parent.
        When My QDialog class starts - parent is set to None

        I just ported the project from ubuntu to windows and modality works perfectly (((
        Looks like this is my problem in ubuntu + PyQt4
        I'm so upset

        mrjjM 1 Reply Last reply
        0
        • BuccaneerB Buccaneer

          @mrjj
          I make my project in python with PyQt
          No I didn't set parent.
          When My QDialog class starts - parent is set to None

          I just ported the project from ubuntu to windows and modality works perfectly (((
          Looks like this is my problem in ubuntu + PyQt4
          I'm so upset

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @Buccaneer
          Hi, sorry, though it was c++.
          Never used Py so Have no idea.

          I assume, your dialog is something like :

          class DateDialog(QDialog):
          def init(self, parent = None):
          super(DateDialog, self).init(parent)

          which as far as I understand will call QDialog Constructor ?

          update: Ah, works in win.

          BuccaneerB 1 Reply Last reply
          0
          • mrjjM mrjj

            @Buccaneer
            Hi, sorry, though it was c++.
            Never used Py so Have no idea.

            I assume, your dialog is something like :

            class DateDialog(QDialog):
            def init(self, parent = None):
            super(DateDialog, self).init(parent)

            which as far as I understand will call QDialog Constructor ?

            update: Ah, works in win.

            BuccaneerB Offline
            BuccaneerB Offline
            Buccaneer
            wrote on last edited by
            #5

            @mrjj
            You are absolutely right with code.
            And yeh ((( its work in win... Whyyyyyyyyyyyyy?

            mrjjM 1 Reply Last reply
            0
            • BuccaneerB Buccaneer

              @mrjj
              You are absolutely right with code.
              And yeh ((( its work in win... Whyyyyyyyyyyyyy?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @Buccaneer
              Well seems to be the same with C++.
              Looks Modal but can still minimize Parent...
              So I guess it how Ubuntu does "modal"
              Prevents access to any control on the parent but not minimize/maxi.

              Strange.

              Update:
              Seems like other apps have this too. I guess its up to the windows
              manager how it works.

              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