From 1f78d5f2176de31809dc34fb38945c181390cdef Mon Sep 17 00:00:00 2001
From: Paul Cercueil <paul.cercueil@analog.com>
Date: Tue, 29 Sep 2015 11:25:47 +0200
Subject: [PATCH 03/22] gr-qtgui: update for Qt5

This commit switch the gr-qtgui blocks from being usable with Qt4 to
being usable with Qt5.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
---
 gr-qtgui/CMakeLists.txt                      | 11 ++++-------
 gr-qtgui/grc/qtgui_ber_sink_b.xml            |  2 +-
 gr-qtgui/grc/qtgui_check_box.xml             |  2 +-
 gr-qtgui/grc/qtgui_chooser.xml               |  4 ++--
 gr-qtgui/grc/qtgui_const_sink_x.xml          |  2 +-
 gr-qtgui/grc/qtgui_entry.xml                 |  2 +-
 gr-qtgui/grc/qtgui_freq_sink_x.xml           |  2 +-
 gr-qtgui/grc/qtgui_histogram_sink_x.xml      |  2 +-
 gr-qtgui/grc/qtgui_label.xml                 |  2 +-
 gr-qtgui/grc/qtgui_number_sink.xml           |  2 +-
 gr-qtgui/grc/qtgui_push_button.xml           |  2 +-
 gr-qtgui/grc/qtgui_sink_x.xml                |  2 +-
 gr-qtgui/grc/qtgui_tab_widget.xml            |  2 +-
 gr-qtgui/grc/qtgui_time_raster_x.xml         |  2 +-
 gr-qtgui/grc/qtgui_time_sink_x.xml           |  2 +-
 gr-qtgui/grc/qtgui_vector_sink_f.xml         |  2 +-
 gr-qtgui/grc/qtgui_waterfall_sink_x.xml      |  2 +-
 gr-qtgui/include/gnuradio/qtgui/form_menus.h |  1 +
 gr-qtgui/lib/CMakeLists.txt                  |  8 ++++----
 gr-qtgui/lib/SpectrumGUIClass.cc             |  1 -
 gr-qtgui/lib/const_sink_c_impl.cc            |  4 ----
 gr-qtgui/lib/freq_sink_c_impl.cc             |  4 ----
 gr-qtgui/lib/freq_sink_f_impl.cc             |  4 ----
 gr-qtgui/lib/histogram_sink_f_impl.cc        |  4 ----
 gr-qtgui/lib/sink_c_impl.cc                  |  4 ----
 gr-qtgui/lib/sink_f_impl.cc                  |  4 ----
 gr-qtgui/lib/time_raster_sink_b_impl.cc      |  4 ----
 gr-qtgui/lib/time_raster_sink_f_impl.cc      |  4 ----
 gr-qtgui/lib/time_sink_c_impl.cc             |  4 ----
 gr-qtgui/lib/time_sink_f_impl.cc             |  4 ----
 gr-qtgui/lib/vector_sink_f_impl.cc           |  4 ----
 gr-qtgui/lib/waterfall_sink_c_impl.cc        |  4 ----
 gr-qtgui/lib/waterfall_sink_f_impl.cc        |  4 ----
 gr-qtgui/python/qtgui/range.py               | 26 +++++++++++++-------------
 34 files changed, 39 insertions(+), 94 deletions(-)

--- a/gr-qtgui/CMakeLists.txt
+++ b/gr-qtgui/CMakeLists.txt
@@ -22,14 +22,14 @@
 ########################################################################
 include(GrBoost)
 
-find_package(Qt4 4.2.0 COMPONENTS QtCore QtGui)
+find_package(Qt5Widgets)
 
 find_package(Qwt)
 
 find_package(PythonLibs 2)
 
 include(GrPython)
-GR_PYTHON_CHECK_MODULE("PyQt4" PyQt4 True PYQT4_FOUND)
+GR_PYTHON_CHECK_MODULE("PyQt5" PyQt5 True PYQT5_FOUND)
 
 ########################################################################
 # Register component
