fixed big fail
This commit is contained in:
parent
4d781c3523
commit
308dc809eb
@ -6,21 +6,24 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
spinBase = ui->spinBase;
|
||||
spinExp = ui->spinExp;
|
||||
spinMod = ui->spinMod;
|
||||
|
||||
//SQMTableModel test;
|
||||
//resultTable->setModel(&test);
|
||||
//resultTable->show();
|
||||
|
||||
connect(spinBase, SIGNAL(valueChanged(int)), this, SLOT(SetModel()));
|
||||
connect(spinExp, SIGNAL(valueChanged(int)), this, SLOT(SetModel()));
|
||||
connect(spinMod, SIGNAL(valueChanged(int)), this, SLOT(SetModel()));
|
||||
|
||||
resultTable = ui->resultTable;
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::SetModel() {
|
||||
@ -28,6 +31,8 @@ void MainWindow::SetModel() {
|
||||
int exp = spinExp->value();
|
||||
int mod = spinMod->value();
|
||||
|
||||
|
||||
resultTableModel->SetStartValues(base, exp, mod);
|
||||
resultTable->setModel(resultTableModel);
|
||||
resultTable->show();
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ SQMTableModel::SQMTableModel(QObject *parent)
|
||||
}
|
||||
|
||||
|
||||
int SQMTableModel::rowCount(const QModelIndex & parent) const {
|
||||
return binLen;
|
||||
int SQMTableModel::rowCount(const QModelIndex & /*parent*/) const {
|
||||
return 2;
|
||||
}
|
||||
|
||||
int SQMTableModel::columnCount(const QModelIndex & parent) const {
|
||||
int SQMTableModel::columnCount(const QModelIndex & /*parent*/) const {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -26,6 +26,20 @@ QVariant SQMTableModel::data(const QModelIndex &index, int role) const {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant SQMTableModel::headerData(int section, Qt::Orientation orientation, int role) const {
|
||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return QString("BIN");
|
||||
case 1:
|
||||
return QString("SQN");
|
||||
case 2:
|
||||
return QString("MUL");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
bool SQMTableModel::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||
if (role == Qt::EditRole) {
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
void SetStartValues(int pBase, int pExp, int pMod);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user