Changeset 2eb48c96 in OpenModelica


Ignore:
Timestamp:
2020-08-05T10:16:13+02:00 (4 years ago)
Author:
GitHub <noreply@…>
Branches:
Added-citation-metadata, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
c229655
Parents:
85cad8f
git-author:
Adeel Asghar <adeel.asghar@…> (08/05/20 10:16:13)
git-committer:
GitHub <noreply@…> (08/05/20 10:16:13)
Message:

Fixes ticket:5998 Reset the search filter when ESC is pressed (#6694)

Fixes ticket:5998 Reset the search filter when ESC is pressed

Use a local signal to call the QLineEdit signal

Location:
OMEdit/OMEditLIB/Util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OMEdit/OMEditLIB/Util/Utilities.cpp

    r895904a r2eb48c96  
    6666  mpFilterTextBox = new QLineEdit;
    6767  mpFilterTextBox->installEventFilter(this);
     68  connect(this, SIGNAL(clearFilter(QString)), mpFilterTextBox, SIGNAL(textEdited(QString)));
    6869  // filter timer
    6970  mpFilterTimer = new QTimer;
     
    118119/*!
    119120 * \brief TreeSearchFilters::eventFilter
    120  * Handles the ESC key press for search text box
     121 * Handles the ESC key press for filter text box
    121122 * \param pObject
    122123 * \param pEvent
     
    126127{
    127128  /* Ticket #3987
    128    * Clear contents of search field by clicking ESC key.
     129   * Clear contents of filter field by clicking ESC key.
    129130   */
    130   QLineEdit *pSearchTextBox = qobject_cast<QLineEdit*>(pObject);
    131   if (pSearchTextBox && pEvent->type() == QEvent::KeyPress) {
     131  QLineEdit *pFilterTextBox = qobject_cast<QLineEdit*>(pObject);
     132  if (pFilterTextBox && pEvent->type() == QEvent::KeyPress) {
    132133    QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
    133134    if (pKeyEvent && pKeyEvent->key() == Qt::Key_Escape) {
    134       pSearchTextBox->clear();
     135      pFilterTextBox->clear();
     136      /* Ticket #5998
     137       * Emit clearFilter signal which calls textEdited signal of mpFilterTextBox to reset filter.
     138       */
     139      emit clearFilter("");
    135140      return true;
    136141    }
  • OMEdit/OMEditLIB/Util/Utilities.h

    r2a7939a r2eb48c96  
    124124private slots:
    125125  void showHideFilters(bool On);
     126signals:
     127  void clearFilter(const QString &);
    126128};
    127129
Note: See TracChangeset for help on using the changeset viewer.