new SQLTableWidget::debugEnabled property

This commit is contained in:
2020-10-09 11:42:33 +03:00
parent cadfe1259e
commit f53d5bd53b
2 changed files with 9 additions and 5 deletions

View File

@@ -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;

View File

@@ -17,8 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MYSQLTABLE_H
#define MYSQLTABLE_H
#ifndef SQL_TABLE_WIDGET_H
#define SQL_TABLE_WIDGET_H
#include <QSqlDatabase>
#include <QSqlQuery>
@@ -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<QString, QPair<QString, QString> > translates, fixed_translates;
QMap<QString, bool> 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;