42 #include <QPaintEvent> 45 #include <QStyleOptionFrame> 54 QRect r =
event->rect();
61 int rowfirst =
rowAt(cy);
62 int rowlast =
rowAt(cy + ch);
64 if (isRightToLeft()) {
70 QPainter painter(
this);
71 QPainter *p = &painter;
75 if (collast < 0 || collast >=
ncols)
77 if (rowlast < 0 || rowlast >=
nrows)
81 for (
int r = rowfirst; r <= rowlast; ++r) {
88 for (
int c = colfirst; c <= collast; ++c) {
92 rect.translate(colp, rowp);
94 rect.translate(-colp, -rowp);
108 setFocusPolicy(Qt::StrongFocus);
120 return gridSize().boundedTo(QSize(640, 480));
128 const QPalette& g = palette();
129 QStyleOptionFrame opt;
130 int dfw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
132 opt.midLineWidth = 1;
133 opt.rect = rect.adjusted(b, b, -b, -b);
135 opt.state = QStyle::State_Enabled | QStyle::State_Sunken;
136 style()->drawPrimitive(QStyle::PE_Frame, &opt, p,
this);
141 QStyleOptionFocusRect opt;
144 opt.state = QStyle::State_None | QStyle::State_KeyboardFocusChange;
145 style()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p,
this);
159 p->fillRect(r, Qt::white);
160 p->setPen(Qt::black);
161 p->drawLine(r.topLeft(), r.bottomRight());
162 p->drawLine(r.topRight(), r.bottomLeft());
169 QPoint pos =
event->pos();
190 if (row < 0 || col < 0)
214 if (row < 0 || col < 0)
267 switch (event->key()) {
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16