]> sigrok.org Git - pulseview.git/commitdiff
WellArray: Renamed to avoid namespace collissions, now that QWellArray is public
authorJoel Holdsworth <redacted>
Sat, 13 Dec 2014 10:08:05 +0000 (10:08 +0000)
committerJoel Holdsworth <redacted>
Sat, 13 Dec 2014 10:26:08 +0000 (10:26 +0000)
This fixes bug #525

pv/widgets/colourpopup.cpp
pv/widgets/colourpopup.hpp
pv/widgets/wellarray.cpp
pv/widgets/wellarray.hpp

index bd87c88827f5f09099e8a05fb9d8e77d30b5fad3..8c8b1385fa64f562f866d6285ce75f5a6cb46ead 100644 (file)
@@ -37,7 +37,7 @@ ColourPopup::ColourPopup(int rows, int cols, QWidget *parent) :
                this, SLOT(colour_selected(int, int)));
 }
 
                this, SLOT(colour_selected(int, int)));
 }
 
-QWellArray& ColourPopup::well_array()
+WellArray& ColourPopup::well_array()
 {
        return well_array_;
 }
 {
        return well_array_;
 }
index a1ee251c7add8d907036e7dad53e1ccb20f90915..9273b5da5e19228b8a115f57c0ae6deec9fbf6d8 100644 (file)
@@ -36,7 +36,7 @@ class ColourPopup : public Popup
 public:
        ColourPopup(int rows, int cols, QWidget *partent);
 
 public:
        ColourPopup(int rows, int cols, QWidget *partent);
 
-       QWellArray& well_array();
+       WellArray& well_array();
 
 Q_SIGNALS:
        void selected(int row, int col);
 
 Q_SIGNALS:
        void selected(int row, int col);
@@ -45,7 +45,7 @@ private Q_SLOTS:
        void colour_selected(int, int);
 
 private:
        void colour_selected(int, int);
 
 private:
-       QWellArray well_array_;
+       WellArray well_array_;
        QVBoxLayout layout_;
 };
 
        QVBoxLayout layout_;
 };
 
index 26c257acd691c20f09b3f2d665855c64c6990d66..a9418317b072fceae3cf45f25f3656113578cfbf 100644 (file)
 
 #include "wellarray.hpp"
 
 
 #include "wellarray.hpp"
 
-void QWellArray::paintEvent(QPaintEvent *e)
+namespace pv {
+namespace widgets {
+
+void WellArray::paintEvent(QPaintEvent *e)
 {
     QRect r = e->rect();
     int cx = r.x();
 {
     QRect r = e->rect();
     int cx = r.x();
@@ -93,11 +96,11 @@ void QWellArray::paintEvent(QPaintEvent *e)
     }
 }
 
     }
 }
 
-struct QWellArrayData {
+struct WellArrayData {
     QBrush *brush;
 };
 
     QBrush *brush;
 };
 
-QWellArray::QWellArray(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)
 {
@@ -111,14 +114,14 @@ QWellArray::QWellArray(int rows, int cols, QWidget *parent)
     selRow = -1;
 }
 
     selRow = -1;
 }
 
-QSize QWellArray::sizeHint() const
+QSize WellArray::sizeHint() const
 {
     ensurePolished();
     return gridSize().boundedTo(QSize(640, 480));
 }
 
 
 {
     ensurePolished();
     return gridSize().boundedTo(QSize(640, 480));
 }
 
 
-void QWellArray::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
 
@@ -148,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 QWellArray::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]);
@@ -160,14 +163,14 @@ void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r
     }
 }
 
     }
 }
 
-void QWellArray::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 QWellArray::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);
@@ -179,7 +182,7 @@ void QWellArray::mouseReleaseEvent(QMouseEvent * /* event */)
   the same as the currently selected cell.
 */
 
   the same as the currently selected cell.
 */
 
