2024-02-17 22:51:19 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "breezespinboxengine.h"
|
|
|
|
|
|
|
|
#include <QEvent>
|
|
|
|
|
|
|
|
namespace Breeze
|
|
|
|
{
|
|
|
|
//____________________________________________________________
|
2024-08-09 01:20:25 +00:00
|
|
|
bool SpinBoxEngine::registerWidget(QObject *target)
|
2024-02-17 22:51:19 +00:00
|
|
|
{
|
2024-08-09 01:20:25 +00:00
|
|
|
if (!target) {
|
2024-02-17 22:51:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// create new data class
|
2024-08-09 01:20:25 +00:00
|
|
|
if (!_data.contains(target)) {
|
|
|
|
_data.insert(target, new SpinBoxData(this, target, duration()), enabled());
|
2024-02-17 22:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// connect destruction signal
|
2024-08-09 01:20:25 +00:00
|
|
|
connect(target, &QObject::destroyed, this, &SpinBoxEngine::unregisterWidget, Qt::UniqueConnection);
|
2024-02-17 22:51:19 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|