File indexing completed on 2024-04-21 03:49:55

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0005 //
0006 
0007 #ifndef MARBLE_SEARCHINPUTWIDGET_H
0008 #define MARBLE_SEARCHINPUTWIDGET_H
0009 
0010 #include <QSortFilterProxyModel>
0011 
0012 #include "MarbleLineEdit.h"
0013 #include "MarbleGlobal.h"
0014 #include "marble_export.h"
0015 
0016 class QAbstractItemModel;
0017 
0018 class QCompleter;
0019 class QModelIndex;
0020 
0021 namespace Marble {
0022 
0023 class GeoDataCoordinates;
0024 
0025 class MARBLE_EXPORT SearchInputWidget : public MarbleLineEdit
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit SearchInputWidget( QWidget* parent = nullptr );
0031 
0032     void setCompletionModel( QAbstractItemModel *completionModel );
0033 
0034 public Q_SLOTS:
0035     void disableSearchAnimation();
0036 
0037 Q_SIGNALS:
0038     void search( const QString &searchTerm, SearchMode searchMode );
0039 
0040     void centerOn( const GeoDataCoordinates &coordinates );
0041 
0042 private Q_SLOTS:
0043     void search();
0044 
0045     void centerOnSearchSuggestion( const QModelIndex &suggestionIndex );
0046 
0047     void showDropDownMenu();
0048 
0049     void setGlobalSearch();
0050 
0051     void setAreaSearch();
0052 
0053 private:
0054     void updatePlaceholderText();
0055 
0056     QSortFilterProxyModel m_sortFilter;
0057     QCompleter *const m_completer;
0058     bool m_areaSearch;
0059 };
0060 
0061 }
0062 
0063 #endif