mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 17:17:42 +03:00
Fix minor bug in UIFileDialog text input row selection.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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() ) &&
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void UIMultiModelView::setViewMode( const ViewMode& mode ) {
|
||||
}
|
||||
}
|
||||
|
||||
UIAbstractView* UIMultiModelView::getCurrentView() const {
|
||||
UIAbstractTableView* UIMultiModelView::getCurrentView() const {
|
||||
switch ( mMode ) {
|
||||
case Table:
|
||||
return mTable;
|
||||
|
||||
Reference in New Issue
Block a user