@@ -37,13 +37,13 @@
 include(GrComponent)
 if(NOT CMAKE_CROSSCOMPILING)
     set(qt_gui_python_deps
-        PYQT4_FOUND
+        PYQT5_FOUND
     )
 endif(NOT CMAKE_CROSSCOMPILING)
 
 GR_REGISTER_COMPONENT("gr-qtgui" ENABLE_GR_QTGUI
     Boost_FOUND
-    QT4_FOUND
+    Qt5Widgets_FOUND
     QWT_FOUND
     ENABLE_VOLK
     ENABLE_GNURADIO_RUNTIME
@@ -66,9 +66,6 @@
 ########################################################################
 if(ENABLE_GR_QTGUI)
 
-# populate the environment with QT variables
-include(GrSetupQt4)
-
 ########################################################################
 # Setup CPack components
 ########################################################################
--- a/gr-qtgui/grc/qtgui_ber_sink_b.xml
+++ b/gr-qtgui/grc/qtgui_ber_sink_b.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Bercurve Sink</name>
   <key>qtgui_bercurve_sink</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>import sip</import>
   <import>import numpy</import>
--- a/gr-qtgui/grc/qtgui_check_box.xml
+++ b/gr-qtgui/grc/qtgui_check_box.xml
@@ -8,7 +8,7 @@
 <block>
 	<name>QT GUI Check Box</name>
 	<key>variable_qtgui_check_box</key>
-	<import>from PyQt4 import Qt</import>
+	<import>from PyQt5 import Qt</import>
 	<var_make>self.$(id) = $(id) = $value</var_make>
 	<make>#set $win = '_%s_check_box'%$id
 #if not $label()
--- a/gr-qtgui/grc/qtgui_chooser.xml
+++ b/gr-qtgui/grc/qtgui_chooser.xml
@@ -8,8 +8,8 @@
 <block>
 	<name>QT GUI Chooser</name>
 	<key>variable_qtgui_chooser</key>
-	<import>from PyQt4 import Qt</import>
-	<import>from PyQt4.QtCore import QObject, pyqtSlot</import>
+	<import>from PyQt5 import Qt</import>
+	<import>from PyQt5.QtCore import QObject, pyqtSlot</import>
 	<var_make>self.$(id) = $(id) = $value</var_make>
 	<make>#slurp
 #set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())]
--- a/gr-qtgui/grc/qtgui_const_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_const_sink_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Constellation Sink</name>
   <key>qtgui_const_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>import sip</import>
   <make>#set $win = 'self._%s_win'%$id
--- a/gr-qtgui/grc/qtgui_entry.xml
+++ b/gr-qtgui/grc/qtgui_entry.xml
@@ -8,7 +8,7 @@
 <block>
 	<name>QT GUI Entry</name>
 	<key>variable_qtgui_entry</key>
-	<import>from PyQt4 import Qt</import>
+	<import>from PyQt5 import Qt</import>
 	<import>from gnuradio import eng_notation</import>
 	<var_make>self.$(id) = $(id) = $value</var_make>
 	<make>#set $win = 'self._%s_tool_bar'%$id
--- a/gr-qtgui/grc/qtgui_freq_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_freq_sink_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Frequency Sink</name>
   <key>qtgui_freq_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>from gnuradio.filter import firdes</import>
   <import>import sip</import>
--- a/gr-qtgui/grc/qtgui_histogram_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_histogram_sink_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Histogram Sink</name>
   <key>qtgui_histogram_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>import sip</import>
   <make>#set $win = 'self._%s_win'%$id
--- a/gr-qtgui/grc/qtgui_label.xml
+++ b/gr-qtgui/grc/qtgui_label.xml
@@ -9,7 +9,7 @@
 <block>
   <name>QT GUI Label</name>
   <key>variable_qtgui_label</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import eng_notation</import>
   <var_make>self.$(id) = $(id) = $value</var_make>
   <make>#set $win = 'self._%s_tool_bar'%$id
--- a/gr-qtgui/grc/qtgui_number_sink.xml
+++ b/gr-qtgui/grc/qtgui_number_sink.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Number Sink</name>
   <key>qtgui_number_sink</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>import sip</import>
   <make>#set $win = 'self._%s_win'%$id
--- a/gr-qtgui/grc/qtgui_push_button.xml
+++ b/gr-qtgui/grc/qtgui_push_button.xml
@@ -8,7 +8,7 @@
 <block>
 	<name>QT GUI Push Button</name>
 	<key>variable_qtgui_push_button</key>
-	<import>from PyQt4 import Qt</import>
+	<import>from PyQt5 import Qt</import>
 	<var_make>self.$(id) = $(id) = $value</var_make>
 	<make>#set $win = '_%s_push_button'%$id
 #if not $label()
--- a/gr-qtgui/grc/qtgui_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_sink_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Sink</name>
   <key>qtgui_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>from gnuradio.filter import firdes</import>
   <import>import sip</import>
--- a/gr-qtgui/grc/qtgui_tab_widget.xml
+++ b/gr-qtgui/grc/qtgui_tab_widget.xml
@@ -7,7 +7,7 @@
 <block>
 	<name>QT GUI Tab Widget</name>
 	<key>qtgui_tab_widget</key>
-	<import>from PyQt4 import Qt</import>
+	<import>from PyQt5 import Qt</import>
 	<make>#set $win = 'self.%s'%$id
 Qt.QTabWidget()
 #set $all_labels = [$label0, $label1, $label2, $label3, $label4,
--- a/gr-qtgui/grc/qtgui_time_raster_x.xml
+++ b/gr-qtgui/grc/qtgui_time_raster_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Time Raster Sink</name>
   <key>qtgui_time_raster_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>import sip</import>
   <make>#set $win = 'self._%s_win'%$id
--- a/gr-qtgui/grc/qtgui_time_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_time_sink_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Time Sink</name>
   <key>qtgui_time_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>from gnuradio.filter import firdes</import>
   <import>import sip</import>
--- a/gr-qtgui/grc/qtgui_vector_sink_f.xml
+++ b/gr-qtgui/grc/qtgui_vector_sink_f.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Vector Sink</name>
   <key>qtgui_vector_sink_f</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>import sip</import>
   <make>#set $win = 'self._%s_win'%$id
--- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
@@ -7,7 +7,7 @@
 <block>
   <name>QT GUI Waterfall Sink</name>
   <key>qtgui_waterfall_sink_x</key>
-  <import>from PyQt4 import Qt</import>
+  <import>from PyQt5 import Qt</import>
   <import>from gnuradio import qtgui</import>
   <import>from gnuradio.filter import firdes</import>
   <import>import sip</import>
--- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h
+++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h
@@ -28,6 +28,7 @@
 #include <QtGui/QtGui>
 #include <QtGui/QIntValidator>
 #include <QtGui/QDoubleValidator>
+#include <QtWidgets/QtWidgets>
 #include <qwt_symbol.h>
 #include <gnuradio/filter/firdes.h>
 #include <gnuradio/qtgui/qtgui_types.h>
--- a/gr-qtgui/lib/CMakeLists.txt
+++ b/gr-qtgui/lib/CMakeLists.txt
@@ -45,8 +45,8 @@
     ${qtgui_mod_includedir}/VectorDisplayPlot.h
     edit_box_msg_impl.h
 )
