@@ -35,6 +35,11 @@ DeviceView::DeviceView(QWidget *parent) :
3535 size = width ();
3636}
3737
38+ DeviceView::~DeviceView ()
39+ {
40+ delete controller;
41+ }
42+
3843struct led_label
3944{
4045 QString label_text;
@@ -201,7 +206,10 @@ void DeviceView::setController(RGBController * controller_ptr)
201206 | Store the controller pointer |
202207 \*-----------------------------------------------------*/
203208 controller = controller_ptr;
209+ }
204210
211+ void DeviceView::InitDeviceView ()
212+ {
205213 /* -----------------------------------------------------*\
206214 | Set the size of the selection flags vector |
207215 \*-----------------------------------------------------*/
@@ -364,7 +372,7 @@ void DeviceView::setController(RGBController * controller_ptr)
364372 | Calculate LED box positions for single/linear zones |
365373 \*-----------------------------------------------------*/
366374 unsigned int leds_count = controller->zones [zone_idx].leds_count ;
367-
375+
368376 for (unsigned int led_idx = 0 ; led_idx < leds_count; led_idx++)
369377 {
370378 unsigned int led_pos_idx = controller->zones [zone_idx].start_idx + led_idx;
@@ -587,7 +595,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */)
587595 \*-----------------------------------------------------*/
588596 if (controller->leds .size () != led_pos.size ())
589597 {
590- setController (controller );
598+ InitDeviceView ( );
591599 }
592600
593601 /* -----------------------------------------------------*\
@@ -722,7 +730,7 @@ void DeviceView::updateSelection()
722730 selectedLeds.push_back (led_idx);
723731 }
724732 }
725-
733+
726734 update ();
727735
728736 /* -----------------------------------------------------*\
@@ -788,7 +796,7 @@ bool DeviceView::selectLeds(QVector<int> target)
788796 }
789797
790798 update ();
791-
799+
792800 /* -----------------------------------------------------*\
793801 | Send selection changed signal |
794802 \*-----------------------------------------------------*/
@@ -823,7 +831,7 @@ bool DeviceView::selectZone(int zone, bool add)
823831 }
824832
825833 update ();
826-
834+
827835 /* -----------------------------------------------------*\
828836 | Send selection changed signal |
829837 \*-----------------------------------------------------*/
0 commit comments