0

qSplashScreen and taskbar icon issue

Hi

 

I'm creating a splashscreen for my app, but unfortunately the widget gets parented to the splash screen, which means it has no taskbar icon.

QtGui.QApplication.activeWindow() returns None if there no splashscreen, and that's fine, but with the splashscreen, it returns the splashscreen object.

Is there some way I can trick it into not parenting it to the splash screen?

Im working in the _init_.py that has widget = app.engine.show_dialog("Asset Manager", app, AppDialog, app)

 

thanks

Phil

 

import sgtk

from sgtk.platform.qt import QtCore, QtGui
from .ui import resources_rc

def show_dialog(app):

    from .asset_manager import AppDialog

    splash_pix = QtGui.QPixmap(":/res/splash.png") 
    splash = QtGui.QSplashScreen(splash_pix)
    splash.setMask(splash_pix.mask())
    splash.show()
    splash.raise_()
    #Create and display the splash screen
    QtCore.QCoreApplication.processEvents()

    print "first parent: ", QtGui.QApplication.activeWindow()
    import grab_directories as grab
    bIcon = grab.imp.import_module( grab.pathDict['burrows_icon']['production'] )
    # show the dialog window using the engine's show_dialog method
    widget = app.engine.show_dialog("Asset Manager", app, AppDialog, app)

    bIcon.SetTankIcon(widget)

    #attach splash screen to the main window to help GC
    widget.__splash_screen = splash

    # hide splash screen after loader UI show
    splash.finish(widget.window())

    # bring window to front
    widget.raise_()

 

3 comments

  • 0
    Avatar
    Philip Scadding

    Ok For now I have a solution, But a neater one would be welcome
     in my init file i have created two methods that do the same job as the engine ones, except i pass the parent as being none

    def override_show_dialog( title, bundle, widget_class, *args, **kwargs):
    
      bundle.engine._ui_created = True
      print dir(bundle.engine)
      dialog, widget = override_create_dialog_with_widget(title, bundle, widget_class, *args, **kwargs)
      dialog.show()
    
      # lastly, return the instantiated widget
      return widget
    
    def override_create_dialog_with_widget(title, bundle, widget_class, *args, **kwargs):
      widget = bundle.engine._create_widget(widget_class, *args, **kwargs)
    
      # create the dialog:
      dialog = bundle.engine._create_dialog(title, bundle, widget, None)
      return (dialog, widget)
    

     

  • 0
    Avatar
    Philip Scadding

    Ah brilliant, yeah that works fine.

     

    Thank you

  • 0
    Avatar
    Alan Dann

    Hi Philip,

    I'm wondering if clearing the active window after creating the splash screen would work - to do this, call:

    QtGui.QApplication.setActiveWindow(None)

    Does that help?

    Thanks

    Alan

     

Please sign in to leave a comment.