This patch by Filippo Rusconi <lopippo@debian.org> implements a port
from Qt4 to Qt5.

diff --git a/about.h b/about.h
index 20fc007..2e7a081 100644
--- a/about.h
+++ b/about.h
@@ -21,7 +21,7 @@
 
 #include "ui_about.h"
 #include "colorcode.h"
-#include <QDialog>
+#include <QtWidgets/QDialog>
 #include <QFile>
 
 class About : public QDialog, public Ui::About
diff --git a/background.h b/background.h
index a05a2e5..3b14b07 100644
--- a/background.h
+++ b/background.h
@@ -19,7 +19,8 @@
 #ifndef BACKGROUND_H
 #define BACKGROUND_H
 
-#include <QGraphicsItem>
+#include <QtWidgets/QGraphicsItem>
+#include <QtWidgets/QGraphicsScene>
 #include <QColor>
 #include <QPen>
 #include <QRadialGradient>
diff --git a/buttondelegate.cpp b/buttondelegate.cpp
index 8c9be6f..6af8b24 100644
--- a/buttondelegate.cpp
+++ b/buttondelegate.cpp
@@ -17,7 +17,7 @@
 */
 
 #include <QtGui>
-
+#include <QtWidgets/QLineEdit>
 #include "highscoresmodel.h"
 #include "buttondelegate.h"
 #include "settings.h"
diff --git a/buttondelegate.h b/buttondelegate.h
index 490722f..83743db 100644
--- a/buttondelegate.h
+++ b/buttondelegate.h
@@ -19,7 +19,7 @@
 #ifndef BUTTONDELEGATE_H
 #define BUTTONDELEGATE_H
 
-#include <QStyledItemDelegate>
+#include <QtWidgets/QStyledItemDelegate>
 #include "buttonscell.h"
 #include "highscoresmodel.h"
 #include "gametableview.h"
diff --git a/buttonscell.h b/buttonscell.h
index 6ee22e8..ffbc237 100644
--- a/buttonscell.h
+++ b/buttonscell.h
@@ -2,7 +2,7 @@
 #define BUTTONSCELL_H
 
 #include <QtGui>
-#include <QWidget>
+#include <QtWidgets/QHBoxLayout>
 #include "cellbtn.h"
 
 class ButtonsCell : public QWidget
