199 pmp.fillRect(pixSize, 0, pixSize, pixSize, c2); |
199 pmp.fillRect(pixSize, 0, pixSize, pixSize, c2); |
200 |
200 |
201 pal.setBrush(QPalette::Base, QBrush(pm)); |
201 pal.setBrush(QPalette::Base, QBrush(pm)); |
202 m_ui.listWidget->viewport()->setPalette(pal); |
202 m_ui.listWidget->viewport()->setPalette(pal); |
203 |
203 |
204 connect(m_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(slotGradientActivated(QListWidgetItem *))); |
204 connect(m_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotGradientActivated(QListWidgetItem*))); |
205 connect(m_ui.listWidget, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(slotRenameGradient(QListWidgetItem *))); |
205 connect(m_ui.listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(slotRenameGradient(QListWidgetItem*))); |
206 connect(m_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(slotCurrentItemChanged(QListWidgetItem *))); |
206 connect(m_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(slotCurrentItemChanged(QListWidgetItem*))); |
207 |
207 |
208 m_newAction = new QAction(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/plus.png")), tr("New..."), this); |
208 m_newAction = new QAction(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/plus.png")), tr("New..."), this); |
209 m_editAction = new QAction(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/edit.png")), tr("Edit..."), this); |
209 m_editAction = new QAction(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/edit.png")), tr("Edit..."), this); |
210 m_renameAction = new QAction(tr("Rename"), this); |
210 m_renameAction = new QAction(tr("Rename"), this); |
211 m_removeAction = new QAction(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/minus.png")), tr("Remove"), this); |
211 m_removeAction = new QAction(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/minus.png")), tr("Remove"), this); |
232 { |
232 { |
233 if (m_manager == manager) |
233 if (m_manager == manager) |
234 return; |
234 return; |
235 |
235 |
236 if (m_manager) { |
236 if (m_manager) { |
237 disconnect(m_manager, SIGNAL(gradientAdded(const QString &, const QGradient &)), |
237 disconnect(m_manager, SIGNAL(gradientAdded(QString,QGradient)), |
238 this, SLOT(slotGradientAdded(const QString &, const QGradient &))); |
238 this, SLOT(slotGradientAdded(QString,QGradient))); |
239 disconnect(m_manager, SIGNAL(gradientRenamed(const QString &, const QString &)), |
239 disconnect(m_manager, SIGNAL(gradientRenamed(QString,QString)), |
240 this, SLOT(slotGradientRenamed(const QString &, const QString &))); |
240 this, SLOT(slotGradientRenamed(QString,QString))); |
241 disconnect(m_manager, SIGNAL(gradientChanged(const QString &, const QGradient &)), |
241 disconnect(m_manager, SIGNAL(gradientChanged(QString,QGradient)), |
242 this, SLOT(slotGradientChanged(const QString &, const QGradient &))); |
242 this, SLOT(slotGradientChanged(QString,QGradient))); |
243 disconnect(m_manager, SIGNAL(gradientRemoved(const QString &)), |
243 disconnect(m_manager, SIGNAL(gradientRemoved(QString)), |
244 this, SLOT(slotGradientRemoved(const QString &))); |
244 this, SLOT(slotGradientRemoved(QString))); |
245 |
245 |
246 m_ui.listWidget->clear(); |
246 m_ui.listWidget->clear(); |
247 m_idToItem.clear(); |
247 m_idToItem.clear(); |
248 m_itemToId.clear(); |
248 m_itemToId.clear(); |
249 } |
249 } |
258 while (itGrad.hasNext()) { |
258 while (itGrad.hasNext()) { |
259 itGrad.next(); |
259 itGrad.next(); |
260 slotGradientAdded(itGrad.key(), itGrad.value()); |
260 slotGradientAdded(itGrad.key(), itGrad.value()); |
261 } |
261 } |
262 |
262 |
263 connect(m_manager, SIGNAL(gradientAdded(const QString &, const QGradient &)), |
263 connect(m_manager, SIGNAL(gradientAdded(QString,QGradient)), |
264 this, SLOT(slotGradientAdded(const QString &, const QGradient &))); |
264 this, SLOT(slotGradientAdded(QString,QGradient))); |
265 connect(m_manager, SIGNAL(gradientRenamed(const QString &, const QString &)), |
265 connect(m_manager, SIGNAL(gradientRenamed(QString,QString)), |
266 this, SLOT(slotGradientRenamed(const QString &, const QString &))); |
266 this, SLOT(slotGradientRenamed(QString,QString))); |
267 connect(m_manager, SIGNAL(gradientChanged(const QString &, const QGradient &)), |
267 connect(m_manager, SIGNAL(gradientChanged(QString,QGradient)), |
268 this, SLOT(slotGradientChanged(const QString &, const QGradient &))); |
268 this, SLOT(slotGradientChanged(QString,QGradient))); |
269 connect(m_manager, SIGNAL(gradientRemoved(const QString &)), |
269 connect(m_manager, SIGNAL(gradientRemoved(QString)), |
270 this, SLOT(slotGradientRemoved(const QString &))); |
270 this, SLOT(slotGradientRemoved(QString))); |
271 } |
271 } |
272 |
272 |
273 QtGradientManager *QtGradientView::gradientManager() const |
273 QtGradientManager *QtGradientView::gradientManager() const |
274 { |
274 { |
275 return m_manager; |
275 return m_manager; |