--- queensgui/src/board.cpp 2007/07/20 01:22:53 5 +++ queensgui/src/board.cpp 2009/09/16 18:53:22 327 @@ -19,7 +19,11 @@ ***************************************************************************/ #include #include -#include +#include +//Added by qt3to4: +#include +#include +#include #include "board.h" @@ -39,24 +43,19 @@ void Board::setMatrix(Solution* sol) { - if (sol != NULL) + + if (m_sol != NULL) + { + delete m_sol; + m_sol = NULL; + } + + if (sol != NULL) m_sol = sol->copy(); this->repaint(true); } -/* -void Board::setMatrix(IntSolution sol) -{ -#warning need a closer look - - m_hasData = true; - m_sol = Solution(); - for (int i=0;irepaint(true); - -}*/ void Board::paintEvent( QPaintEvent *event ) @@ -68,7 +67,7 @@ } if (m_sol != NULL) { - QBrush brush( black); + QBrush brush( Qt::black); p.setBrush( brush ); for (int i=0; ibutton() == LeftButton) { + if (event->button() == Qt::LeftButton) { this->repaint(true); QPainter p( this ); - QPen bluePen( blue ); + QPen bluePen( Qt::blue ); p.setPen( bluePen ); int x = event->x() / 30; int y = event->y() / 30; @@ -91,7 +90,7 @@ p.drawLine( QPoint(5,(y*30)+15), QPoint( (m_size*30)-5, (y*30)+15) ); p.drawLine( QPoint( (x*30)+15, 5), QPoint( (x*30)+15, (m_size*30)-5 ) ); - QPen redPen( red ); + QPen redPen( Qt::red ); p.setPen( redPen ); int startx,stopx; @@ -134,6 +133,7 @@ delete m_sol; m_sol = NULL; } + m_size = size; this->setMaximumSize( (size * 30)+1, (size * 30)+1 ); this->setMinimumSize( size * 30, size * 30); @@ -144,7 +144,7 @@ if (m_sol == NULL) return; - QPopupMenu *contextMenu = new QPopupMenu( this ); + Q3PopupMenu *contextMenu = new Q3PopupMenu( this ); contextMenu->setCheckable( false ); contextMenu->insertItem("Rotate left", this, SLOT( rotateLeft() ) ); contextMenu->insertItem("Rotate right", this, SLOT( rotateRight() ) );