Page 1 of 1

Qt - Child windows

Posted: Thu Mar 21, 2019 4:05 pm
by wombats
Child windows have their own entry in the dock. I would expect a dialog to not have its own entry there.

Image

Code: Select all

Enumeration
  #Window
  #Button
  #Dialog
  #DialogButton
  #Dialog2
EndEnumeration

OpenWindow(#Window, 0, 0, 400, 350, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#Button, 10, 10, 90, 25, "Open Dialog")

Define Event
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_CloseWindow
      Select EventWindow()
        Case #Window
          Quit = 1
        Case #Dialog
          CloseWindow(#Dialog)
          DisableWindow(#Window, 0)
        Case #Dialog2
          CloseWindow(#Dialog2)
          DisableWindow(#Dialog, 0)
      EndSelect
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button
          DisableWindow(#Window, 1)
          OpenWindow(#Dialog, 0, 0, 320, 240, "Dialog", #PB_Window_SystemMenu | #PB_Window_WindowCentered, WindowID(#Window))
          ButtonGadget(#DialogButton, 10, 10, 90, 25, "Open Dialog")
        Case #DialogButton
          DisableWindow(#Dialog, 1)
          OpenWindow(#Dialog2, 0, 0, 320, 240, "Dialog 2", #PB_Window_SystemMenu | #PB_Window_WindowCentered, WindowID(#Dialog))
      EndSelect
  EndSelect
Until Quit = 1

End

Re: Qt - Child windows

Posted: Thu Mar 21, 2019 4:28 pm
by #NULL
Maybe try OpenWindow(#Dialog, ... | #PB_Window_Tool.

Re: Qt - Child windows

Posted: Thu Mar 21, 2019 6:02 pm
by wombats
That does work, but it makes the titlebar smaller.

Re: Qt - Child windows

Posted: Thu Mar 21, 2019 6:39 pm
by #NULL
wombats wrote:That does work, but it makes the titlebar smaller.
That's what I expected and remembered (maybe from Windows) but here on my current linux system that doesn't happen (titlebars look the same with .._Tool..). I also tried some other window manager themes.

Re: Qt - Child windows

Posted: Thu Mar 21, 2019 10:12 pm
by wombats
Ah. Thanks for checking that. I guess it's an OK compromise for now. It would be nice if the Dialog library could be based on QDialog for proper dialog functionality (no flashing when clicking the parent window, for example), but I don't know how complicated that would be under the surface because I know they are just normal windows based on QMainWindow. I used normal windows in this example, but I use the Dialog library in my project for anything except the main window.

Re: Qt - Child windows

Posted: Wed Apr 10, 2019 7:59 pm
by Fred
PureBasic doesn't support real dialog yet, moved to feature request