SearchInputWidget.h 1.38 KB
Newer Older
Dennis Nienhüser's avatar
Dennis Nienhüser committed
1 2 3 4 5 6 7
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
Dennis Nienhüser's avatar
Dennis Nienhüser committed
8
// Copyright 2012       Dennis Nienhüser <nienhueser@kde.org>
9
// Copyright 2012       Bernhard Beschow <bbeschow@cs.tu-berlin.de>
Dennis Nienhüser's avatar
Dennis Nienhüser committed
10 11 12 13 14
//

#ifndef MARBLE_SEARCHINPUTWIDGET_H
#define MARBLE_SEARCHINPUTWIDGET_H

15
#include <QSortFilterProxyModel>
Dennis Nienhüser's avatar
Dennis Nienhüser committed
16 17

#include "MarbleLineEdit.h"
18
#include "MarbleGlobal.h"
Dennis Nienhüser's avatar
Dennis Nienhüser committed
19
#include "marble_export.h"
Dennis Nienhüser's avatar
Dennis Nienhüser committed
20

21
class QAbstractItemModel;
22

23
class QCompleter;
24
class QModelIndex;
25

Dennis Nienhüser's avatar
Dennis Nienhüser committed
26 27
namespace Marble {

28
class GeoDataCoordinates;
Dennis Nienhüser's avatar
Dennis Nienhüser committed
29

Dennis Nienhüser's avatar
Dennis Nienhüser committed
30
class MARBLE_EXPORT SearchInputWidget : public MarbleLineEdit
Dennis Nienhüser's avatar
Dennis Nienhüser committed
31 32 33 34
{
    Q_OBJECT

public:
Kevin Krammer's avatar
Kevin Krammer committed
35
    explicit SearchInputWidget( QWidget* parent = 0 );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
36

37
    void setCompletionModel( QAbstractItemModel *completionModel );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
38 39 40 41 42

public Q_SLOTS:
    void disableSearchAnimation();

Q_SIGNALS:
43
    void search( const QString &searchTerm, SearchMode searchMode );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
44

45 46
    void centerOn( const GeoDataCoordinates &coordinates );

Dennis Nienhüser's avatar
Dennis Nienhüser committed
47 48 49 50 51
private Q_SLOTS:
    void search();

    void centerOnSearchSuggestion( const QModelIndex &suggestionIndex );

52 53 54 55 56 57
    void showDropDownMenu();

    void setGlobalSearch();

    void setAreaSearch();

Dennis Nienhüser's avatar
Dennis Nienhüser committed
58
private:
59 60
    void updatePlaceholderText();

61
    QSortFilterProxyModel m_sortFilter;
62
    QCompleter *const m_completer;
63
    bool m_areaSearch;
Dennis Nienhüser's avatar
Dennis Nienhüser committed
64 65 66 67 68
};

}

#endif