Thread: Sigil niggles
View Single Post
Old 03-25-2024, 06:09 PM   #29
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: 704
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
I have quick and dirty solution (you can certainly optimise this):

Code:
bool FindReplace::HasFocus2()
{
    return ui.cbReplace->lineEdit()->hasFocus();
}
...

Code:
void FindReplace::SetCodeViewIfNeeded()
{
    bool has_focus = HasFocus();
    if (has_focus) {
        // give the current tab CodeView Tab the focus
        ui.cbFind->lineEdit()->clearFocus();
        ui.cbReplace->lineEdit()->clearFocus();
        ContentTab * current_tab = m_MainWindow->GetCurrentContentTab();
        if (current_tab) current_tab->setFocus();
    }

    bool has_focus2 = HasFocus2();
    if (has_focus2) {
        // give the current tab CodeView Tab the focus
        ui.cbReplace->lineEdit()->clearFocus();
        ContentTab * current_tab = m_MainWindow->GetCurrentContentTab();
        if (current_tab) current_tab->setFocus();
    }
}
BeckyEbook is offline   Reply With Quote