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)
|
||||
{
|
||||
QGraphicsObject *obj = widget;
|
||||
associateWidget(obj, operation);
|
||||
associateItem(widget, operation);
|
||||
}
|
||||
|
||||
void Service::disassociateWidget(QGraphicsWidget *widget)
|
||||
{
|
||||
QGraphicsObject *obj = widget;
|
||||
disassociateWidget(obj);
|
||||
disassociateItem(widget);
|
||||
}
|
||||
|
||||
void Service::associateWidget(QGraphicsObject *widget, const QString &operation)
|
||||
void Service::associateItem(QGraphicsObject *widget, const QString &operation)
|
||||
{
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
|
||||
disassociateWidget(widget);
|
||||
disassociateItem(widget);
|
||||
d->associatedGraphicsWidgets.insert(widget, operation);
|
||||
connect(widget, SIGNAL(destroyed(QObject*)),
|
||||
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*)));
|
||||
@ -301,7 +299,7 @@ void Service::associateWidget(QGraphicsObject *widget, const QString &operation)
|
||||
widget->setEnabled(!d->disabledOperations.contains(operation));
|
||||
}
|
||||
|
||||
void Service::disassociateWidget(QGraphicsObject *widget)
|
||||
void Service::disassociateItem(QGraphicsObject *widget)
|
||||
{
|
||||
if (!widget) {
|
||||
return;
|
||||
|
24
service.h
24
service.h
@ -203,38 +203,38 @@ public:
|
||||
/**
|
||||
* This method only exists to maintain binary compatibility.
|
||||
*
|
||||
* @see associateWidget(QGraphicsObject*,QString)
|
||||
* @see associateItem
|
||||
*/
|
||||
Q_INVOKABLE void associateWidget(QGraphicsWidget *widget, const QString &operation);
|
||||
|
||||
/**
|
||||
* This method only exists to maintain binary compatibility.
|
||||
*
|
||||
* @see disassociateWidget(QGraphicsObject*)
|
||||
* @see disassociateItem
|
||||
*/
|
||||
Q_INVOKABLE void disassociateWidget(QGraphicsWidget *widget);
|
||||
|
||||
/**
|
||||
* Assoicates a widget with an operation, which allows the service to
|
||||
* automatically manage, for example, the enabled state of a widget.
|
||||
* Associates a graphics item with an operation, which allows the service to
|
||||
* 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.
|
||||
*
|
||||
* @param widget the QGraphicsItem to associate with the service
|
||||
* @param operation the operation to associate the widget with
|
||||
* @param item the QGraphicsObject to associate with the service
|
||||
* @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.
|
||||
*
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user