-void QWellArray::setCurrent(int row, int col)
+void WellArray::setCurrent(int row, int col)
 {
     if ((curRow == row) && (curCol == col))
         return;
 {
     if ((curRow == row) && (curCol == col))
         return;
@@ -203,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 QWellArray::setSelected(int row, int col)
+void WellArray::setSelected(int row, int col)
 {
     int oldRow = selRow;
     int oldCol = selCol;
 {
     int oldRow = selRow;
     int oldCol = selCol;
@@ -220,15 +223,15 @@ void QWellArray::setSelected(int row, int col)
         Q_EMIT selected(row, col);
 }
 
         Q_EMIT selected(row, col);
 }
 
-void QWellArray::focusInEvent(QFocusEvent*)
+void WellArray::focusInEvent(QFocusEvent*)
 {
     updateCell(curRow, curCol);
 }
 
 {
     updateCell(curRow, curCol);
 }
 
-void QWellArray::setCellBrush(int row, int col, const QBrush &b)
+void WellArray::setCellBrush(int row, int col, const QBrush &b)
 {
     if (!d) {
 {
     if (!d) {
-        d = new QWellArrayData;
+        d = new WellArrayData;
         int i = numRows()*numCols();
         d->brush = new QBrush[i];
     }
         int i = numRows()*numCols();
         d->brush = new QBrush[i];
     }
@@ -241,7 +244,7 @@ void QWellArray::setCellBrush(int row, int col, const QBrush &b)
   set, Qt::NoBrush is returned.
 */
 
   set, Qt::NoBrush is returned.
 */
 
-QBrush QWellArray::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];
@@ -253,14 +256,14 @@ QBrush QWellArray::cellBrush(int row, int col)
 /*!\reimp
 */
 
 /*!\reimp
 */
 
-void QWellArray::focusOutEvent(QFocusEvent*)
+void WellArray::focusOutEvent(QFocusEvent*)
 {
     updateCell(curRow, curCol);
 }
 
 /*\reimp
 */
 {
     updateCell(curRow, curCol);
 }
 
 /*\reimp
 */
-void QWellArray::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,
@@ -288,3 +291,6 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
     }
 
 }
     }
 
 }
+
+} // namespace wellarray
+} // namespace pv
index ebe3c00019023c7370c060ef3a59d6ba6319269c..8132eb0076c35fd69ea35154a456ead64cdb2566 100644 (file)
 
 #include <QWidget>
 
 
 #include <QWidget>
 
-struct QWellArrayData;
+namespace pv {
+namespace widgets {
 
 
-class QWellArray : public QWidget
+struct WellArrayData;
+
+class WellArray : public QWidget
 {
     Q_OBJECT
     Q_PROPERTY(int selectedColumn READ selectedColumn)
     Q_PROPERTY(int selectedRow READ selectedRow)
 
 public:
 {
     Q_OBJECT
     Q_PROPERTY(int selectedColumn READ selectedColumn)
     Q_PROPERTY(int selectedRow READ selectedRow)
 
 public:
-    QWellArray(int rows, int cols, QWidget* parent=0);
+    WellArray(int rows, int cols, QWidget* parent=0);
     QString cellContent(int row, int col) const;
 
     int selectedColumn() const { return selCol; }
     QString cellContent(int row, int col) const;
 
     int selectedColumn() const { return selCol; }
@@ -119,7 +122,7 @@ protected:
     void paintEvent(QPaintEvent *);
 
 private:
     void paintEvent(QPaintEvent *);
 
 private:
-    Q_DISABLE_COPY(QWellArray)
+    Q_DISABLE_COPY(WellArray)
 
     int nrows;
     int ncols;
 
     int nrows;
     int ncols;
@@ -129,5 +132,8 @@ private:
     int curCol;
     int selRow;
     int selCol;
     int curCol;
     int selRow;
     int selCol;
-    QWellArrayData *d;
+    WellArrayData *d;
 };
 };
+
+} // namespace wellarray
+} // namespace pv