From f53d5bd53b8ca22cb3d85d5012b08c6f72185bce Mon Sep 17 00:00:00 2001 From: Ivan Pelipenko Date: Fri, 9 Oct 2020 11:42:33 +0300 Subject: [PATCH] new SQLTableWidget::debugEnabled property --- libs/sql_table/sql_table_widget.cpp | 4 ++-- libs/sql_table/sql_table_widget.h | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/sql_table/sql_table_widget.cpp b/libs/sql_table/sql_table_widget.cpp index 9503ee6..c8a67a7 100644 --- a/libs/sql_table/sql_table_widget.cpp +++ b/libs/sql_table/sql_table_widget.cpp @@ -334,7 +334,7 @@ SQLTableWidget::SQLTableWidget(QWidget * parent): QWidget(parent), filters_group model = 0; timer = 0; connection_name = QSqlDatabase::defaultConnection; - filters_active = first_update = true; + filters_active = first_update = debug = true; table_opened = read_only = false; ui->labelNew->setFixedSize(preferredIconSize(1.2, this)); ui->labelFilter->setFixedSize(preferredIconSize(1.2, this)); @@ -463,7 +463,7 @@ void SQLTableWidget::setTableName(const QString & t) { first_update = true; table_ = t; if (!QSqlDatabase::database(connection_name).isOpen()) { - qDebug() << "[setTableName] Database in not opened!"; + if (debug) qDebug() << "[setTableName] Database in not opened!"; setTableVisible(false); timer = startTimer(1000); return; diff --git a/libs/sql_table/sql_table_widget.h b/libs/sql_table/sql_table_widget.h index d93b957..eab42e5 100644 --- a/libs/sql_table/sql_table_widget.h +++ b/libs/sql_table/sql_table_widget.h @@ -17,8 +17,8 @@ along with this program. If not, see . */ -#ifndef MYSQLTABLE_H -#define MYSQLTABLE_H +#ifndef SQL_TABLE_WIDGET_H +#define SQL_TABLE_WIDGET_H #include #include @@ -226,6 +226,7 @@ class QAD_SQL_TABLE_EXPORT SQLTableWidget: public QWidget Q_PROPERTY(bool lineNewVisible READ lineNewVisible WRITE setLineNewVisible) Q_PROPERTY(bool lineFilterVisible READ lineFilterVisible WRITE setLineFilterVisible) Q_PROPERTY(bool readOnly READ readOnly WRITE setReadOnly) + Q_PROPERTY(bool debugEnabled READ isDebugEnabled WRITE setDebugEnabled) friend class SQLItemDelegate; friend class SQLUniEdit; public: @@ -237,6 +238,9 @@ public: QTableView * tableView(); bool readOnly() const {return read_only;} + + void setDebugEnabled(bool on) {debug = on;} + bool isDebugEnabled() const {return debug;} const ColumnProperties * columnProperty(int index) const {if (index < 0 || index >= column_props.count()) return 0; return &(column_props[index]);} const ColumnProperties * columnProperty(const QString & name) const {return columnProperty(columnByName(name));} @@ -319,7 +323,7 @@ private: QMap > translates, fixed_translates; QMap col_vis; int timer; - bool filters_active, table_opened, read_only, first_update; + bool filters_active, table_opened, read_only, first_update, debug; static QString _dir; QPoint pp; QString connection_name;