// Конструктор(QString - размеры поля) PaintField::PaintField(const QString &width, const QString &height, QWidget *parent) : QWidget(parent), ui(new Ui::PaintField) { ui->setupUi(this); this->setAttribute(Qt::WA_DeleteOnClose); waveStorage = new QVector<Wave *>(); // Устанавливаем количество строк и столбцов ui->paintField->setColumnCount(width.toInt()); ui->paintField->setRowCount(height.toInt()); // Устанавливаем размер родительского виджета this->setMinimumHeight(height.toInt() * 20); this->setMinimumWidth(width.toInt() * 20); this->setMaximumHeight(height.toInt() * 20); this->setMaximumWidth(width.toInt() * 20); // Заполняем таблицу дефолт значениями QTableWidgetItem *item = new QTableWidgetItem; item->setText(""); for (int r = 0; r < height.toInt(); ++r) for (int c = 0; c < width.toInt(); ++c) ui->paintField->setItem(r, c, item->clone()); delete item; // Связывание сигнала клика на ячейку и слота для обработки клика QObject::connect(ui->paintField, SIGNAL(cellClicked(int, int)), this, SLOT(mouseClickeEvent(int, int))); this->setWindowFlags(Qt::Tool); this->showNormal(); this->activateWindow(); }
int TableWidgetItem::clone ( lua_State * L ) // virtual const { QTableWidgetItem* lhs = ValueInstaller2<QTableWidgetItem>::check( L, 1 ); lhs->clone(); return 0; }