View Single Post
Old 11-18-2023, 04:57 PM   #39
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 876
Karma: 3501146
Join Date: Jan 2017
Location: Poland
Device: Various
I checked via Debug that the widget can be checked for visibility before raise().
When the widget is in the foreground then raise() will not be called.

So an extra test shouldn't hurt, here an example:

Code:
void MainWindow::FocusOnTOC()
{
    FocusOn(m_TableOfContents);
    m_TableOfContents->SetFocusOnTOC();
    DBG qDebug() << "Focus";
    if (m_TableOfContents->visibleRegion().isEmpty()) {
        DBG qDebug() << "Here raise";
        m_TableOfContents->raise();
    }
    ShowMessageOnStatusBar(tr("Focus changed to Table Of Contents window."));
}
BeckyEbook is offline   Reply With Quote