-QT4_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs})
-QT4_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui)
+QT5_WRAP_CPP(qtgui_moc_sources ${qtgui_moc_hdrs})
+QT5_WRAP_UI(qtgui_ui_hdrs spectrumdisplayform.ui)
 
 #FIXME the sources expect <foo>.ui.h, but the macros generate ui_foo.h
 #avoid changing the sources by generating the header with the include
@@ -127,7 +127,7 @@
     ${GNURADIO_RUNTIME_INCLUDE_DIRS}
     ${VOLK_INCLUDE_DIRS}
     ${QWT_INCLUDE_DIRS}
-    ${QT_INCLUDE_DIRS}
+    ${Qt5Widgets_INCLUDE_DIRS}
     ${FFTW3F_INCLUDE_DIRS}
     ${Boost_INCLUDE_DIRS}
     ${PYTHON_INCLUDE_DIRS}
@@ -154,7 +154,7 @@
     gnuradio-filter
     ${VOLK_LIBRARIES}
     ${QWT_LIBRARIES}
-    ${QT_LIBRARIES}
+    ${Qt5Widgets_LIBRARIES}
     ${FFTW3F_LIBRARIES}
 )
 if (WIN32)
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -26,7 +26,6 @@
 #include <gnuradio/qtgui/SpectrumGUIClass.h>
 //Added by qt3to4:
 #include <QEvent>
-#include <QCustomEvent>
 #include <volk/volk.h>
 
 const long SpectrumGUIClass::MAX_FFT_SIZE = 32768;
--- a/gr-qtgui/lib/const_sink_c_impl.cc
+++ b/gr-qtgui/lib/const_sink_c_impl.cc
@@ -127,10 +127,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -156,10 +156,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
         d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -155,10 +155,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/histogram_sink_f_impl.cc
