#include "SUPERVGUI_CanvasCellNodePrs.h"
#include <qtooltip.h>
-//#include <qpointarray.h>
#define TEXT_MARGIN 5
#define ADDNODES(NodesName,LevelHasDiffNT) \
cell->show(); \
} \
update(); \
- x += (CELL_WIDTH + CELL_SPACE); \
+ if (co < (ncols-1)) x += (CELL_WIDTH + CELL_SPACE); \
}
if( (!aRed.isEmpty()) && (!aGreen.isEmpty()) && (!aBlue.isEmpty()) )
aColor = QColor(aRed.toInt(), aGreen.toInt(), aBlue.toInt());
setBackgroundColor(aColor);
- myOldThreadNum = 0;
}
SUPERVGUI_CanvasArray::~SUPERVGUI_CanvasArray() {
++aIt;
delete anObj;
}
-
delete aCellList;
-
- QObjectList* aCellEndList = queryList("SUPERVGUI_CanvasCellEndNode");
- QObjectListIt aItEnd(*aCellEndList);
- QObject* anObjEnd;
- while ((anObjEnd = aItEnd.current()) != 0) {
- ++aItEnd;
- delete anObjEnd;
- }
-
- delete aCellEndList;
}
void SUPERVGUI_CanvasArray::sync() {
ihmNode->sync();
}
delete ihmList;
-
- SUPERVGUI_CanvasCellEndNode* ihmNodeEnd;
- QObjectList* ihmListEnd = queryList("SUPERVGUI_CanvasCellEndNode");
- QObjectListIt itEnd(*ihmListEnd);
- while ((ihmNodeEnd=(SUPERVGUI_CanvasCellEndNode*)itEnd.current()) != 0) {
- ++itEnd;
- ihmNodeEnd->sync();
- }
- delete ihmListEnd;
}
bool SUPERVGUI_CanvasArray::create() {
// there is no any calculations
if (ncols == 0) return false;
-
+
QPen pen(Qt::SolidLine);
pen.setWidth(1);
QBrush br(MAIN_TITLE);
- if (myOldThreadNum) { //some of threads allready exist on canvas array
- QObjectList* aThreadList = queryList("QCanvasRectangle");
- QObjectListIt aItThread(*aThreadList);
- QCanvasRectangle* anObjThread;
- while ((anObjThread = (QCanvasRectangle*)aItThread.current()) != 0) {
- ++aItThread;
- if (!anObjThread->isVisible())
- anObjThread->show();
- }
- delete aThreadList;
-
- QObjectList* aTextList = queryList("QCanvasText");
- QObjectListIt aItText(*aTextList);
- QCanvasText* anObjText;
- while ((anObjText = (QCanvasText*)aItText.current()) != 0) {
- ++aItText;
- if (!anObjText->isVisible())
- anObjText->show();
- }
- delete aTextList;
- }
-
- for (int co = myOldThreadNum; co < ncols; co++) {
+ for (int co = 0; co < ncols; co++) {
aLabel = QString("Thread %1").arg(co);
QRect aRect = QRect(50 + co * (CELL_WIDTH + CELL_SPACE), 20, CELL_WIDTH, CELL_HEIGHT);
QCanvasRectangle* aThread = new QCanvasRectangle(aRect, this);
aText->show();
}
- myOldThreadNum = ncols;
-
y = 60;
bool LevelHasDiffNT = false;
for (int li = 0; li <= nligs; li++) {
++aIt;
((SUPERVGUI_CanvasCellNode*)anObj)->getPrs()->hide();
}
-
delete aCellList;
- QObjectList* aCellEndList = queryList("SUPERVGUI_CanvasCellEndNode");
- QObjectListIt aItEnd(*aCellEndList);
- QObject* anObjEnd;
- while ((anObjEnd = aItEnd.current()) != 0) {
- ++aItEnd;
- ((SUPERVGUI_CanvasCellEndNode*)anObjEnd)->getPrs()->hide();
- }
-
- delete aCellEndList;
-
- QObjectList* aThreadList = queryList("QCanvasRectangle");
- QObjectListIt aItThread(*aThreadList);
- QCanvasRectangle* anObjThread;
- while ((anObjThread = (QCanvasRectangle*)aItThread.current()) != 0) {
- ++aItThread;
- anObjThread->hide();
- }
-
- delete aThreadList;
-
- QObjectList* aTextList = queryList("QCanvasText");
- QObjectListIt aItText(*aTextList);
- QCanvasText* anObjText;
- while ((anObjText = (QCanvasText*)aItText.current()) != 0) {
- ++aItText;
- anObjText->hide();
+ // mkr : delete QCanvasRectangle and QCanvasText canvas items for each Thread.
+ // Threads will be recreate when create() function is called
+ QCanvasItemList aTextList = allItems();
+ for (QCanvasItemList::Iterator aItText = aTextList.begin(); aItText != aTextList.end(); ++aItText) {
+ SUPERVGUI_CanvasCellNodePrs* aPrs = dynamic_cast<SUPERVGUI_CanvasCellNodePrs*>(*aItText);
+ if (!aPrs) {
+ (*aItText)->hide();
+ delete *aItText;
+ }
}
-
- delete aTextList;
-
}
SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasArray::getCellNode(SUPERV::CNode_ptr theNode) const