diff --git a/ccsolver.cpp b/ccsolver.cpp
index 5e4cced..eb8c236 100644
--- a/ccsolver.cpp
+++ b/ccsolver.cpp
@@ -352,8 +352,8 @@ void CCSolver::StartGuess()
 {
     if (mPosCnt == mLastPosCnt && (mGuessCnt > 0 || mRestartCnt > 0))
     {
-        emit finished();
-        return;
+      // emit QThread::finished();
+      return;
     }
 
     mLastGuess = -1;
diff --git a/ccsolver.h b/ccsolver.h
index 769e313..adfe7df 100644
--- a/ccsolver.h
+++ b/ccsolver.h
@@ -20,6 +20,7 @@
 #define CCSOLVER_H
 
 #include <QtGui>
+#include <QThread>
 #include <iostream>
 #include "colorcode.h"
 
@@ -59,7 +60,7 @@ public:
 
 signals:
     void GuessDoneSignal(int* row);
-
+        
 private:
     static const int mFGCnts[4][9][4];
     static const int mGameNos[66][4];
diff --git a/cellbtn.h b/cellbtn.h
index 16bc880..771ae1a 100644
--- a/cellbtn.h
+++ b/cellbtn.h
@@ -20,7 +20,7 @@
 #define CELLBTN_H
 
 #include <QtGui>
-#include <QToolButton>
+#include <QtWidgets/QToolButton>
 #include <QEvent>
 
 class CellBtn : public QToolButton
diff --git a/colorcode.cpp b/colorcode.cpp
index ecb8881..1c55cd9 100644
--- a/colorcode.cpp
+++ b/colorcode.cpp
@@ -16,7 +16,11 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <QtGui>
+#include <QtWidgets/QGraphicsView>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QMenuBar>
+#include <QtWidgets/QToolBar>
+#include <QtWidgets/QMessageBox>
 
 #include "settings.h"
 #include "ccsolver.h"
@@ -213,7 +217,7 @@ void ColorCode::Init()
     mTimerBtn->SetWidth(261);
     mTimerBtn->SetLabel("");
     mScene->addItem(mTimerBtn);
-    mTimerBtn->scale(0.44, 0.44);
+    mTimerBtn->setScale(0.44);
     mTimerBtn->setPos(102, 110);
     mTimerBtn->setZValue(LAYER_HINTS);
     mTimerBtn->InvertStates();
@@ -225,7 +229,7 @@ void ColorCode::Init()
     mSolutionRowBg->SetWidth(219);
     mSolutionRowBg->SetLabel("");
     mScene->addItem(mSolutionRowBg);
-    mSolutionRowBg->scale(1.14, 1.14);
+    mSolutionRowBg->setScale(1.14);
     mSolutionRowBg->setPos(35, 66);
     mSolutionRowBg->setZValue(LAYER_ROWS);
     mSolutionRowBg->SetStatesOpacity(1.0, 0.1);
diff --git a/colorcode.h b/colorcode.h
index f27af3d..94733b9 100644
--- a/colorcode.h
+++ b/colorcode.h
@@ -20,7 +20,7 @@
 #define COLORCODE_H
 
 #include <iostream>
-#include <QMainWindow>
+#include <QtWidgets/QMainWindow>
 
 struct PegType
 {
diff --git a/colorcode.pro b/colorcode.pro
index 26dcbd0..3a41a49 100644
--- a/colorcode.pro
+++ b/colorcode.pro
@@ -1,84 +1,76 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Thu Sep 24 22:30:55 2009
-# #####################################################################
-QMAKE_CFLAGS_DEBUG -= -O2
-QMAKE_CFLAGS_RELEASE -= -O2
-QMAKE_CXXFLAGS_DEBUG -= -O2
-QMAKE_CXXFLAGS_RELEASE -= -O2
-QMAKE_CXXFLAGS += -O3
-QMAKE_CFLAGS += -O3
-TARGET = colorcode
+######################################################################
+# Automatically generated by qmake (3.0) mer. sept. 2 11:19:45 2015
+######################################################################
+
 TEMPLATE = app
+TARGET = colorcode
+INCLUDEPATH += .
+
+QT += widgets
 
 # Input
 HEADERS += about.h \
-    colorcode.h \
-    colorpeg.h \
-    msg.h \
-    pegrow.h \
-    rowhint.h \
-    ccsolver.h \
-    background.h \
-    solutionrow.h \
-    graphicsbtn.h \
-    settings.h \
-    prefdialog.h \
-    pegfactory.h \
-    gamenodisplay.h \
-    timedisplay.h \
-    timedisplaybg.h \
-    highscore.h \
-    ccgame.h \
-    buttonscell.h \
-    buttondelegate.h \
-    cellbtn.h \
-    gametimer.h \
-    savedgamesmodel.h \
-    prevgamesmodel.h \
-    highscoresmodel.h \
-    gametableview.h \
-    gametablesdialog.h \
-    gameslistmodel.h
-FORMS += about.ui \
-    prefdialog.ui \
-    gametablesdialog.ui
+           background.h \
+           buttondelegate.h \
+           buttonscell.h \
+           ccgame.h \
+           ccsolver.h \
+           cellbtn.h \
+           colorcode.h \
+           colorpeg.h \
+           gamenodisplay.h \
+           gameslistmodel.h \
+           gametablesdialog.h \
+           gametableview.h \
+           gametimer.h \
+           graphicsbtn.h \
+           highscore.h \
+           highscoresmodel.h \
+           msg.h \
+           pegfactory.h \
+           pegrow.h \
+           prefdialog.h \
+           prevgamesmodel.h \
+           rowhint.h \
+           savedgamesmodel.h \
+           settings.h \
+           solutionrow.h \
+           timedisplay.h \
+           timedisplaybg.h
+FORMS += about.ui gametablesdialog.ui prefdialog.ui
 SOURCES += about.cpp \
-    colorcode.cpp \
-    colorpeg.cpp \
-    main.cpp \
-    msg.cpp \
-    pegrow.cpp \
-    rowhint.cpp \
-    ccsolver.cpp \
-    background.cpp \
-    solutionrow.cpp \
-    graphicsbtn.cpp \
-    settings.cpp \
-    prefdialog.cpp \
-    pegfactory.cpp \
-    gamenodisplay.cpp \
-    timedisplay.cpp \
-    timedisplaybg.cpp \
-    highscore.cpp \
-    ccgame.cpp \
-    buttonscell.cpp \
-    buttondelegate.cpp \
-    cellbtn.cpp \
-    gametimer.cpp \
-    savedgamesmodel.cpp \
-    prevgamesmodel.cpp \
-    highscoresmodel.cpp \
-    gametableview.cpp \
-    gametablesdialog.cpp \
-    gameslistmodel.cpp
+           background.cpp \
+           buttondelegate.cpp \
+           buttonscell.cpp \
+           ccgame.cpp \
+           ccsolver.cpp \
+           cellbtn.cpp \
+           colorcode.cpp \
+           colorpeg.cpp \
+           gamenodisplay.cpp \
+           gameslistmodel.cpp \
+           gametablesdialog.cpp \
+           gametableview.cpp \
+           gametimer.cpp \
+           graphicsbtn.cpp \
+           highscore.cpp \
+           highscoresmodel.cpp \
+           main.cpp \
+           msg.cpp \
+           pegfactory.cpp \
+           pegrow.cpp \
+           prefdialog.cpp \
+           prevgamesmodel.cpp \
+           rowhint.cpp \
+           savedgamesmodel.cpp \
+           settings.cpp \
+           solutionrow.cpp \
+           timedisplay.cpp \
+           timedisplaybg.cpp
 RESOURCES += resource.qrc
-OTHER_FILES += docs/GPL.html
-win32:RC_FILE = colorcode.rc
-TRANSLATIONS += trans_de.ts \
-    trans_en.ts \
-    trans_cs.ts \
-    trans_fr.ts \
-    trans_hu.ts \
-    trans_es.ts
-CODECFORTR = UTF-8
-CODECFORSRC = UTF-8
+TRANSLATIONS += trans_cs.ts \
+                trans_de.ts \
+                trans_en.ts \
+                trans_es.ts \
+                trans_fr.ts \
+                trans_hu.ts
diff --git a/colorpeg.cpp b/colorpeg.cpp
index 3c311df..a6f1c12 100644
--- a/colorpeg.cpp
+++ b/colorpeg.cpp
@@ -16,7 +16,8 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <QtGui>
+#include <QtWidgets/QGraphicsView>
+#include <QtWidgets/QGraphicsSceneMouseEvent>
 
 #include "colorpeg.h"
 
diff --git a/colorpeg.h b/colorpeg.h
index 4548934..bcfe486 100644
--- a/colorpeg.h
+++ b/colorpeg.h
@@ -22,7 +22,7 @@
 #include <QColor>
 #include <QPen>
 #include <QRadialGradient>
-#include <QGraphicsItem>
+#include <QtWidgets/QGraphicsItem>
 #include <iostream>
 #include <vector>
 #include "colorcode.h"
diff --git a/gamenodisplay.cpp b/gamenodisplay.cpp
index 5056f0f..fa629e0 100644
--- a/gamenodisplay.cpp
+++ b/gamenodisplay.cpp
@@ -33,7 +33,7 @@ GameNoDisplay::GameNoDisplay(QGraphicsItem* parent) : QGraphicsTextItem(parent)
     mUpdateRect = QRectF(0, 0, 600, 40);
 
     setTextWidth(600);
-    scale(0.5, 0.5);
+    setScale(0.5);
 }
 
 void GameNoDisplay::ShowStr(QString str)
diff --git a/gameslistmodel.cpp b/gameslistmodel.cpp
index 8c11c37..3078c39 100644
--- a/gameslistmodel.cpp
+++ b/gameslistmodel.cpp
@@ -16,6 +16,8 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <QtWidgets/QApplication>
+
 #include "gameslistmodel.h"
 #include "gametableview.h"
 
diff --git a/gameslistmodel.h b/gameslistmodel.h
index adc19c4..0912dbc 100644
--- a/gameslistmodel.h
+++ b/gameslistmodel.h
@@ -20,8 +20,8 @@
 #define GAMESLISTMODEL_H
 
 #include <QAbstractTableModel>
-#include <QTableView>
-#include <QHeaderView>
+#include <QtWidgets/QTableView>
+#include <QtWidgets/QHeaderView>
 #include <QStringList>
 #include "ccgame.h"
 #include "buttonscell.h"
diff --git a/gametablesdialog.cpp b/gametablesdialog.cpp
index e2ee544..c1cef44 100644
--- a/gametablesdialog.cpp
+++ b/gametablesdialog.cpp
@@ -16,6 +16,8 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <QtWidgets/QMessageBox>
+
 #include "gametablesdialog.h"
 #include "ui_gametablesdialog.h"
 #include "gametableview.h"
diff --git a/gametableview.cpp b/gametableview.cpp
index f3cd4f0..f589cb4 100644
--- a/gametableview.cpp
+++ b/gametableview.cpp
@@ -16,6 +16,10 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QScrollBar>
+
+
 #include "highscoresmodel.h"
 #include "gametableview.h"
 
@@ -31,7 +35,7 @@ GameTableView::GameTableView(QWidget *parent) : QTableView(parent)
     setAttribute(Qt::WA_AlwaysShowToolTips, true);
 
     horizontalHeader()->setStretchLastSection(true);
-    verticalHeader()->setResizeMode(QHeaderView::Fixed);
+    verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
     verticalHeader()->setDefaultSectionSize(18);
     verticalHeader()->hide();
     horizontalHeader()->setFixedHeight(18);
diff --git a/gametableview.h b/gametableview.h
index 6edf10d..296ec2c 100644
--- a/gametableview.h
+++ b/gametableview.h
@@ -19,7 +19,7 @@
 #ifndef GAMETABLEVIEW_H
 #define GAMETABLEVIEW_H
 
-#include <QTableView>
+#include <QtWidgets/QTableView>
 
 class GamesListModel;
 
diff --git a/graphicsbtn.cpp b/graphicsbtn.cpp
index f3b7801..2ab3859 100644
--- a/graphicsbtn.cpp
+++ b/graphicsbtn.cpp
@@ -16,7 +16,11 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <QtGui>
+#include <QtWidgets/QGraphicsSceneMouseEvent>
+#include <QtGui/QCursor>
+#include <QtGui/QPainter>
+
+
 #include <QFontMetrics>
 #include "graphicsbtn.h"
 
@@ -51,7 +55,7 @@ void GraphicsBtn::SetEnabled(bool b)
 {
     if (b)
     {
-        setCursor(Qt::PointingHandCursor);
+      setCursor(Qt::PointingHandCursor);
     }
     else
     {
diff --git a/highscoresmodel.h b/highscoresmodel.h
index e7fe009..f293e14 100644
--- a/highscoresmodel.h
+++ b/highscoresmodel.h
@@ -20,8 +20,8 @@
 #define HIGHSCORESMODEL_H
 
 #include <QAbstractTableModel>
-#include <QTableView>
-#include <QHeaderView>
+#include <QtWidgets/QTableView>
+#include <QtWidgets/QHeaderView>
 #include <QStringList>
 #include "ccgame.h"
 #include "buttonscell.h"
diff --git a/main.cpp b/main.cpp
index 4336c9e..c552107 100644
--- a/main.cpp
+++ b/main.cpp
@@ -17,7 +17,7 @@
 */
 
 #include <iostream>
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 #include <QLibraryInfo>
 #include <QLocale>
 #include <QTranslator>
diff --git a/pegfactory.cpp b/pegfactory.cpp
index 13d0482..5489bdf 100644
--- a/pegfactory.cpp
+++ b/pegfactory.cpp
@@ -16,7 +16,8 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <QtGui>
+#include <QtWidgets/QGraphicsScene>
+
 #include "pegfactory.h"
 
 using namespace std;
@@ -137,7 +138,10 @@ void PegFactory::PegReleasedSlot(ColorPeg* cp)
     else
     {
         int ystart = ColorCode::mRowY0 + (ColorCode::MAX_COLOR_CNT - ColorCode::mColorCnt) * 40;
-        int ix1 = qRound((qRound(cp->pos().y()) - ystart + 18) / 40);
+        int posY = qRound(cp->pos().y());
+        qreal diff = posY - ystart + 18;
+        
+        int ix1 = qRound(diff / 40);
         ix1 = min(ColorCode::mColorCnt - 1, max(0, ix1));
 
         int ix0 = cp->GetPegType()->ix;
diff --git a/pegrow.h b/pegrow.h
index e2249aa..5307cbf 100644
--- a/pegrow.h
+++ b/pegrow.h
@@ -23,7 +23,7 @@
 #include <QColor>
 #include <QPen>
 #include <QRadialGradient>
-#include <QGraphicsItem>
+#include <QtWidgets/QGraphicsItem>
 #include <iostream>
 #include <vector>
 #include "colorcode.h"
diff --git a/prefdialog.cpp b/prefdialog.cpp
index 10c79ae..01e029a 100644
--- a/prefdialog.cpp
+++ b/prefdialog.cpp
@@ -16,6 +16,9 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <QtWidgets/QColorDialog>
+#include <QtWidgets/QGraphicsScene>
+
 #include "prefdialog.h"
 
 using namespace std;
diff --git a/rowhint.cpp b/rowhint.cpp
index 0da5555..8591f67 100644
--- a/rowhint.cpp
+++ b/rowhint.cpp
@@ -16,7 +16,9 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <QtGui>
+#include <QtWidgets/QGraphicsScene>
+#include <QtWidgets/QGraphicsSceneMouseEvent>
+#include <QtGui/QPainter>
 
 #include "rowhint.h"
 
diff --git a/rowhint.h b/rowhint.h
index d0607ae..1f9b95a 100644
--- a/rowhint.h
+++ b/rowhint.h
@@ -19,7 +19,7 @@
 #ifndef ROWHINT_H
 #define ROWHINT_H
 
-#include <QGraphicsItem>
+#include <QtWidgets/QGraphicsItem>
 #include <QColor>
 #include <QPen>
 #include <QRadialGradient>
diff --git a/settings.cpp b/settings.cpp
index 13d1c67..553e1d2 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -16,6 +16,8 @@
  * along with ColorCode. If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <QtWidgets/QApplication>
+
 #include "settings.h"
 #include "colorcode.h"
 #include "ccsolver.h"
diff --git a/timedisplay.cpp b/timedisplay.cpp
index a80d2b2..612f699 100644
--- a/timedisplay.cpp
+++ b/timedisplay.cpp
@@ -47,7 +47,7 @@ TimeDisplay::TimeDisplay(QGraphicsItem* parent) : QGraphicsTextItem(parent)
     mTimer->Start();
 
     setTextWidth(440);
-    scale(0.5, 0.5);
+    setScale(0.5);
 }
 
 TimeDisplay::~TimeDisplay()
