Fix the coding style to match the current Qt style. Pick-to: 6.7 Fixes: QTBUG-68661 Fixes: QTBUG-120909 Change-Id: I314ca9da8a03727e3e0336a23fce1ce9d065d3a4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef BROWSER_H
|
|
#define BROWSER_H
|
|
|
|
#include <QWidget>
|
|
#include <QSqlTableModel>
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QSqlError)
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui
|
|
{
|
|
class Browser;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class Browser : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
Browser(QWidget *parent = nullptr);
|
|
~Browser();
|
|
|
|
QSqlError addConnection(const QString &driver, const QString &dbName, const QString &host,
|
|
const QString &user, const QString &passwd, int port);
|
|
|
|
public slots:
|
|
void openNewConnectionDialog();
|
|
void about();
|
|
|
|
protected:
|
|
void insertRow();
|
|
void deleteRow();
|
|
void updateActions();
|
|
|
|
protected slots:
|
|
void exec();
|
|
void showTable(const QString &table);
|
|
void showMetaData(const QString &table);
|
|
|
|
void onFieldStrategyAction();
|
|
void onRowStrategyAction();
|
|
void onManualStrategyAction();
|
|
void onSubmitButton();
|
|
void onClearButton();
|
|
|
|
signals:
|
|
void statusMessage(const QString &message);
|
|
|
|
private:
|
|
Ui::Browser *m_ui;
|
|
};
|
|
|
|
class CustomModel : public QSqlTableModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
using QSqlTableModel::QSqlTableModel;
|
|
QVariant data(const QModelIndex &idx, int role) const override
|
|
{
|
|
if (role == Qt::BackgroundRole && isDirty(idx))
|
|
return QBrush(QColor(Qt::yellow));
|
|
return QSqlTableModel::data(idx, role);
|
|
}
|
|
};
|
|
|
|
#endif
|