#ifndef KEYVALUELISTITEM_H #define KEYVALUELISTITEM_H #include <QtGui/QApplication> #include <QObject> #include <ItemFilterType.h> #include <ItemFilter.h> #include <QDebug> using namespace com_ebay_www_marketplace_search_v1_services; class KeyValueListItem : public QObject { Q_OBJECT // NOTIFY - Simply to get rid of the warning message xxxx depends on non-NOTIFYable properties: xxxx Q_PROPERTY(QString displayValue READ displayValue NOTIFY displayValueChanged) Q_PROPERTY(QString key READ key NOTIFY keyChanged) Q_PROPERTY(QString value READ value NOTIFY valueChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged) public: KeyValueListItem(const QString &displayValue, const ADBItemFilterTypeEnum &key, const QString &value, const bool &selected, QObject *parent=0); QString displayValue() const; ADBItemFilterTypeEnum key() const; QString value() const; bool selected() const; void setSelected(const bool &selected); signals: void displayValueChanged(); void keyChanged(); void valueChanged(); void selectedChanged(); private: QString m_displayValue; ADBItemFilterTypeEnum m_key; QString m_value; bool m_selected; }; #endif // KEYVALUELISTITEM_H
#include "keyvaluelistitem.h" KeyValueListItem::KeyValueListItem(const QString &displayValue, const ADBItemFilterTypeEnum &key, const QString &value, const bool &selected, QObject *parent) : QObject(parent), m_displayValue(displayValue), m_key(key), m_value(value), m_selected(selected) { } QString KeyValueListItem::displayValue() const { if (m_displayValue == NULL) return QString("NULL"); else return m_displayValue; } ADBItemFilterTypeEnum KeyValueListItem::key() const { if (m_key == NULL) return ItemFilterType_CONDITION; else return m_key; } QString KeyValueListItem::value() const { if (m_value == NULL) return QString("NULL"); else return m_value; } bool KeyValueListItem::selected() const { if (m_selected == NULL) return false; else return m_selected; } void KeyValueListItem::setSelected(const bool &selected) { if (selected != m_selected) { m_selected = selected; emit selectedChanged(); } }
conditions->append(new KeyValueListItem("New other (see details)", ItemFilterType_CONDITION, "1500", false));