/* * Constructs a GraphWindow as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */ GraphWindow::GraphWindow(QWidget* parent, const char* name, Qt::WFlags fl) : QMainWindow(parent, name, fl) { setupUi(this); (void)statusBar(); // signals and slots connections connect(_hPadSpinbox, SIGNAL(valueChanged(int)), _graph, SLOT(setHPadding(int))); connect(_vPadSpinbox, SIGNAL(valueChanged(int)), _graph, SLOT(setVPadding(int))); connect(_titleEdit, SIGNAL(textChanged(const QString&)), _graph, SLOT(setTitle(const QString&))); connect(_dataEdit, SIGNAL(textChanged(const QString&)), _graph, SLOT(setDataLabel(const QString&))); connect(_valueEdit, SIGNAL(textChanged(const QString&)), _graph, SLOT(setValueLabel(const QString&))); connect(_maxValueSpinbox, SIGNAL(valueChanged(int)), _graph, SLOT(setMaxValue(int))); connect(_minValueSpinbox, SIGNAL(valueChanged(int)), _graph, SLOT(setMinValue(int))); connect(_numSetSpinbox, SIGNAL(valueChanged(int)), _dataTable, SLOT(setNumCols(int))); connect(_numRefSpinbox, SIGNAL(valueChanged(int)), _dataTable, SLOT(setNumRows(int))); connect(_dataTable, SIGNAL(valueChanged(int,int)), this, SLOT(_dataTable_valueChanged(int,int))); connect(_labelTable, SIGNAL(valueChanged(int,int)), this, SLOT(_labelTable_valueChanged(int,int))); connect(_numRefSpinbox, SIGNAL(valueChanged(int)), _labelTable, SLOT(setNumRows(int))); connect(_cbBars, SIGNAL(toggled(bool)), _graph, SLOT(setDrawBars(bool))); connect(_cbLines, SIGNAL(toggled(bool)), _graph, SLOT(setDrawLines(bool))); connect(_cbPoints, SIGNAL(toggled(bool)), _graph, SLOT(setDrawPoints(bool))); connect(_btnClear, SIGNAL(clicked()), this, SLOT(_btnClear_clicked())); connect(_btnSql, SIGNAL(clicked()), this, SLOT(_btnSql_clicked())); }
void GraphWindow::_btnSql_clicked() { _noUpdate = TRUE; _btnClear_clicked(); QString sql = _editSql->text(); QSqlQuery qry = QSqlQuery(sql); _graph->populateFromResult(qry); _noUpdate = FALSE; }
void GraphWindow::_btnSql_clicked() { _noUpdate = true; _btnClear_clicked(); QString sql = _editSql->toPlainText(); QSqlQuery qry = QSqlQuery(sql); _graph->populateFromResult(qry); _noUpdate = false; }