No spontaneous showEvent generated when window is opened ?!
Dear all,
I'm trying to scroll very large list to specific position when main window is opened. As far as I understand for this I need to add code to spontaneous showEvent because this is one executed just after window is opened.
Here is the code:
Code:
if(event->spontaneous()){
qDebug()<<"after";
} else qDebug()<<"before";
}
This always prints "before" - there is no spontaneous event at all! It seems that i missed something simple. Any help is deeply appreciated!
Re: No spontaneous showEvent generated when window is opened ?!
Re: No spontaneous showEvent generated when window is opened ?!
I doubt show events are ever spontaneous. Show events are generated within your application. Maybe when application is being unminimized a spontaneous show event might occur. Why do you need to react on spontaneous events only?
Re: No spontaneous showEvent generated when window is opened ?!
Well, what I need to do is to scroll a very long list just upon creation of the window. The scrollTo method only works when the window is already shown, so I don't see any other way to do this. If there is some, please give me a hint.
Re: No spontaneous showEvent generated when window is opened ?!
Try re-implementing resizeEvent instead.
Re: No spontaneous showEvent generated when window is opened ?!
No luck. resizeEvent is either not called when the window is shown for the first time or called before showEvent. Anyway scrollTo doesn't work. I'll probably make a new thread for scrollTo functionality.
Re: No spontaneous showEvent generated when window is opened ?!
Quote:
Originally Posted by
yesint
Well, what I need to do is to scroll a very long list just upon creation of the window. The scrollTo method only works when the window is already shown, so I don't see any other way to do this. If there is some, please give me a hint.
But why are you checking if the event is spontaneous?