419 { |
419 { |
420 if (d_ptr->m_model == model) |
420 if (d_ptr->m_model == model) |
421 return; |
421 return; |
422 |
422 |
423 if (d_ptr->m_model) { |
423 if (d_ptr->m_model) { |
424 disconnect(d_ptr->m_model, SIGNAL(stopAdded(QtGradientStop *)), |
424 disconnect(d_ptr->m_model, SIGNAL(stopAdded(QtGradientStop*)), |
425 this, SLOT(slotStopAdded(QtGradientStop *))); |
425 this, SLOT(slotStopAdded(QtGradientStop*))); |
426 disconnect(d_ptr->m_model, SIGNAL(stopRemoved(QtGradientStop *)), |
426 disconnect(d_ptr->m_model, SIGNAL(stopRemoved(QtGradientStop*)), |
427 this, SLOT(slotStopRemoved(QtGradientStop *))); |
427 this, SLOT(slotStopRemoved(QtGradientStop*))); |
428 disconnect(d_ptr->m_model, SIGNAL(stopMoved(QtGradientStop *, qreal)), |
428 disconnect(d_ptr->m_model, SIGNAL(stopMoved(QtGradientStop*,qreal)), |
429 this, SLOT(slotStopMoved(QtGradientStop *, qreal))); |
429 this, SLOT(slotStopMoved(QtGradientStop*,qreal))); |
430 disconnect(d_ptr->m_model, SIGNAL(stopsSwapped(QtGradientStop *, QtGradientStop *)), |
430 disconnect(d_ptr->m_model, SIGNAL(stopsSwapped(QtGradientStop*,QtGradientStop*)), |
431 this, SLOT(slotStopsSwapped(QtGradientStop *, QtGradientStop *))); |
431 this, SLOT(slotStopsSwapped(QtGradientStop*,QtGradientStop*))); |
432 disconnect(d_ptr->m_model, SIGNAL(stopChanged(QtGradientStop *, const QColor &)), |
432 disconnect(d_ptr->m_model, SIGNAL(stopChanged(QtGradientStop*,QColor)), |
433 this, SLOT(slotStopChanged(QtGradientStop *, const QColor &))); |
433 this, SLOT(slotStopChanged(QtGradientStop*,QColor))); |
434 disconnect(d_ptr->m_model, SIGNAL(stopSelected(QtGradientStop *, bool)), |
434 disconnect(d_ptr->m_model, SIGNAL(stopSelected(QtGradientStop*,bool)), |
435 this, SLOT(slotStopSelected(QtGradientStop *, bool))); |
435 this, SLOT(slotStopSelected(QtGradientStop*,bool))); |
436 disconnect(d_ptr->m_model, SIGNAL(currentStopChanged(QtGradientStop *)), |
436 disconnect(d_ptr->m_model, SIGNAL(currentStopChanged(QtGradientStop*)), |
437 this, SLOT(slotCurrentStopChanged(QtGradientStop *))); |
437 this, SLOT(slotCurrentStopChanged(QtGradientStop*))); |
438 |
438 |
439 d_ptr->m_stops.clear(); |
439 d_ptr->m_stops.clear(); |
440 } |
440 } |
441 |
441 |
442 d_ptr->m_model = model; |
442 d_ptr->m_model = model; |
443 |
443 |
444 if (d_ptr->m_model) { |
444 if (d_ptr->m_model) { |
445 connect(d_ptr->m_model, SIGNAL(stopAdded(QtGradientStop *)), |
445 connect(d_ptr->m_model, SIGNAL(stopAdded(QtGradientStop*)), |
446 this, SLOT(slotStopAdded(QtGradientStop *))); |
446 this, SLOT(slotStopAdded(QtGradientStop*))); |
447 connect(d_ptr->m_model, SIGNAL(stopRemoved(QtGradientStop *)), |
447 connect(d_ptr->m_model, SIGNAL(stopRemoved(QtGradientStop*)), |
448 this, SLOT(slotStopRemoved(QtGradientStop *))); |
448 this, SLOT(slotStopRemoved(QtGradientStop*))); |
449 connect(d_ptr->m_model, SIGNAL(stopMoved(QtGradientStop *, qreal)), |
449 connect(d_ptr->m_model, SIGNAL(stopMoved(QtGradientStop*,qreal)), |
450 this, SLOT(slotStopMoved(QtGradientStop *, qreal))); |
450 this, SLOT(slotStopMoved(QtGradientStop*,qreal))); |
451 connect(d_ptr->m_model, SIGNAL(stopsSwapped(QtGradientStop *, QtGradientStop *)), |
451 connect(d_ptr->m_model, SIGNAL(stopsSwapped(QtGradientStop*,QtGradientStop*)), |
452 this, SLOT(slotStopsSwapped(QtGradientStop *, QtGradientStop *))); |
452 this, SLOT(slotStopsSwapped(QtGradientStop*,QtGradientStop*))); |
453 connect(d_ptr->m_model, SIGNAL(stopChanged(QtGradientStop *, const QColor &)), |
453 connect(d_ptr->m_model, SIGNAL(stopChanged(QtGradientStop*,QColor)), |
454 this, SLOT(slotStopChanged(QtGradientStop *, const QColor &))); |
454 this, SLOT(slotStopChanged(QtGradientStop*,QColor))); |
455 connect(d_ptr->m_model, SIGNAL(stopSelected(QtGradientStop *, bool)), |
455 connect(d_ptr->m_model, SIGNAL(stopSelected(QtGradientStop*,bool)), |
456 this, SLOT(slotStopSelected(QtGradientStop *, bool))); |
456 this, SLOT(slotStopSelected(QtGradientStop*,bool))); |
457 connect(d_ptr->m_model, SIGNAL(currentStopChanged(QtGradientStop *)), |
457 connect(d_ptr->m_model, SIGNAL(currentStopChanged(QtGradientStop*)), |
458 this, SLOT(slotCurrentStopChanged(QtGradientStop *))); |
458 this, SLOT(slotCurrentStopChanged(QtGradientStop*))); |
459 |
459 |
460 QList<QtGradientStop *> stops = d_ptr->m_model->stops().values(); |
460 QList<QtGradientStop *> stops = d_ptr->m_model->stops().values(); |
461 QListIterator<QtGradientStop *> itStop(stops); |
461 QListIterator<QtGradientStop *> itStop(stops); |
462 while (itStop.hasNext()) |
462 while (itStop.hasNext()) |
463 d_ptr->slotStopAdded(itStop.next()); |
463 d_ptr->slotStopAdded(itStop.next()); |