0

tk-multi-starterApp | setWindowFlags | how to allow app Maximizing and resizing

Hello,

I'm looking for a way to integrate some code in my app to allow the app dialog to be maximized/Minimized.

What is the best way to do ?

 

Thanks

 

Cyril

 

1 条评论

  • 0
    Avatar
    Cyril Clavaud

    HI,

    I'have found a way which is working well for the tk-desktop.

     

    def show_dialog(app_instance):
        """
        Shows the main dialog window.
        """
        # in order to handle UIs seamlessly, each toolkit engine has methods for launching
        # different types of windows. By using these methods, your windows will be correctly
        # decorated and handled in a consistent fashion by the system.
        
        # we pass the dialog class to this method and leave the actual construction
        # to be carried out by toolkit.

        AppDialog = noteManager.noteManager.Example

       
        
        app_instance.engine.show_dialog("My app", app_instance, AppDialog )    

        dialog = QtGui.QApplication.activeWindow()
        flags = QtCore.Qt.Window

        flags |= QtCore.Qt.WindowTitleHint
        flags |= QtCore.Qt.WindowSystemMenuHint   
        flags |= QtCore.Qt.WindowMinimizeButtonHint
        flags |= QtCore.Qt.WindowMaximizeButtonHint
        flags |= QtCore.Qt.WindowCloseButtonHint
        flags |= QtCore.Qt.WindowContextHelpButtonHint
        flags |= QtCore.Qt.WindowShadeButtonHint
        flags |= QtCore.Qt.WindowStaysOnTopHint
        
        dialog.setWindowFlags(flags)
        dialog.show()

     

请先登录再写评论。