view src/filterwidget.h @ 113:20ec21924338 tip

Added tag 1.4 for changeset 9daf778feaf1
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 08 Dec 2016 15:34:30 +0100
parents 3916cb3c9105
children
line wrap: on
line source
#ifndef FILTERWIDGET_H
#define FILTERWIDGET_H
/* Copyright (C) 2015 by ETH Zürich
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#include <QWidget>
#include <QMap>

class QSortFilterProxyModel;
class QComboBox;
class QCheckBox;
class QLineEdit;
/**
 * @class FilterWidget
 * @brief Generic Widget to apply a filter on SortFilterProxymodel
 */
class FilterWidget: public QWidget
{
    Q_OBJECT

public:
    /**@brief construct a filterwidget for the model model.
     *
     * @param model The model to filter
     * @param addWithEmptyChk wether or not to add the include empty checkbox.
     * */
    FilterWidget (QSortFilterProxyModel *model, bool addWithEmptyChk,
            QWidget * parent = 0, Qt::WindowFlags f = 0);

Q_SIGNALS:
    void filterHasChanged();

    void includeEmptyChanged(int state);

protected:
    void setupGUI();

public slots:
    void headersChanged();

protected slots:
    void filterChanged();

private:
    QSortFilterProxyModel *mModel;
    QComboBox *mCombo;
    QCheckBox *mEmptyChk;
    QLineEdit *mEditLine;
    /* Maps the combo index to the model col index */
    QMap<int, int> mColFilterMap;
    bool mWithEmptyChk;
};
#endif // FILTERWIDGET_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)