kblackbox
kbbgraphicsitemonbox.cpp
Go to the documentation of this file.
50 KBBGraphicsItemOnBox::KBBGraphicsItemOnBox(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, const int boxPosition, const int columns, const int rows) : KBBGraphicsItem(itemType, parent->scene(), themeManager), KBBItemWithPosition()
110 return ((m_itemType==KBBScalableGraphicWidget::playerBall) || (m_itemType==KBBScalableGraphicWidget::unsureBall) || (m_itemType==KBBScalableGraphicWidget::markerNothing));
143 if ((boxPosition(dropX, dropY)==NO_POSITION) || (boxPosition(dropX, dropY)==boxPosition(m_dragX, m_dragY)) || (boxPosition(dropX, dropY)>=m_columns*m_rows))
148 setBoxPosition(m_widget->moveMarkerNothing(boxPosition(m_dragX, m_dragY), boxPosition(dropX, dropY)));
150 int newPos = m_widget->positionAfterMovingBall(boxPosition(m_dragX, m_dragY), boxPosition(dropX, dropY));
152 // if we do move from outside the board. Because in this case and if the move is OK, we will destroy ourself to put a "real" new ball over the board... So we cannot do anything else more after calling m_widget->moveBall()...
171 QPointF p((qreal) (KBBScalableGraphicWidget::BORDER_SIZE + KBBScalableGraphicWidget::RATIO*(boxPosition % m_columns)), (qreal) (KBBScalableGraphicWidget::BORDER_SIZE + KBBScalableGraphicWidget::RATIO*(boxPosition / m_columns)));
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
qreal x() const
qreal y() const
int moveBall(const int boxPositionFrom, const int boxPositionTo)
Definition: kbbscalablegraphicwidget.cpp:221
void setFlag(GraphicsItemFlag flag, bool enabled)
Scalable graphic central widget for KBlackBox.
Definition: kbbscalablegraphicwidget.h:62
void setAcceptDrops(bool on)
int moveMarkerNothing(const int boxPositionFrom, const int boxPositionTo)
Definition: kbbscalablegraphicwidget.cpp:241
KBBScalableGraphicWidget * m_widget
Definition: kbbgraphicsitemonbox.h:67
void setCursor(const QCursor &cursor)
virtual void removeInteractionInfos()
Definition: kbbgraphicsitemonbox.cpp:82
void setPos(const QPointF &pos)
KBBGraphicsItemOnBox(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget *parent, KBBThemeManager *themeManager, const int boxPosition, const int columns, const int rows)
Definition: kbbgraphicsitemonbox.cpp:50
static int const BORDER_SIZE
Distance between the black box and the widget border.
Definition: kbbscalablegraphicwidget.h:74
Qt::MouseButton button() const
int positionAfterMovingBall(const int boxPositionFrom, const int boxPositionTo) const
Definition: kbbscalablegraphicwidget.cpp:303
void mouseBoxClick(const Qt::MouseButton button, int boxPosition)
Definition: kbbscalablegraphicwidget.cpp:210
static int const RATIO
Width and height of a single square on the black box.
Definition: kbbscalablegraphicwidget.h:81
QObject * parent() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.