class Vizkit::PluginConnections::ShowHideEventFilter

Public Instance Methods

eventFilter(obj,event) click to toggle source
# File lib/vizkit/plugin_extensions.rb, line 64
def eventFilter(obj,event)
    if event.is_a?(Qt::HideEvent)
        @on_hide.call if @on_hide
    elsif event.is_a?(Qt::WindowStateChangeEvent)
        window = obj
        # Some objects are not windows, but we do want the window
        # state. Look for a window in the hierarchy
        while window && !window.respond_to?(:windowState)
            window = window.parent
        end
        if window
            if Qt::WindowMinimized == window.windowState
                @on_hide.call if @on_hide
            else
                @on_show.call if @on_show
            end
        end
    elsif event.is_a?(Qt::ShowEvent)
        @on_show.call if @on_show
    elsif event.is_a?(Qt::CloseEvent)
        @on_hide.call if @on_hide
    end
    return false
end
on_hide(&block) click to toggle source
# File lib/vizkit/plugin_extensions.rb, line 93
def on_hide(&block)
    @on_hide = block
end
on_show(&block) click to toggle source
# File lib/vizkit/plugin_extensions.rb, line 89
def on_show(&block)
    @on_show = block
end