+++ b/gr-qtgui/lib/histogram_sink_f_impl.cc
@@ -115,10 +115,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/sink_c_impl.cc
+++ b/gr-qtgui/lib/sink_c_impl.cc
@@ -131,10 +131,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/sink_f_impl.cc
+++ b/gr-qtgui/lib/sink_f_impl.cc
@@ -131,10 +131,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/time_raster_sink_b_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc
@@ -130,10 +130,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/time_raster_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc
@@ -128,10 +128,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/time_sink_c_impl.cc
+++ b/gr-qtgui/lib/time_sink_c_impl.cc
@@ -134,10 +134,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/time_sink_f_impl.cc
+++ b/gr-qtgui/lib/time_sink_f_impl.cc
@@ -129,10 +129,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/vector_sink_f_impl.cc
+++ b/gr-qtgui/lib/vector_sink_f_impl.cc
@@ -140,10 +140,6 @@
         d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
         d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/waterfall_sink_c_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -159,10 +159,6 @@
 	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
 	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/lib/waterfall_sink_f_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -155,10 +155,6 @@
  	d_qApplication = qApp;
       }
       else {
-#if QT_VERSION >= 0x040500
-        std::string style = prefs::singleton()->get_string("qtgui", "style", "raster");
-        QApplication::setGraphicsSystem(QString(style.c_str()));
-#endif
  	d_qApplication = new QApplication(d_argc, &d_argv);
       }
 
--- a/gr-qtgui/python/qtgui/range.py
+++ b/gr-qtgui/python/qtgui/range.py
@@ -21,7 +21,7 @@
 # Boston, MA 02110-1301, USA.
 #
 
-from PyQt4 import Qt, QtCore, QtGui
+from PyQt5 import Qt, QtCore, QtWidgets
 import util
 
 class Range(object):
@@ -64,10 +64,10 @@
         return (val*self.step+self.min)
 
 
-class RangeWidget(QtGui.QWidget):
+class RangeWidget(QtWidgets.QWidget):
     def __init__(self, ranges, slot, label, style, rangeType=float):
         """ Creates the QT Range widget """
-        QtGui.QWidget.__init__(self)
+        QtWidgets.QWidget.__init__(self)
 
         self.range = ranges
         self.style = style
@@ -98,10 +98,10 @@
         layout.addWidget(self.d_widget)
         self.setLayout(layout)
 
-    class Dial(QtGui.QDial):
+    class Dial(QtWidgets.QDial):
         """ Creates the range using a dial """
         def __init__(self, parent, ranges, slot, rangeType=float):
-            QtGui.QDial.__init__(self, parent)
+            QtWidgets.QDial.__init__(self, parent)
 
             self.rangeType = rangeType
 
@@ -124,10 +124,10 @@
             val = self.range.map_range(value)
             self.notifyChanged(self.rangeType(val))
 
-    class Slider(QtGui.QSlider):
+    class Slider(QtWidgets.QSlider):
         """ Creates the range using a slider """
         def __init__(self, parent, ranges, slot, rangeType=float):
-            QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent)
+            QtWidgets.QSlider.__init__(self, QtCore.Qt.Horizontal, parent)
 
             self.rangeType = rangeType
 
@@ -166,18 +166,18 @@
                 event.accept()
             # Use repaint rather than calling the super mousePressEvent.
             # Calling super causes issue where slider jumps to wrong value.
-            QtGui.QSlider.repaint(self)
+            QtWidgets.QSlider.repaint(self)
 
         def mouseMoveEvent(self, event):
             new = self.minimum() + ((self.maximum()-self.minimum()) * event.x()) / self.width()
             self.setValue(new)
             event.accept()
-            QtGui.QSlider.repaint(self)
+            QtWidgets.QSlider.repaint(self)
 
-    class Counter(QtGui.QDoubleSpinBox):
+    class Counter(QtWidgets.QDoubleSpinBox):
         """ Creates the range using a counter """
         def __init__(self, parent, ranges, slot, rangeType=float):
-            QtGui.QDoubleSpinBox.__init__(self, parent)
+            QtWidgets.QDoubleSpinBox.__init__(self, parent)
 
             self.rangeType = rangeType
 
@@ -196,10 +196,10 @@
             """ Handle the valueChanged signal by converting to the right type """
             self.notifyChanged(self.rangeType(value))
 
-    class CounterSlider(QtGui.QWidget):
+    class CounterSlider(QtWidgets.QWidget):
         """ Creates the range using a counter and slider """
         def __init__(self, parent, ranges, slot, rangeType=float):
-            QtGui.QWidget.__init__(self, parent)
+            QtWidgets.QWidget.__init__(self, parent)
 
             self.rangeType = rangeType
 
