How to block object type QGraphicsView?
I wanna block object QGraphicsView that Nobody can click and do something on this window. Window has to be only to read.
I used function:
but this doesn't working
thanks for help and answers.
easiest way would be to set it disabled
Or you can try the following:
your method doesn't working in my game :/
I use object type QGraphicsView as board in game boats.
ok lets start from the beginning :)
What do you exactly want to achieve?
Let me know if i misunderstood something:
- your window may be focusable, but no contents of it may be editable.
- the window may be still resizeable and moveable
- the window is a top level QGraphicsView?
What does the QGraphicsView contain?
What exactly doesn't work for you?
When your graphics view contains editable items then setInteractive(false) should work. Also the disabling of the widget blocks input events for sure.
Please show some more code if necessary.
this is part code which concerns object QGraphicsView in my program:
@QGraphicsScene *scene = new QGraphicsScene(0,0,710,478);
ui->GW_plansza->setScene(scene); ui->GW_plansza->setRenderHint(QPainter::Antialiasing); ui->GW_plansza->setBackgroundBrush(QPixmap("../Statki/images/plansza-final1.png")); ui->GW_plansza->setCacheMode(QGraphicsView::CacheBackground); ui->GW_plansza->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); ui->GW_plansza->setDragMode(QGraphicsView::ScrollHandDrag); ui->GW_plansza->show();@
Exactly I want stop settings and moving ships on new place.
Program has to working how simple game in ships.
Program has to working how simple game in ships. When first player will select points to shot, then second must have blocked window that he will can't nothing do.
I am thinking that now explained better my problem :)