Fix minor bug in UIFileDialog text input row selection.

This commit is contained in:
Martín Lucas Golini
2026-06-15 01:32:28 -03:00
parent 407fc1ae11
commit d04f4502db
6 changed files with 19 additions and 12 deletions

View File

@@ -248,7 +248,9 @@ pushbutton:disabled,
selectbutton:disabled,
textinput:disabled,
textedit:disabled,
textarea:disabled {
textarea:disabled,
DropDownList:disabled,
DropDownModelList:disabled {
color: var(--disabled-color);
border-color: var(--disabled-border);
}

View File

@@ -148,6 +148,8 @@ class EE_API UIAbstractTableView : public UIAbstractView {
void setSetupCellCb( const std::function<void( UITableCell* )>& onSetupCellCb );
void resetSearchText();
protected:
friend class EE::UI::UITableHeaderColumn;
friend class EE::UI::UIDropDownModelList;

View File

@@ -19,7 +19,7 @@ class EE_API UIMultiModelView : public UIStackWidget {
void setViewMode( const ViewMode& mode );
UIAbstractView* getCurrentView() const;
UIAbstractTableView* getCurrentView() const;
std::shared_ptr<Model> getModel() const;

View File

@@ -539,8 +539,7 @@ UITableRow* UIAbstractTableView::createRow() {
}
} );
rowWidget->on( Event::MouseClick, [this]( const Event* event ) {
if ( !( event->asMouseEvent()->getFlags() & ( EE_BUTTON_LMASK ) ) ||
!isRowSelection() )
if ( !( event->asMouseEvent()->getFlags() & ( EE_BUTTON_LMASK ) ) || !isRowSelection() )
return;
auto index = event->getNode()->asType<UITableRow>()->getCurIndex();
@@ -919,12 +918,8 @@ Uint32 UIAbstractTableView::onTextInput( const TextInputEvent& event ) {
return 0;
if ( mSearchTextAction )
removeAction( mSearchTextAction );
mSearchTextAction = Actions::Runnable::New(
[this] {
mSearchTextAction = nullptr;
mSearchText = "";
},
Milliseconds( 750 ) );
mSearchTextAction =
Actions::Runnable::New( [this] { resetSearchText(); }, Milliseconds( 750 ) );
runAction( mSearchTextAction );
mSearchText += String::trim( String::toLower( event.getText() ) );
if ( mSearchText.empty() )
@@ -960,6 +955,13 @@ Uint32 UIAbstractTableView::onTextInput( const TextInputEvent& event ) {
return 1;
}
void UIAbstractTableView::resetSearchText() {
if ( mSearchTextAction )
removeAction( mSearchTextAction );
mSearchTextAction = nullptr;
mSearchText = "";
}
bool UIAbstractTableView::tryBeginEditing( KeyBindings::Shortcut fromShortcut ) {
if ( isEditable() && getSelection().first().isValid() && getModel() &&
getModel()->isEditable( getSelection().first() ) &&

View File

@@ -180,7 +180,7 @@ UIFileDialog::UIFileDialog( Uint32 dialogFlags, const std::string& defaultFilePa
if ( event->asKeyEvent()->getKeyCode() == KEY_BACKSPACE )
goFolderUp();
} );
mMultiView->on( Event::OnModelEvent, [&]( const Event* event ) {
mMultiView->on( Event::OnModelEvent, [this]( const Event* event ) {
const ModelEvent* modelEvent = static_cast<const ModelEvent*>( event );
if ( modelEvent->getModelEventType() == ModelEventType::Open ) {
Variant vPath(
@@ -195,6 +195,7 @@ UIFileDialog::UIFileDialog( Uint32 dialogFlags, const std::string& defaultFilePa
shouldOpenFolder = true;
}
}
mMultiView->getCurrentView()->resetSearchText();
openFileOrFolder( shouldOpenFolder );
}
}

View File

@@ -64,7 +64,7 @@ void UIMultiModelView::setViewMode( const ViewMode& mode ) {
}
}
UIAbstractView* UIMultiModelView::getCurrentView() const {
UIAbstractTableView* UIMultiModelView::getCurrentView() const {
switch ( mMode ) {
case Table:
return mTable;