Improvement in widget focusing
This commit is contained in:
parent
2b110d87d8
commit
6a91738f48
|
@ -131,10 +131,8 @@ void Transparent::onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
|
|
||||||
if ( ev->key() == 'q' && getParentWidget() )
|
if ( ev->key() == 'q' && getParentWidget() )
|
||||||
{
|
{
|
||||||
if ( getParentWidget()->close() )
|
getParentWidget()->close();
|
||||||
ev->accept();
|
ev->accept();
|
||||||
else
|
|
||||||
ev->ignore();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
finalcut::FDialog::onKeyPress(ev);
|
finalcut::FDialog::onKeyPress(ev);
|
||||||
|
@ -224,7 +222,6 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
|
||||||
// Statusbar at the bottom
|
// Statusbar at the bottom
|
||||||
status_bar.setMessage("Press Q to quit");
|
status_bar.setMessage("Press Q to quit");
|
||||||
|
|
||||||
addAccelerator('q');
|
|
||||||
unsetTransparentShadow();
|
unsetTransparentShadow();
|
||||||
activateDialog();
|
activateDialog();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1192,7 +1192,7 @@ bool FApplication::processNextEvent()
|
||||||
void FApplication::performTimerAction ( const FObject* receiver
|
void FApplication::performTimerAction ( const FObject* receiver
|
||||||
, const FEvent* event )
|
, const FEvent* event )
|
||||||
{
|
{
|
||||||
sendEvent(receiver, event);
|
sendEvent (receiver, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -267,16 +267,10 @@ bool FWidget::setFocus (bool enable)
|
||||||
// set widget focus
|
// set widget focus
|
||||||
if ( enable && ! flags.focus )
|
if ( enable && ! flags.focus )
|
||||||
{
|
{
|
||||||
int focusable_children = numOfFocusableChildren();
|
|
||||||
|
|
||||||
if ( last_focus )
|
if ( last_focus )
|
||||||
last_focus->unsetFocus();
|
last_focus->unsetFocus();
|
||||||
|
|
||||||
if ( (!isDialogWidget() && focusable_children == 0)
|
FWidget::setFocusWidget(this);
|
||||||
|| (isDialogWidget() && focusable_children == 1) )
|
|
||||||
{
|
|
||||||
FWidget::setFocusWidget(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto window = FWindow::getWindowWidget(this);
|
auto window = FWindow::getWindowWidget(this);
|
||||||
|
@ -292,6 +286,7 @@ bool FWidget::setFocus (bool enable)
|
||||||
if ( has_raised && window->isVisible() && window->isShown() )
|
if ( has_raised && window->isVisible() && window->isShown() )
|
||||||
window->redraw();
|
window->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
window->setWindowFocusWidget(this);
|
window->setWindowFocusWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,7 +785,9 @@ int FWidget::numOfFocusableChildren()
|
||||||
{
|
{
|
||||||
auto widget = static_cast<FWidget*>(*iter);
|
auto widget = static_cast<FWidget*>(*iter);
|
||||||
|
|
||||||
if ( widget->acceptFocus() )
|
if ( widget->isVisible()
|
||||||
|
&& widget->acceptFocus()
|
||||||
|
&& ! widget->isWindowWidget() )
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue