diff options
Diffstat (limited to 'src/widgetinfo.cpp')
-rw-r--r-- | src/widgetinfo.cpp | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/src/widgetinfo.cpp b/src/widgetinfo.cpp index 477b61c..d23da8f 100644 --- a/src/widgetinfo.cpp +++ b/src/widgetinfo.cpp @@ -1,83 +1,99 @@ #include "widgetinfo.h" -WidgetInfo::WidgetInfo(QObject *parent) - : QObject(parent) +struct WidgetInfoData : public QSharedData { + QUrl url; + QString desc; + bool invert; + short page; + WidgetInfo::WidgetSize size; + WidgetInfo::WidgetPosition pos; +}; +WidgetInfo::WidgetInfo() + : d(new WidgetInfoData) +{ +} + +WidgetInfo::WidgetInfo(const WidgetInfo &other) + : d(other.d) +{ +} + +WidgetInfo::~WidgetInfo() +{ +} + +WidgetInfo& WidgetInfo::operator =(const WidgetInfo &other) +{ + if (this != &other) { + d = other.d; + } + + return *this; } bool WidgetInfo::valid() const { - return !_url.isEmpty(); + return !d->url.isEmpty(); } QUrl WidgetInfo::url() const { - return _url; + return d->url; } void WidgetInfo::setUrl(const QUrl &url) { - if (url != _url) { - const bool cur_valid = valid(); + d->url = url; +} - _url = url; - emit urlChanged(); +QString WidgetInfo::description() const +{ + return d->desc; +} - if (cur_valid != valid()) { - emit validChanged(); - } - } +void WidgetInfo::setDescription(const QString &desc) +{ + d->desc = desc; } bool WidgetInfo::invert() const { - return _invert; + return d->invert; } void WidgetInfo::setInvert(bool invert) { - if (invert != _invert) { - _invert = invert; - emit invertChanged(); - } + d->invert = invert; } int WidgetInfo::page() const { - return _page; + return d->page; } void WidgetInfo::setPage(int page) { - if (page != _page) { - _page = page; - emit pageChanged(); - } + d->page = page; } WidgetInfo::WidgetSize WidgetInfo::size() const { - return _size; + return d->size; } void WidgetInfo::setSize(const WidgetSize &size) { - if (size != _size) { - _size = size; - emit sizeChanged(); - } + d->size = size; } WidgetInfo::WidgetPosition WidgetInfo::position() const { - return _pos; + return d->pos; } void WidgetInfo::setPosition(const WidgetPosition &pos) { - if (pos != _pos) { - _pos = pos; - emit positionChanged(); - } + d->pos = pos; } |