Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by Scrapbrain ( 14 years ago )
#ifndef ASK_H
#define ASK_H
#include "QDialog"
#include "QStandardItemModel"
using namespace std;
#include <QtGui/QMainWindow>
#include "ui_untitled.h"
class DialogI : public QWidget
{
Q_OBJECT
Ui::Form u;
int n;
public:
DialogI(QWidget * parent = 0, Qt::WindowFlags f = 0);
signals:
void Next(int n, double*f);
private slots:
void okClicked();
void setn();
};
#endif
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qvalidator.h>
#include "Ask.h"
DialogI::DialogI (QWidget * parent, Qt::WindowFlags f): QWidget (parent, f)
{
u.setupUi(this);
n = 0;
connect(u.btnOk, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(u.spinBox, SIGNAL(valueChanged(int)), this, SLOT(setn()));
}
void DialogI::okClicked()
{
int i, j;
bool p = true;
QVector <double> m (n*n);
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
m[i + n*j] = u.tableWidget->item(i, j)->text().toDouble(&p);;
}
void DialogI::setn()
{
int k = u.spinBox->value();
if (n != k)
{
u.tableWidget->setRowCount(n);
u.tableWidget->setColumnCount(n);
}
}
Revise this Paste
Parent: 54875