Set focus on the part filter when showing the parts toolbar.
Some checks failed
LeoCAD CI / build-ubuntu (push) Has been cancelled
LeoCAD CI / build-macos (push) Has been cancelled

This commit is contained in:
Leonardo Zide 2024-10-26 12:31:22 -07:00
parent 11e9958a88
commit bf3f1d5db8
4 changed files with 15 additions and 2 deletions

View file

@ -1906,9 +1906,12 @@ void lcMainWindow::ResetViews()
void lcMainWindow::ToggleDockWidget(QWidget* DockWidget) void lcMainWindow::ToggleDockWidget(QWidget* DockWidget)
{ {
if (DockWidget->isHidden()) if (DockWidget->isHidden())
{
DockWidget->show(); DockWidget->show();
DockWidget->raise();
}
else else
DockWidget->hide(); DockWidget->close();
} }
void lcMainWindow::TogglePrintPreview() void lcMainWindow::TogglePrintPreview()
@ -2812,6 +2815,8 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
case LC_VIEW_TOOLBAR_PARTS: case LC_VIEW_TOOLBAR_PARTS:
ToggleDockWidget(mPartsToolBar); ToggleDockWidget(mPartsToolBar);
if (mPartsToolBar->isVisible())
mPartSelectionWidget->FocusPartFilterWidget();
break; break;
case LC_VIEW_TOOLBAR_COLORS: case LC_VIEW_TOOLBAR_COLORS:

View file

@ -676,7 +676,7 @@ lcPartSelectionWidget::lcPartSelectionWidget(QWidget* Parent)
PartsLayout->addLayout(SearchLayout); PartsLayout->addLayout(SearchLayout);
mFilterWidget = new QLineEdit(PartsGroupWidget); mFilterWidget = new QLineEdit(PartsGroupWidget);
mFilterWidget->setPlaceholderText(tr("Search Parts")); mFilterWidget->setPlaceholderText(tr("Filter Parts"));
SearchLayout->addWidget(mFilterWidget); SearchLayout->addWidget(mFilterWidget);
QToolButton* OptionsButton = new QToolButton(); QToolButton* OptionsButton = new QToolButton();

View file

@ -239,6 +239,12 @@ public:
return mPartsWidget->GetCurrentPart(); return mPartsWidget->GetCurrentPart();
} }
void FocusPartFilterWidget() const
{
mFilterWidget->setFocus();
mFilterWidget->selectAll();
}
signals: signals:
void PartPicked(PieceInfo* Info); void PartPicked(PieceInfo* Info);
void CurrentPartChanged(PieceInfo* Info); void CurrentPartChanged(PieceInfo* Info);

View file

@ -196,6 +196,8 @@ void lcPieceIdPickerPopup::showEvent(QShowEvent* ShowEvent)
mPartSelectionWidget->SetOrientation(Qt::Horizontal); mPartSelectionWidget->SetOrientation(Qt::Horizontal);
mPartSelectionWidget->SetCurrentPart(mInitialPart); mPartSelectionWidget->SetCurrentPart(mInitialPart);
mPartSelectionWidget->FocusPartFilterWidget();
} }
void lcPieceIdPickerPopup::Accept() void lcPieceIdPickerPopup::Accept()