initial port for Cevo game in C++ (libs)
This commit is contained in:
commit
8436242032
375 files changed
+46282
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#include "Dpi/DpiGrids.h"
|
||||
|
||||
#include <QHeaderView>
|
||||
|
||||
namespace Dpi {
|
||||
|
||||
StringGrid::StringGrid(QWidget *parent) : QTableWidget(parent) {}
|
||||
|
||||
QString StringGrid::cell(int col, int row) const
|
||||
{
|
||||
QTableWidgetItem *it = item(row, col);
|
||||
return it ? it->text() : QString();
|
||||
}
|
||||
|
||||
void StringGrid::setCell(int col, int row, const QString &value)
|
||||
{
|
||||
QTableWidgetItem *it = item(row, col);
|
||||
if (!it) {
|
||||
it = new QTableWidgetItem();
|
||||
setItem(row, col, it);
|
||||
}
|
||||
it->setText(value);
|
||||
}
|
||||
|
||||
void StringGrid::setFixedRows(int value)
|
||||
{
|
||||
m_fixedRows = value;
|
||||
for (int r = 0; r < value && r < rowCount(); ++r)
|
||||
verticalHeader()->resizeSection(r, verticalHeader()->defaultSectionSize());
|
||||
}
|
||||
|
||||
QRect StringGrid::cellRect(int col, int row) const
|
||||
{
|
||||
return visualItemRect(item(row, col));
|
||||
}
|
||||
|
||||
} // namespace Dpi
|
||||
Reference in new issue
Block a user