Double clicking a table now opens a CRUD page for that table however data cannot be changed yet thought it will display an editbox.
This commit is contained in:
parent
abd4020ddf
commit
2ba27178a2
13 changed files with 288 additions and 33 deletions
|
|
@ -12,7 +12,8 @@ namespace {
|
|||
{
|
||||
qRegisterMetaType<ASyncDBConnection::State>();
|
||||
qRegisterMetaType<Pgsql::ErrorDetails>();
|
||||
}
|
||||
qRegisterMetaType<std::shared_ptr<Pgsql::Result>>();
|
||||
}
|
||||
} registerMetaTypes_instance;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,11 +48,28 @@ public:
|
|||
bool send(const std::string &command, on_result_callback on_result);
|
||||
bool send(const std::string &command, Pgsql::Params params, on_result_callback on_result);
|
||||
|
||||
/** This version of send uses the signal onQueryResult and onQueryError to report back
|
||||
* the completion of the query.
|
||||
*/
|
||||
bool send(const std::string &command, Pgsql::Params params = Pgsql::Params())
|
||||
{
|
||||
return send(command, params, [this] (Expected<std::shared_ptr<Pgsql::Result>> res, qint64) {
|
||||
if (res.valid()) {
|
||||
emit onQueryResult(res.get());
|
||||
}
|
||||
else {
|
||||
emit onQueryError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool cancel();
|
||||
|
||||
signals:
|
||||
void onStateChanged(ASyncDBConnection::State state);
|
||||
void onNotice(Pgsql::ErrorDetails notice);
|
||||
void onQueryResult(std::shared_ptr<Pgsql::Result> result);
|
||||
void onQueryError();
|
||||
|
||||
private:
|
||||
Pgsql::Connection m_connection;
|
||||
|
|
@ -71,6 +88,7 @@ private:
|
|||
|
||||
Q_DECLARE_METATYPE(ASyncDBConnection::State);
|
||||
Q_DECLARE_METATYPE(Pgsql::ErrorDetails);
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<Pgsql::Result>);
|
||||
|
||||
|
||||
#endif // ASYNCDBCONNECTION_H
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ ParamListModel::ParamListModel(QObject *parent)
|
|||
|
||||
QVariant ParamListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
// FIXME: Implement me!
|
||||
QVariant result;
|
||||
if (orientation == Qt::Horizontal) {
|
||||
if (role == Qt::DisplayRole) {
|
||||
|
|
@ -56,7 +55,7 @@ QVariant ParamListModel::data(const QModelIndex &index, int role) const
|
|||
if (index.isValid()) {
|
||||
int row = index.row();
|
||||
int col = index.column();
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
const auto& record = m_paramList[row];
|
||||
switch (col) {
|
||||
case ColValue: // value column
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class PgClass;
|
||||
class PgConstraint;
|
||||
class PgDatabaseCatalog;
|
||||
|
||||
bool identNeedsQuotes(QString ident);
|
||||
|
||||
QString genFQTableName(const PgDatabaseCatalog &catalog, const PgClass &cls);
|
||||
QString getDropConstraintDefinition(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
||||
QString getConstraintDefinition(const PgDatabaseCatalog &catalog, const PgConstraint &constraint);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue