Rename new Plasma::Service method to avoid clashes
Having overloaded Q_INVOKABLE methods where one takes a superclass of another is a Bad Idea(TM), since the script engine cannot disambiguate the methods. associateItem is more accurate than associateWidget for these methods, anyway. REVIEW: 104760
This commit is contained in:
parent
23b50f2dee
commit
c4c2e8ee49
12
service.cpp
12
service.cpp
@ -277,23 +277,21 @@ void Service::disassociateWidget(QWidget *widget)
|
|||||||
|
|
||||||
void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
|
void Service::associateWidget(QGraphicsWidget *widget, const QString &operation)
|
||||||
{
|
{
|
||||||
QGraphicsObject *obj = widget;
|
associateItem(widget, operation);
|
||||||
associateWidget(obj, operation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service::disassociateWidget(QGraphicsWidget *widget)
|
void Service::disassociateWidget(QGraphicsWidget *widget)
|
||||||
{
|
{
|
||||||
QGraphicsObject *obj = widget;
|
disassociateItem(widget);
|
||||||
disassociateWidget(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service::associateWidget(QGraphicsObject *widget, const QString &operation)
|
void Service::associateItem(QGraphicsObject *widget, const QString &operation)
|
||||||
{
|
{
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
disassociateWidget(widget);
|
disassociateItem(widget);
|
||||||
d->associatedGraphicsWidgets.insert(widget, operation);
|
d->associatedGraphicsWidgets.insert(widget, operation);
|
||||||
connect(widget, SIGNAL(destroyed(QObject*)),
|
connect(widget, SIGNAL(destroyed(QObject*)),
|
||||||
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
|
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
|
||||||
@ -301,7 +299,7 @@ void Service::associateWidget(QGraphicsObject *widget, const QString &operation)
|
|||||||
widget->setEnabled(!d->disabledOperations.contains(operation));
|
widget->setEnabled(!d->disabledOperations.contains(operation));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service::disassociateWidget(QGraphicsObject *widget)
|
void Service::disassociateItem(QGraphicsObject *widget)
|
||||||
{
|
{
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
return;
|
return;
|
||||||
|
24
service.h
24
service.h
@ -203,38 +203,38 @@ public:
|
|||||||
/**
|
/**
|
||||||
* This method only exists to maintain binary compatibility.
|
* This method only exists to maintain binary compatibility.
|
||||||
*
|
*
|
||||||
* @see associateWidget(QGraphicsObject*,QString)
|
* @see associateItem
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
|
Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method only exists to maintain binary compatibility.
|
* This method only exists to maintain binary compatibility.
|
||||||
*
|
*
|
||||||
* @see disassociateWidget(QGraphicsObject*)
|
* @see disassociateItem
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
|
Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assoicates a widget with an operation, which allows the service to
|
* Associates a graphics item with an operation, which allows the service to
|
||||||
* automatically manage, for example, the enabled state of a widget.
|
* automatically manage, for example, the enabled state of the item.
|
||||||
*
|
*
|
||||||
* This will remove any previous associations the widget had with
|
* This will remove any previous associations the item had with
|
||||||
* operations on this engine.
|
* operations on this engine.
|
||||||
*
|
*
|
||||||
* @param widget the QGraphicsItem to associate with the service
|
* @param item the QGraphicsObject to associate with the service
|
||||||
* @param operation the operation to associate the widget with
|
* @param operation the operation to associate the item with
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void associateWidget(QGraphicsObject *widget, const QString &operation);
|
Q_INVOKABLE void associateItem(QGraphicsObject *item, const QString &operation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disassociates a widget if it has been associated with an operation
|
* Disassociates a graphics item if it has been associated with an operation
|
||||||
* on this service.
|
* on this service.
|
||||||
*
|
*
|
||||||
* This will not change the enabled state of the widget.
|
* This will not change the enabled state of the item.
|
||||||
*
|
*
|
||||||
* @param widget the QGraphicsObject to disassociate.
|
* @param widget the QGraphicsItem to disassociate.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void disassociateWidget(QGraphicsObject *widget);
|
Q_INVOKABLE void disassociateItem(QGraphicsObject *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a parameter map for the given description
|
* @return a parameter map for the given description
|
||||||
|
Loading…
Reference in New Issue
Block a user