49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
|
|
#ifndef SEARCH_DIALOG_H
|
||
|
|
#define SEARCH_DIALOG_H
|
||
|
|
|
||
|
|
#include "ui_search_dialog.h"
|
||
|
|
#include <QList>
|
||
|
|
#include <QSortFilterProxyModel>
|
||
|
|
|
||
|
|
#include <QDialog>
|
||
|
|
#include <QSqlField>
|
||
|
|
#include <QSqlRecord>
|
||
|
|
|
||
|
|
// Forward declaration
|
||
|
|
class BaseSqlTableModel;
|
||
|
|
|
||
|
|
class SearchDialog : public QDialog, private Ui::SearchDialog {
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
private:
|
||
|
|
BaseSqlTableModel *originalModel_;
|
||
|
|
QSortFilterProxyModel *proxyModel_;
|
||
|
|
QString modelTableName_;
|
||
|
|
int columnIndex_;
|
||
|
|
|
||
|
|
public:
|
||
|
|
explicit SearchDialog(const QString &modelTableName, const QString &fieldName,
|
||
|
|
QWidget *parent = nullptr);
|
||
|
|
explicit SearchDialog(QWidget *parent = nullptr);
|
||
|
|
~SearchDialog();
|
||
|
|
|
||
|
|
bool setFieldName(const QString &fieldName);
|
||
|
|
bool setTableName(const QString &tableName);
|
||
|
|
|
||
|
|
signals:
|
||
|
|
void rowSelected(int rowIndex);
|
||
|
|
void recordRetrieved(QSqlRecord rowValues);
|
||
|
|
void fieldRetrieved(QSqlField field);
|
||
|
|
|
||
|
|
private slots:
|
||
|
|
void onLineEditSearchTextChanged(const QString &text);
|
||
|
|
void onPushButtonSelectClicked();
|
||
|
|
|
||
|
|
private:
|
||
|
|
void initializeProxyModel();
|
||
|
|
void setupConnections();
|
||
|
|
void setupTableView();
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // SEARCH_DIALOG_H
|