Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. FileDialog need to have visual parent

FileDialog need to have visual parent

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 863 Views
  • 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.
  • jiancaiyangJ Offline
    jiancaiyangJ Offline
    jiancaiyang
    wrote on last edited by
    #1

    Because of saving unneeded FileDialog, I need to use a singleton QtObject, like that:

    QtObject
    {
        property FileDialog modelDialog: FileDialog
        {
            ...
        }
    }
    

    However when I use modelDialog.open( ), it is not actually opened, but constructed.
    When I put the code inside Item, it's okay. Could anyone tell me the reason?

    我们自己的论坛:http://qtdream.com
    擅长三维角色仿真动画。

    m.sueM 1 Reply Last reply
    0
    • jiancaiyangJ jiancaiyang

      Because of saving unneeded FileDialog, I need to use a singleton QtObject, like that:

      QtObject
      {
          property FileDialog modelDialog: FileDialog
          {
              ...
          }
      }
      

      However when I use modelDialog.open( ), it is not actually opened, but constructed.
      When I put the code inside Item, it's okay. Could anyone tell me the reason?

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by m.sue
      #2

      Hi @jiancaiyang

      The reason is probably that the C++ class has a QWidget *parent. By default, it then opens in the center of that widget. The parent might be a nullptr, though.

      -Michael.

      jiancaiyangJ 1 Reply Last reply
      0
      • m.sueM m.sue

        Hi @jiancaiyang

        The reason is probably that the C++ class has a QWidget *parent. By default, it then opens in the center of that widget. The parent might be a nullptr, though.

        -Michael.

        jiancaiyangJ Offline
        jiancaiyangJ Offline
        jiancaiyang
        wrote on last edited by
        #3

        @m.sue Is it a bug, or the situation undocumented?

        我们自己的论坛:http://qtdream.com
        擅长三维角色仿真动画。

        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