projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor whitespace cosmetics.
[pulseview.git]
/
pv
/
widgets
/
wellarray.cpp
diff --git
a/pv/widgets/wellarray.cpp
b/pv/widgets/wellarray.cpp
index a5979db7183d79696a659483157beb1a84076705..1f3bf69825ac7434a0a7e4a7b612342b6b9e4dce 100644
(file)
--- a/
pv/widgets/wellarray.cpp
+++ b/
pv/widgets/wellarray.cpp
@@
-39,16
+39,17
@@
**
****************************************************************************/
**
****************************************************************************/
-#define QT_NO_MENU
-
#include <QPainter>
#include <QPaintEvent>
#include <QStyle>
#include <QStyleOptionFrame>
#include <QPainter>
#include <QPaintEvent>
#include <QStyle>
#include <QStyleOptionFrame>
-#include "wellarray.h"
+#include "wellarray.hpp"
+
+namespace pv {
+namespace widgets {
-void
Q
WellArray::paintEvent(QPaintEvent *e)
+void WellArray::paintEvent(QPaintEvent *e)
{
QRect r = e->rect();
int cx = r.x();
{
QRect r = e->rect();
int cx = r.x();
@@
-95,11
+96,11
@@
void QWellArray::paintEvent(QPaintEvent *e)
}
}
}
}
-struct
Q
WellArrayData {
+struct WellArrayData {
QBrush *brush;
};
QBrush *brush;
};
-
QWellArray::Q
WellArray(int rows, int cols, QWidget *parent)
+
WellArray::
WellArray(int rows, int cols, QWidget *parent)
: QWidget(parent)
,nrows(rows), ncols(cols)
{
: QWidget(parent)
,nrows(rows), ncols(cols)
{
@@
-113,14
+114,14
@@
QWellArray::QWellArray(int rows, int cols, QWidget *parent)
selRow = -1;
}
selRow = -1;
}
-QSize
Q
WellArray::sizeHint() const
+QSize WellArray::sizeHint() const
{
ensurePolished();
return gridSize().boundedTo(QSize(640, 480));
}
{
ensurePolished();
return gridSize().boundedTo(QSize(640, 480));
}
-void
Q
WellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
+void WellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
{
int b = 3; //margin
{
int b = 3; //margin
@@
-150,7
+151,7
@@
void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
/*!
Reimplement this function to change the contents of the well array.
*/
/*!
Reimplement this function to change the contents of the well array.
*/
-void
Q
WellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r)
+void WellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r)
{
if (d) {
p->fillRect(r, d->brush[row*numCols()+col]);
{
if (d) {
p->fillRect(r, d->brush[row*numCols()+col]);
@@
-162,14
+163,14
@@
void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r
}
}
}
}
-void
Q
WellArray::mousePressEvent(QMouseEvent *e)
+void WellArray::mousePressEvent(QMouseEvent *e)
{
// The current cell marker is set to the cell the mouse is pressed in
QPoint pos = e->pos();
setCurrent(rowAt(pos.y()), columnAt(pos.x()));
}
{
// The current cell marker is set to the cell the mouse is pressed in
QPoint pos = e->pos();
setCurrent(rowAt(pos.y()), columnAt(pos.x()));
}
-void
Q
WellArray::mouseReleaseEvent(QMouseEvent * /* event */)
+void WellArray::mouseReleaseEvent(QMouseEvent * /* event */)
{
// The current cell marker is set to the cell the mouse is clicked in
setSelected(curRow, curCol);
{
// The current cell marker is set to the cell the mouse is clicked in
setSelected(curRow, curCol);
@@
-181,7
+182,7
@@
void QWellArray::mouseReleaseEvent(QMouseEvent * /* event */)
the same as the currently selected cell.
*/
the same as the currently selected cell.
*/
-void
Q
WellArray::setCurrent(int row, int col)
+void WellArray::setCurrent(int row, int col)
{
if ((curRow == row) && (curCol == col))
return;
{
if ((curRow == row) && (curCol == col))
return;
@@
-205,7
+206,7
@@
void QWellArray::setCurrent(int row, int col)
Does not set the position of the focus indicator.
*/
Does not set the position of the focus indicator.
*/
-void
Q
WellArray::setSelected(int row, int col)
+void WellArray::setSelected(int row, int col)
{
int oldRow = selRow;
int oldCol = selCol;
{
int oldRow = selRow;
int oldCol = selCol;
@@
-219,23
+220,18
@@
void QWellArray::setSelected(int row, int col)
updateCell(oldRow, oldCol);
updateCell(selRow, selCol);
if (row >= 0)
updateCell(oldRow, oldCol);
updateCell(selRow, selCol);
if (row >= 0)
- emit selected(row, col);
-
-#ifndef QT_NO_MENU
- if (isVisible() && qobject_cast<QMenu*>(parentWidget()))
- parentWidget()->close();
-#endif
+ Q_EMIT selected(row, col);
}
}
-void
Q
WellArray::focusInEvent(QFocusEvent*)
+void WellArray::focusInEvent(QFocusEvent*)
{
updateCell(curRow, curCol);
}
{
updateCell(curRow, curCol);
}
-void
Q
WellArray::setCellBrush(int row, int col, const QBrush &b)
+void WellArray::setCellBrush(int row, int col, const QBrush &b)
{
if (!d) {
{
if (!d) {
- d = new
Q
WellArrayData;
+ d = new WellArrayData;
int i = numRows()*numCols();
d->brush = new QBrush[i];
}
int i = numRows()*numCols();
d->brush = new QBrush[i];
}
@@
-248,7
+244,7
@@
void QWellArray::setCellBrush(int row, int col, const QBrush &b)
set, Qt::NoBrush is returned.
*/
set, Qt::NoBrush is returned.
*/
-QBrush
Q
WellArray::cellBrush(int row, int col)
+QBrush WellArray::cellBrush(int row, int col)
{
if (d && row >= 0 && row < numRows() && col >= 0 && col < numCols())
return d->brush[row*numCols()+col];
{
if (d && row >= 0 && row < numRows() && col >= 0 && col < numCols())
return d->brush[row*numCols()+col];
@@
-260,30
+256,30
@@
QBrush QWellArray::cellBrush(int row, int col)
/*!\reimp
*/
/*!\reimp
*/
-void
Q
WellArray::focusOutEvent(QFocusEvent*)
+void WellArray::focusOutEvent(QFocusEvent*)
{
updateCell(curRow, curCol);
}
/*\reimp
*/
{
updateCell(curRow, curCol);
}
/*\reimp
*/
-void
Q
WellArray::keyPressEvent(QKeyEvent* e)
+void WellArray::keyPressEvent(QKeyEvent* e)
{
switch(e->key()) { // Look at the key code
case Qt::Key_Left: // If 'left arrow'-key,
{
switch(e->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...
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:
setCurrent(curRow, curCol + 1);
break;
case Qt::Key_Up:
- if(curRow > 0)
+ if
(curRow > 0)
setCurrent(curRow - 1, curCol);
break;
case Qt::Key_Down:
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:
setCurrent(curRow + 1, curCol);
break;
case Qt::Key_Space:
@@
-295,3
+291,6
@@
void QWellArray::keyPressEvent(QKeyEvent* e)
}
}
}
}
+
+} // namespace wellarray
+} // namespace pv