Consider this extremely simple example in which you can drag a square around a QGraphicsScene (using PyQt, C++ users read self as this)

import sys
from PyQt4 import QtGui, QtCore

class MainWindowUi(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.scene = Scene(0, 0, 300, 300, self)
        self.view = QtGui.QGraphicsView()
        self.setCentralWidget(self.view)
        self.view.setScene(self.scene)
        self.scene.addItem(Square(0,0,50,50))

class Scene(QtGui.QGraphicsScene):

    def mousePressEvent(self, e):
        self.currentItem = self.itemAt(e.pos())
        print (self.currentItem)
        QtGui.QGraphicsScene.mousePressEvent(self, e)

class Square(QtGui.QGraphicsRectItem):
    def __init__(self, *args):
        QtGui.QGraphicsRectItem.__init__(self, *args)
        self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable, True)

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    win = MainWindowUi()
    win.show()
    sys.exit(app.exec_())


When you click the mouse in the scene you should see a print statement telling you that you clicked either on the square or on nothing (ie. None). This works if you just start the program and click on the square.

Now drag the square away from the upper left corner and click on it again. This time itemAt() return None even when you click on the square.

What's going on?


Question: C++ Simple input/out program + enumerators
Answer: I would do something like this:

#include &lt;iostream&gt;
using namespace std;

int main()
{
    cout &lt;&lt; "Difficulty Levels\n\n";
    cout &lt;&lt; "0 - Novice\n";
    cout &lt;&lt; "1 - Easy\n";
    cout &lt;&lt; "2 - Normal\n";
    cout &lt;&lt; "3 - Hard\n";
    cout &lt;&lt; "4 - Unbeatable\n\n";

    enum {NOVICE = 0, EASY = 1, NORMAL = 2, HARD = 3, UNBEATABLE = 4};

    int choice;
    cout &lt;&lt; "Choice: ";
    cin &gt;&gt; choice;

    switch (choice) {
        case NOVICE:     
            cout &lt;&lt; "You have picked Novice.\n";
            break;
        case EASY:
            cout &lt;&lt; "You picked Easy.\n";
            break;
        case NORMAL:
            cout &lt;&lt; "You picked Normal.\n";
            break;
        case HARD:
            cout &lt;&lt; "You picked Hard.\n";
            break;
        case UNBEATABLE: 
            cout &lt;&lt; "You picked Unbeatable.\n";
            break;
        default:
            cout &lt;&lt; "You made an illegal choice.\n";
            break;
    }  
    return 0;
}


This way you're showing you're at least using your enum.