1 /**************************************************************************
2 Ghosts Overboard - a game for Maemo 5
4 Copyright (C) 2011 Heli Hyvättinen
6 This file is part of Ghosts Overboard
8 Ghosts Overboard is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 **************************************************************************/
26 #include <QGraphicsPixmapItem>
28 #include <QMessageBox>
30 #include <QApplication>
32 #include <QPushButton>
34 #include <QVBoxLayout>
38 const QString ghostImageFilename_ = ":/pix/aave.png";
39 const QString rockImageFilename_ =":/pix/kari.png";
40 const QString octopusImageFilename_= ":/pix/tursas.png";
43 SeaScene::SeaScene(QObject *parent) :
44 QGraphicsScene(parent)
47 setItemPointersNull();
50 screenLitKeeper_.keepScreenLit(true);
56 QPixmap waves (":/pix/meri.png");
58 setBackgroundBrush(QBrush(waves));
62 qsrand(QTime::currentTime().msec()+2); //+2 to avoid setting it to 1
68 QList<Level> levelList;
70 levelList.append(level1);
71 Level level2(5,10,2,50);
72 levelList.append(level2);
73 Level level3(5,15,2,50);
74 levelList.append(level3);
75 Level level4(5,15,4,50);
76 levelList.append(level4);
77 Level level5(5,15,5,100);
78 levelList.append(level5);
80 Levelset set ("Original",levelList);
81 availableLevelsets_.append(set);
84 //Create another set of levels and place it in the available levelsets list
86 Level set2level1(8,15,4,50);
87 levelList.append(set2level1);
88 Level set2level2(8,20,4,50);
89 levelList.append(set2level2);
90 Level set2level3(8,20,5,80);
91 levelList.append(set2level3);
92 Level set2level4(8,20,6,120);
93 levelList.append(set2level4);
94 Level set2level5(8,25,8,150);
95 levelList.append(set2level5);
97 Levelset set2("Difficult",levelList);
98 availableLevelsets_.append(set2);
101 //Setup starting levelset
103 QString levelname = settings.value("levelset","Original").toString();
105 foreach (Levelset levelset, availableLevelsets_)
107 if (levelset.getName() == levelname)
109 levelset_ = levelset;
115 if (!found) //The last used level is not available
117 levelset_ = availableLevelsets_.value(0);
126 connect(this,SIGNAL(allGhostsPicked()),this,SLOT(nextLevel()));
128 pVibrateAction_ = new QAction(tr("Vibration effects"),this);
129 pVibrateAction_->setCheckable(true);
130 connect(pVibrateAction_,SIGNAL(toggled(bool)),this,SLOT(vibrationActivate(bool)));
132 pVibrateAction_->setChecked(settings.value("vibration",false).toBool());
135 pPauseAction_ = new QAction(tr("Pause"),this);
136 pPauseAction_->setCheckable(true);
137 connect(pPauseAction_,SIGNAL(toggled(bool)),this,SLOT(pause(bool)));
140 deviceLockPollTimer_.setInterval(20*60);
141 connect(&deviceLockPollTimer_,SIGNAL(timeout()),this,SLOT(pollDeviceLocked()));
142 deviceLockPollTimer_.start();
145 autopauseTimer.setSingleShot(true);
146 autopauseTimer.setInterval(15*60*1000);
147 connect(&autopauseTimer,SIGNAL(timeout()),this,SLOT(turnPauseOn()));
152 void SeaScene::setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed)
158 setItemPointersNull();
162 createAboutBoxItems();
164 createSelectLevelsetFromListItems();
166 createVictoryItems();
168 createLevelCompletedItems();
171 //empty the list of moving items
173 movingItems_.clear();
175 //empty the list of free slots
178 //fill the list of free slots
180 int numberOfXTiles = width() / 40;
181 int numberOfYTiles = height() /40;
183 // qDebug() << numberOfXTiles << " slots in x direction";
184 // qDebug() << numberOfYTiles << " slots in y rirection";
186 for (int i = 0; i < numberOfXTiles; i++ )
188 for (int j = 0; j < numberOfYTiles; j++)
190 freeTiles_.append(QPointF(i*40,j*40));
197 for (int i = 0; i < rocks; i++)
199 QPointF * pPosition = findRandomFreeSlot();
201 //If there was no room no point to continue
202 if (pPosition == NULL)
205 QPixmap rockPixmap (":/pix/kari.png");
206 QGraphicsPixmapItem * pRock = addPixmap(rockPixmap);
207 pRock->setData(0,"rock");
208 pRock->setPos(*pPosition);
215 ghostsLeft_ = ghosts;
216 spreadGhosts(ghosts);
220 //spread the octopuses
222 QList <Octopus*> octopusList;
224 for (int i=0; i < octopuses; i++)
226 QPointF * pPosition = findRandomFreeSlot();
228 //If there was no room no point to continue
229 if (pPosition == NULL)
232 QPixmap octopusPixmap (":/pix/tursas.png");
233 Octopus * pOctopus = new Octopus(octopusPixmap,octopusSpeed);
234 pOctopus->setData(0,"octopus");
235 pOctopus->setPos(*pPosition);
237 pOctopus->startMoving();
238 movingItems_.append(pOctopus);
239 connect(this,SIGNAL(pauseOn()),pOctopus,SLOT(stopMoving()));
240 connect(this,SIGNAL(pauseOff()),pOctopus,SLOT(startMoving()));
241 octopusList.append(pOctopus);
249 QPointF * pPosition = findRandomFreeSlot();
250 if (pPosition == NULL)
252 // Game cannot begin without a free position for ship, so give an error message and return
254 QMessageBox::critical(NULL,"Error! Too many objects on screen","No free space to place the ship. The game cannot start. Please choose another level.");
258 QList<QPixmap> shipImages;
259 shipImages.append(QPixmap(":/pix/laiva.png"));
260 shipImages.append(QPixmap(":/pix/laiva_1aave.png"));
261 shipImages.append(QPixmap(":/pix/laiva_2aave.png"));
262 shipImages.append(QPixmap(":/pix/laiva_3aave.png"));
263 shipImages.append(QPixmap(":/pix/laiva_4aave.png"));
264 shipImages.append(QPixmap(":/pix/laiva_5aave.png"));
265 shipImages.append(QPixmap(":/pix/laiva_6aave.png"));
266 shipImages.append(QPixmap(":/pix/laiva_7aave.png"));
267 shipImages.append(QPixmap(":/pix/laiva_8aave.png"));
268 shipImages.append(QPixmap(":/pix/laiva_9aave.png"));
269 shipImages.append(QPixmap(":/pix/laiva_10aave.png"));
271 Ship * pShip = new Ship (shipImages);
272 pShip->setData(0,"ship");
273 pShip->setPos(*pPosition);
275 connect(pShip,SIGNAL(pickingGhost(QGraphicsItem*)),this, SLOT(removeGhost(QGraphicsItem*)) );
276 connect(pShip,SIGNAL(droppingGhosts(int)),this,SLOT(ghostsDropped(int)));
277 connect(this,SIGNAL(vibrationActivated(bool)),pShip,SLOT(setVibrationActivate(bool)));
278 pShip->startMoving();
279 movingItems_.append(pShip);
280 connect(this,SIGNAL(pauseOn()),pShip,SLOT(stopMoving()));
281 connect(this,SIGNAL(pauseOff()),pShip,SLOT(startMoving()));
282 foreach (Octopus* pOctopus, octopusList)
284 connect(pOctopus,SIGNAL(droppingGhosts()),pShip,SLOT(dropAllGhosts()));
289 void SeaScene::setupMap(Level level)
291 setupMap(level.getNumberOfGhosts(),level.getNumberOfRocks(),level.getNumberOfOctopuses(),level.getOctopusSpeed());
294 void SeaScene::spreadGhosts(int ghosts)
298 //the octopuses and the ship may have moved from their original positions,
299 //so the list of free slots must be adjusted to exclude their current positions
301 QList<QPointF> temporarilyReservedSlots;
303 foreach (QGraphicsItem* pItem, movingItems_)
307 // qDebug() << "NULL item in movingItems_";
311 //round x and y down to fit the slot size
321 QPointF position (x,y);
323 //remove the tiles (potentially) occupied by the item from free slots and place in temp list if was in the list before
325 if (freeTiles_.removeOne(position))
326 temporarilyReservedSlots.append(position);
331 if (freeTiles_.removeOne(position))
332 temporarilyReservedSlots.append(position);
336 if (freeTiles_.removeOne(position))
337 temporarilyReservedSlots.append(position);
341 if (freeTiles_.removeOne(position))
342 temporarilyReservedSlots.append(position);
347 //spread ghosts in random free slots
349 for (int i=0; i < ghosts; i++)
351 QPointF * pPosition = findRandomFreeSlot();
353 //If there was no room no point to continue
354 if (pPosition == NULL)
357 QPixmap ghostPixmap(":/pix/aave.png");
358 QGraphicsPixmapItem * pGhost = addPixmap(ghostPixmap);
359 pGhost->setData(0,"ghost");
360 pGhost->setPos(*pPosition);
364 //return the slots occupied by moving items to free slots
365 freeTiles_.append(temporarilyReservedSlots);
367 //clear temp for the next round
368 temporarilyReservedSlots.clear();
371 QPointF* SeaScene::findRandomFreeSlot()
373 if (freeTiles_.isEmpty())
376 int index = qrand()%freeTiles_.size();
378 // qDebug() << index << " index";
379 return new QPointF (freeTiles_.takeAt(index));
383 void SeaScene::removeGhost(QGraphicsItem *pGhost)
385 removeItem(pGhost); //remove the item from scene
386 freeTiles_.append(pGhost->scenePos()); //add the item's position to free slots
389 if (ghostsLeft_ == 0)
391 emit allGhostsPicked();
392 // qDebug() << "All ghosts picked!";
396 void SeaScene::ghostsDropped(int ghosts)
398 ghostsLeft_ += ghosts;
400 spreadGhosts(ghosts);
403 void SeaScene::pause(bool paused)
405 // qDebug() << "pause pressed " << paused;
406 if (paused_ == paused)
413 // qDebug() << "starting to move again";
414 emit fullscreenRequested();
416 screenLitKeeper_.keepScreenLit(true);
418 pPausetextItem_->hide();
420 scoreCounter_.start();
422 autopauseTimer.start(); //Start counting towards autopause
423 deviceLockPollTimer_.start(); //Start polling whether device is locked
428 // qDebug("about to stop movement");
430 screenLitKeeper_.keepScreenLit(false);
431 if (pPausetextItem_ != NULL)
433 // qDebug() << "about to show the pause text";
434 pPausetextItem_->show();
435 // qDebug() << "showing pause text";
437 // else qDebug() << "No pause text available";
439 levelScore_ += scoreCounter_.elapsed();
441 autopauseTimer.stop(); //No need to count toward autopause when already paused
442 deviceLockPollTimer_.stop(); //No need to check for unlock as no unpause anyway
446 void SeaScene::vibrationActivate(bool on)
448 emit vibrationActivated(on);
451 void SeaScene::handleScreenTapped()
454 //If the game is going just pause it
457 pPauseAction_->setChecked(true);
461 //If the game is paused and about box is shown, close it and show the pause text and menu again
465 if(pAboutBoxItem_->isVisible())
467 pAboutBoxItem_->hide();
468 pPausetextItem_->show();
473 //If the game is paused, check if the level completed item is shown
475 if (pLevelCompletedItem_)
477 if (pLevelCompletedItem_->isVisible())
479 pLevelCompletedItem_->hide();
480 restartLevel(); //Current level has already been set to the next one before showing the level completed item
481 pPauseAction_->setChecked(false); //unpause
486 //If the game is paused, check if the victory item is being shown
487 if(pVictoryCongratulationsItem_)
489 if (pVictoryCongratulationsItem_->isVisibleTo(NULL)) //returns visibility to scene
491 pVictoryCongratulationsItem_->hide();
493 pPauseAction_->setChecked(false); // unpause
499 //If the game is paused and no victory, check if menu item was selected
501 QList<QGraphicsItem *> items = selectedItems();
503 //if nothing selected resume play
507 pSelectLevelsetFromListItem_->hide();
508 pPauseAction_->setChecked(false);
514 //If something was selected check if it was one of the menu items and act on it
515 //(Nothing else should be made selectable anyway)
519 QGraphicsItem* pItem = items.at(0); //Selecting an item brings here, thus only selecting one item should be possible
520 //... so we can just take the first one
522 //Selection is just used to get notice of a menu item being clicked, removed after use
527 //Act upon the selected item
530 if (pItem == pRestartGameItem_)
532 // qDebug() << "game restart requested";
534 pPauseAction_->setChecked(false); //unpause game
538 else if (pItem == pRestartLevelItem_)
540 // qDebug() << "Level restart requested";
542 pPauseAction_->setChecked(false); //unpause game
546 else if (pItem == pSettingsItem_)
548 pVibrateAction_->toggle();
551 settings.setValue("vibration",pVibrateAction_->isChecked());
553 QString text = pSettingsItem_->toHtml();
554 if (pVibrateAction_->isChecked())
555 text.replace(" on"," off"); //don't remove spaces or you get vibratioff...
557 text.replace(" off"," on");
558 pSettingsItem_->setHtml(text);
561 else if (pItem == pAboutItem_)
566 else if(pItem == pMinimizeItem_)
568 emit minimizeRequested();
571 else if (pItem == pQuitItem_)
575 else if (pItem == pChooseLevelsetItem_)
577 pPausetextItem_->hide();
578 pSelectLevelsetFromListItem_->show();
583 foreach (QGraphicsItem* pLevelItem, levelsetItems_)
585 if (pItem == pLevelItem)
587 QVariant variant = pLevelItem->data(0);
589 if (variant.canConvert<Levelset>())
591 levelset_ = variant.value<Levelset>();
594 settings.setValue("levelset",levelset_.getName());
597 pPauseAction_->setChecked(false); //unpause game
607 void SeaScene::createMenuItems()
611 font.setPixelSize(35);
615 pPausetextItem_ = new QGraphicsTextItem;
616 pPausetextItem_->setHtml("<font size = \"5\" color = darkorange> Game paused. Tap to continue.");
617 pPausetextItem_->setZValue(1000);
618 pPausetextItem_->setPos(165,50);
619 addItem(pPausetextItem_);
620 pPausetextItem_->hide();
624 QString menufonthtml = "<font size = \"4\" color = darkorange>";
626 pRestartGameItem_ = new QGraphicsTextItem;
627 pRestartGameItem_->setHtml(tr("Restart <br> game").prepend(menufonthtml));
628 prepareForMenu(pRestartGameItem_);
630 pRestartLevelItem_ = new QGraphicsTextItem;
631 pRestartLevelItem_->setHtml(tr("Restart <br> level").prepend(menufonthtml));
632 prepareForMenu(pRestartLevelItem_);
634 pChooseLevelsetItem_ = new QGraphicsTextItem;
635 pChooseLevelsetItem_->setHtml(tr("Choose <br> levelset").prepend(menufonthtml));
636 prepareForMenu(pChooseLevelsetItem_);
638 pSettingsItem_ = new QGraphicsTextItem;
639 QString vibraText(tr("Turn vibration <br> effects "));
641 if (pVibrateAction_->isChecked())
649 vibraText.append(statusText);
650 pSettingsItem_->setHtml(vibraText.prepend(menufonthtml));
651 prepareForMenu(pSettingsItem_);
653 pAboutItem_ = new QGraphicsTextItem;
654 pAboutItem_->setHtml(tr("About <br> game").prepend(menufonthtml));
655 prepareForMenu(pAboutItem_);
657 pMinimizeItem_ = new QGraphicsTextItem;
658 pMinimizeItem_->setHtml(tr("Show <br> status bar").prepend(menufonthtml));
659 prepareForMenu(pMinimizeItem_);
661 pQuitItem_ = new QGraphicsTextItem;
662 pQuitItem_->setHtml(tr("Quit <br> game").prepend(menufonthtml));
663 prepareForMenu(pQuitItem_);
667 void SeaScene::prepareForMenu(QGraphicsItem * pItem)
670 //Menu items have pause text item as their parent and are thus added to scene automatically
671 //They are also shown and hidden with it, resulting in the menu being visble when the game is paused
672 //Their coordinates are given relative to the parent.
677 pItem->setParentItem(pPausetextItem_);
678 pItem->setZValue(1000);
679 pItem->setFlag(QGraphicsItem::ItemIsSelectable);
681 int row = menuItemCount_/(itemsPerRow);
682 pItem->setY(150+row*120);
683 pItem->setX(((menuItemCount_%(itemsPerRow))*180-125));
690 void SeaScene::about()
692 pPausetextItem_->hide();
693 pAboutBoxItem_->show();
697 void SeaScene::restartLevel()
702 setupMap(levelset_.getLevel(currentLevel_)); //getLevel() returns default constructor Level if index is invalid, so no risk of crash
704 scoreCounter_.start();
706 vibrationActivate(pVibrateAction_->isChecked()); //Vibration effects are lost without this
707 // qDebug() << pVibrateAction_->isChecked();
708 autopauseTimer.start(); //reset counting towards autopause
715 void SeaScene::nextLevel()
718 //get score for previous level
719 levelScore_ += scoreCounter_.elapsed();
720 totalScore_ += levelScore_;
721 int highscore = levelset_.getLevelHighScore(currentLevel_);
723 //qDebug() << highscore;
727 if (levelScore_ >= highscore)
729 scoretext = tr("<font size=\"5\" color = darkorange>Your time: %1.%2 s<br>Best time: %3.%4 s").arg(levelScore_/1000).arg((levelScore_%1000)/100).arg(highscore/1000).arg((highscore%1000)/100);
732 else //New high score!
735 scoretext = tr("<font size=\"5\" color = darkorange>Your time %1.%2 s is<br>the new best time!").arg(levelScore_/1000).arg((levelScore_%1000)/100);
736 levelset_.setLevelHighScore(currentLevel_,levelScore_);
739 //pause to show the highscore or victory screen
742 pPausetextItem_->hide();
745 //Go to the next level if available
748 if ( currentLevel_ < levelset_.numberOfLevels() )
751 pLevelCompletedItem_->setHtml(scoretext);
752 pLevelCompletedItem_->show();
758 int totalHighsore = levelset_.getTotalHighScore();
759 if (totalScore_ >= totalHighsore)
761 scoretext.append(tr("<br>Your total time: %1.%2 s<br>Best total time:%3.%4 s").arg(totalScore_/1000).arg((totalScore_%1000)/100).arg(totalHighsore/1000).arg((totalHighsore%1000)/100));
763 else //new total high score
765 scoretext.append(tr("<br>Your total time %1.%2 s is<br>the new best time").arg(totalScore_/1000).arg((totalScore_%1000)/100));
766 levelset_.setTotalHighScore(totalScore_);
769 pVictoryScoreItem_->setHtml(scoretext);
770 pVictoryCongratulationsItem_->show();
775 void SeaScene::restartGame()
783 void SeaScene::forcePause()
785 //Pause without setting the pause action state
789 void SeaScene::softContinue()
791 //Continue if not being paused by the user
792 // Reverts forcePause()
794 pause(pPauseAction_->isChecked());
798 void SeaScene::createVictoryItems()
800 pVictoryCongratulationsItem_ = new QGraphicsTextItem;
801 pVictoryCongratulationsItem_->setHtml("<font size=\"6\" color = darkorange> Victory!");
802 pVictoryCongratulationsItem_->hide();
803 pVictoryCongratulationsItem_->setPos(315,30);
804 pVictoryCongratulationsItem_->setZValue(1000);
805 addItem(pVictoryCongratulationsItem_);
808 //coordinates are relative to the parent
810 QGraphicsTextItem * pTextItem = new QGraphicsTextItem(pVictoryCongratulationsItem_);
811 pTextItem->setHtml("<font size=\"5\" color = darkorange> Congratulations!");
812 pTextItem->setPos(-50,80);
813 pTextItem->setZValue(1000);
815 QGraphicsTextItem * pMiddleTextItem = new QGraphicsTextItem(pVictoryCongratulationsItem_);
816 pMiddleTextItem->setHtml("<font size=\"5\" color = darkorange> You have saved all the ghosts.");
817 pMiddleTextItem->setPos(-145,120);
818 pMiddleTextItem->setZValue(1000);
821 pVictoryScoreItem_ = new QGraphicsTextItem(pVictoryCongratulationsItem_);
822 pVictoryScoreItem_->setPos(-50,180);
823 pMiddleTextItem->setZValue(1000);
824 //Text is set at usetime!
826 QGraphicsTextItem * pLowestTextItem = new QGraphicsTextItem(pVictoryCongratulationsItem_);
827 pLowestTextItem->setHtml("<font size=\"5\" color = darkorange> Tap to play again");
828 pLowestTextItem->setPos(-50,360);
829 pLowestTextItem->setZValue(1000);
832 void SeaScene::createAboutBoxItems()
834 pAboutBoxItem_ = new QGraphicsTextItem;
835 addItem(pAboutBoxItem_);
836 pAboutBoxItem_->setPos(25,50);
837 pAboutBoxItem_->setZValue(1000);
838 pAboutBoxItem_->hide();
840 pAboutBoxItem_->setHtml(tr("<font color = darkorange size = \"7\">"
841 "%1 <br> <font size = \"5\"> Version %2"
842 "<p><font size = \"4\"> Copyright 2011 Heli Hyvättinen"
843 "<p><font size = \"4\"> License: General Public License v2"
844 "<p><font size = \"3\"> Web: http://ghostsoverboard.garage.maemo.org/<br>"
845 "Bug Reports: <br> https://bugs.maemo.org/"
846 "enter_bug.cgi?product=Ghosts%20Overboard"
847 ).arg(QApplication::applicationName(),QApplication::applicationVersion()));
851 void SeaScene::setItemPointersNull()
853 pPausetextItem_ = NULL;
854 pRestartLevelItem_ = NULL;
855 pRestartGameItem_ = NULL;
856 pSettingsItem_ = NULL;
859 pMinimizeItem_ = NULL;
860 pChooseLevelsetItem_ = NULL;
862 pAboutBoxItem_ = NULL;
863 pVictoryCongratulationsItem_ = NULL;
864 pLevelCompletedItem_ = NULL;
865 pVictoryCongratulationsItem_ = NULL;
866 pVictoryScoreItem_ = NULL;
871 void SeaScene::turnPauseOn()
873 pPauseAction_->setChecked(true);
876 void SeaScene::handleDeviceLocked(bool isLocked)
878 //pauses if locked but does not unpause if unlocked
881 pPauseAction_->setChecked(true);
885 void SeaScene::pollDeviceLocked()
888 bool locked = deviceInfo_.isDeviceLocked();
894 pPauseAction_->setChecked(true);
895 alreadyLocked_ = true;
900 alreadyLocked_ = false;
905 void SeaScene::createLevelCompletedItems()
907 pLevelCompletedItem_ = new QGraphicsTextItem;
908 addItem(pLevelCompletedItem_);
909 pLevelCompletedItem_->setPos(240,100);
910 pLevelCompletedItem_->setZValue(1000);
911 pLevelCompletedItem_->hide();
912 //The text is set at usetime
914 QGraphicsTextItem * pTapForNextLevelItem = new QGraphicsTextItem(pLevelCompletedItem_);
915 pTapForNextLevelItem->setPos(-60,100);
916 pTapForNextLevelItem->setZValue(1000);
917 pTapForNextLevelItem->setHtml("<font size=\"5\" color = darkorange>Tap to start the next level");
920 void SeaScene::createSelectLevelsetFromListItems()
922 if (availableLevelsets_.isEmpty()) //Something is badly wrong in code if this is true...
926 pSelectLevelsetFromListItem_ = new QGraphicsTextItem;
927 addItem(pSelectLevelsetFromListItem_);
928 pSelectLevelsetFromListItem_->setPos(260,60);
929 pSelectLevelsetFromListItem_->setZValue(1000);
930 pSelectLevelsetFromListItem_->hide();
932 QString fontstring ("<font color = darkorange size = \"5\">");
934 pSelectLevelsetFromListItem_->setHtml(tr("Choose a levelset").prepend(fontstring));
938 levelsetItems_.clear();
941 foreach (Levelset set, availableLevelsets_)
943 QGraphicsTextItem * pItem = new QGraphicsTextItem(pSelectLevelsetFromListItem_);
944 QString text (fontstring);
945 if (levelset_.getName() == set.getName())
947 text.append(set.getName());
948 pItem->setHtml(text);
949 pItem->setPos(65,yPos);
951 pItem->setZValue(1000);
952 pItem->setFlag(QGraphicsItem::ItemIsSelectable);
953 pItem->setData(0,QVariant::fromValue(set));
954 levelsetItems_.append(pItem);