**
****************************************************************************/
-#include <QPainter>
#include <QPaintEvent>
+#include <QPainter>
#include <QStyle>
#include <QStyleOptionFrame>
namespace pv {
namespace widgets {
-void WellArray::paintEvent(QPaintEvent *e)
+void WellArray::paintEvent(QPaintEvent *event)
{
- QRect r = e->rect();
+ QRect r = event->rect();
int cx = r.x();
int cy = r.y();
int ch = r.height();
: QWidget(parent)
,nrows(rows), ncols(cols)
{
- d = 0;
+ d = nullptr;
setFocusPolicy(Qt::StrongFocus);
cellw = 28;
cellh = 24;
{
int b = 3; //margin
- const QPalette & g = palette();
+ const QPalette& g = palette();
QStyleOptionFrame opt;
int dfw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
opt.lineWidth = dfw;
}
}
-void WellArray::mousePressEvent(QMouseEvent *e)
+void WellArray::mousePressEvent(QMouseEvent *event)
{
// The current cell marker is set to the cell the mouse is pressed in
- QPoint pos = e->pos();
+ QPoint pos = event->pos();
setCurrent(rowAt(pos.y()), columnAt(pos.x()));
}
/*\reimp
*/
-void WellArray::keyPressEvent(QKeyEvent* e)
+void WellArray::keyPressEvent(QKeyEvent* event)
{
- switch(e->key()) { // Look at the key code
+ switch (event->key()) { // Look at the key code
case Qt::Key_Left: // If 'left arrow'-key,
- if(curCol > 0) // and cr't not in leftmost col
+ if (curCol > 0) // and cr't not in leftmost col
setCurrent(curRow, curCol - 1); // set cr't to next left column
break;
case Qt::Key_Right: // Correspondingly...
- if(curCol < numCols()-1)
+ if (curCol < numCols()-1)
setCurrent(curRow, curCol + 1);
break;
case Qt::Key_Up:
- if(curRow > 0)
+ if (curRow > 0)
setCurrent(curRow - 1, curCol);
break;
case Qt::Key_Down:
- if(curRow < numRows()-1)
+ if (curRow < numRows()-1)
setCurrent(curRow + 1, curCol);
break;
case Qt::Key_Space:
setSelected(curRow, curCol);
break;
default: // If not an interesting key,
- e->ignore(); // we don't accept the event
+ event->ignore(); // we don't accept the event
return;
}
}
-} // namespace wellarray
+} // namespace widgets
} // namespace pv