CG2_Tasks/filter_gui.cpp

59 lines
1.0 KiB
C++

#ifndef FILTER_GUI_C
#define FILTER_GUI_C
#include <QtGlobal>
#include <QMainWindow>
#include <QColor>
#include <qboxlayout.h>
#include <QTableWidget>
#include <iostream>
#include <math.h>
class FilterGui {
private:
QTableWidget* widget;
int filter_size;
void updateGui() {
this->widget->setRowCount(this->filter_size);
this->widget->setColumnCount(this->filter_size);
for(int i=0; i<this->filter_size; i++) {
for(int j=0; j<this->filter_size; j++) {
this->widget->setItem(i, j, new QTableWidgetItem("0"));
}
}
};
public:
FilterGui(int filter_size = 3) {
this->widget = new QTableWidget();
this->setSize(filter_size);
};
~FilterGui() {
delete this->widget;
this->widget = NULL;
};
QTableWidget* getWidget() {
return this->widget;
};
void setSize(int size) {
this->filter_size = size;
this->updateGui();
};
int getSize() {
return this->filter_size;
};
};
#endif