summaryrefslogtreecommitdiffstats
path: root/src/wrappedobjectswidgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrappedobjectswidgets')
-rw-r--r--src/wrappedobjectswidgets/doc/qtwrappedobjectswidgets.qdocconf41
-rw-r--r--src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.cpp43
-rw-r--r--src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.pro3
-rw-r--r--src/wrappedobjectswidgets/doc/src/qtwrappedobjectswidgets.qdoc66
-rw-r--r--src/wrappedobjectswidgets/internal/filterwidget.cpp253
-rw-r--r--src/wrappedobjectswidgets/internal/filterwidget_p.h138
-rw-r--r--src/wrappedobjectswidgets/internal/propertyeditor.cpp119
-rw-r--r--src/wrappedobjectswidgets/internal/propertyeditor_p.h88
-rw-r--r--src/wrappedobjectswidgets/internal/propertyeditoritemdelegate.cpp225
-rw-r--r--src/wrappedobjectswidgets/internal/propertyeditoritemdelegate_p.h79
-rw-r--r--src/wrappedobjectswidgets/qtwrappedobjectswidgetsglobal.h61
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectmodel.cpp211
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectmodel.h90
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectmodel_p.h68
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.cpp136
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.h83
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertyeditor_p.h83
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.cpp68
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.h69
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertymodel.cpp300
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertymodel.h91
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectpropertymodel_p.h72
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectview.cpp303
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectview.h101
-rw-r--r--src/wrappedobjectswidgets/qwrappedobjectview_p.h73
-rw-r--r--src/wrappedobjectswidgets/wrappedobjectswidgets.pro37
26 files changed, 0 insertions, 2901 deletions
diff --git a/src/wrappedobjectswidgets/doc/qtwrappedobjectswidgets.qdocconf b/src/wrappedobjectswidgets/doc/qtwrappedobjectswidgets.qdocconf
deleted file mode 100644
index 58638975..00000000
--- a/src/wrappedobjectswidgets/doc/qtwrappedobjectswidgets.qdocconf
+++ /dev/null
@@ -1,41 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-
-project = QtWrappedObjectsWidgets
-description = Qt WrappedObjectsWidgets Reference Documentation
-url = http://qt-project.org/doc/qtwrappedobjectswidgets
-version = 5.0.0
-
-examplesinstallpath = wrappedobjectswidgets
-
-qhp.projects = QtWrappedObjectsWidgets
-
-qhp.QtWrappedObjectsWidgets.file = qtwrappedobjectswidgets.qhp
-qhp.QtWrappedObjectsWidgets.namespace = org.qt-project.qtwrappedobjectswidgets.500
-qhp.QtWrappedObjectsWidgets.virtualFolder = qtwrappedobjectswidgets
-qhp.QtWrappedObjectsWidgets.indexTitle = Qt WrappedObjectsWidgets
-qhp.QtWrappedObjectsWidgets.indexRoot =
-
-qhp.QtWrappedObjectsWidgets.filterAttributes = qtwrappedobjectswidgets 5.0.0 qtrefdoc
-qhp.QtWrappedObjectsWidgets.customFilters.Qt.name = QtWrappedObjectsWidgets 5.0.0
-qhp.QtWrappedObjectsWidgets.customFilters.Qt.filterAttributes = qtwrappedobjectswidgets 5.0.0
-
-qhp.QtWrappedObjectsWidgets.subprojects = classes
-qhp.QtWrappedObjectsWidgets.subprojects.classes.title = C++ Classes
-qhp.QtWrappedObjectsWidgets.subprojects.classes.indexTitle = Qt WrappedObjectsWidgets C++ Classes
-qhp.QtWrappedObjectsWidgets.subprojects.classes.selectors = class fake:headerfile
-qhp.QtWrappedObjectsWidgets.subprojects.classes.sortPages = true
-tagfile = ../../../doc/qtwrappedobjectswidgets/qtwrappedobjectswidgets.tags
-
-depends += qtcore wrappedobjects qtdoc
-
-headerdirs += ..
-
-sourcedirs += .. \
- ../../../examples/wrappedobjectswidgets/doc/src
-
-exampledirs += ../../../examples/wrappedobjectswidgets \
- ../ \
- snippets
-
-imagedirs += images \
- ../../../examples/wrappedobjectswidgets/doc/images
diff --git a/src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.cpp b/src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.cpp
deleted file mode 100644
index a34d6bc9..00000000
--- a/src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//! [0]
-#include <QtWrappedObjectsWidgets>
-//! [0]
diff --git a/src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.pro b/src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.pro
deleted file mode 100644
index dda264e2..00000000
--- a/src/wrappedobjectswidgets/doc/snippets/code/doc_src_qtwrappedobjects.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-#! [0]
-QT += wrappedobjectswidgets
-#! [0]
diff --git a/src/wrappedobjectswidgets/doc/src/qtwrappedobjectswidgets.qdoc b/src/wrappedobjectswidgets/doc/src/qtwrappedobjectswidgets.qdoc
deleted file mode 100644
index cf0ada9b..00000000
--- a/src/wrappedobjectswidgets/doc/src/qtwrappedobjectswidgets.qdoc
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
- \page qtwrappedobjectswidgets-index.html
- \title Qt WrappedObjectsWidgets
- \brief Provide model and widget classes for use with QtWrappedObjects module.
-
- Qt WrappedObjectsWidgets is an add-on module which provides model and widget classes for use with QtWrappedObjects module.
-
- \section1 Getting Started
- To enable Qt WrappedObjectsWidgets in a project, add this directive into the C++ files:
- \code
- #include <QtWrappedObjectsWidgets>
- \endcode
- To link against the Qt WrappedObjectsWidgets module, add this line to the project file:
- \code
- QT += wrappedobjectswidgets
- \endcode
-
- \section1 Reference
- These are links to the API reference materials.
- \list
- \li \l{Qt WrappedObjectsWidgets Module C++ Classes}{C++ classes}
- \endlist
-*/
-
-/*!
- \module QtWrappedObjectsWidgets
- \title Qt WrappedObjectsWidgets Module C++ Classes
- \ingroup modules
- \brief Provide model and widget classes for use with QtWrappedObjects module.
-
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet code/doc_src_qtwrappedobjectswidgets.cpp 0
-
- To link against the module, add this line to your \l qmake \c
- .pro file:
-
- \snippet code/doc_src_qtwrappedobjectswidgets.pro 0
-*/
diff --git a/src/wrappedobjectswidgets/internal/filterwidget.cpp b/src/wrappedobjectswidgets/internal/filterwidget.cpp
deleted file mode 100644
index ba5c9eb3..00000000
--- a/src/wrappedobjectswidgets/internal/filterwidget.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "filterwidget_p.h"
-
-#include <QtCore/QPropertyAnimation>
-
-#include <QtGui/QFocusEvent>
-#include <QtGui/QPainter>
-
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QStyle>
-
-QT_BEGIN_NAMESPACE
-
-enum { debugFilter = 0 };
-
-HintLineEdit::HintLineEdit(QWidget *parent) :
- QLineEdit(parent),
- m_defaultFocusPolicy(focusPolicy()),
- m_refuseFocus(false)
-{
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
-}
-
-IconButton::IconButton(QWidget *parent)
- : QToolButton(parent)
-{
- setCursor(Qt::ArrowCursor);
-}
-
-void IconButton::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- // Note isDown should really use the active state but in most styles
- // this has no proper feedback
- QIcon::Mode state = QIcon::Disabled;
- if (isEnabled())
- state = isDown() ? QIcon::Selected : QIcon::Normal;
- QPixmap iconpixmap = icon().pixmap(QSize(ICONBUTTON_SIZE, ICONBUTTON_SIZE),
- state, QIcon::Off);
- QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height());
- pixmapRect.moveCenter(rect().center());
- painter.setOpacity(m_fader);
- painter.drawPixmap(pixmapRect, iconpixmap);
-}
-
-void IconButton::animateShow(bool visible)
-{
- if (visible) {
- QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
- animation->setDuration(160);
- animation->setEndValue(1.0);
- animation->start(QAbstractAnimation::DeleteWhenStopped);
- } else {
- QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
- animation->setDuration(160);
- animation->setEndValue(0.0);
- animation->start(QAbstractAnimation::DeleteWhenStopped);
- }
-}
-
-bool HintLineEdit::refuseFocus() const
-{
- return m_refuseFocus;
-}
-
-void HintLineEdit::setRefuseFocus(bool v)
-{
- if (v == m_refuseFocus)
- return;
- m_refuseFocus = v;
- setFocusPolicy(m_refuseFocus ? Qt::NoFocus : m_defaultFocusPolicy);
-}
-
-void HintLineEdit::mousePressEvent(QMouseEvent *e)
-{
- // Explicitly focus on click.
- if (m_refuseFocus && !hasFocus())
- setFocus(Qt::OtherFocusReason);
- QLineEdit::mousePressEvent(e);
-}
-
-void HintLineEdit::focusInEvent(QFocusEvent *e)
-{
- if (m_refuseFocus) {
- // Refuse the focus if the mouse it outside. In addition to the mouse
- // press logic, this prevents a re-focussing which occurs once
- // we actually had focus
- const Qt::FocusReason reason = e->reason();
- if (reason == Qt::ActiveWindowFocusReason || reason == Qt::PopupFocusReason) {
- const QPoint mousePos = mapFromGlobal(QCursor::pos());
- const bool refuse = !geometry().contains(mousePos);
- if (refuse) {
- e->ignore();
- return;
- }
- }
- }
-
- QLineEdit::focusInEvent(e);
-}
-
-// ------------------- FilterWidget
-FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) :
- QWidget(parent),
- m_editor(new HintLineEdit(this)),
- m_button(new IconButton(m_editor)),
- m_buttonwidth(0)
-{
- m_editor->setPlaceholderText(tr("Filter"));
-
- // Let the style determine minimum height for our widget
- QSize size(ICONBUTTON_SIZE + 6, ICONBUTTON_SIZE + 2);
-
- // Note KDE does not reserve space for the highlight color
- if (style()->inherits("OxygenStyle")) {
- size = size.expandedTo(QSize(24, 0));
- }
-
- // Make room for clear icon
- QMargins margins = m_editor->textMargins();
- if (layoutDirection() == Qt::LeftToRight)
- margins.setRight(size.width());
- else
- margins.setLeft(size.width());
-
- m_editor->setTextMargins(margins);
-
- QHBoxLayout *l = new QHBoxLayout(this);
- l->setMargin(0);
- l->setSpacing(0);
- if (lm == LayoutAlignRight)
- l->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
-
- l->addWidget(m_editor);
-
- // KDE has custom icons for this. Notice that icon namings are counter intuitive
- // If these icons are not available we use the freedesktop standard name before
- // falling back to a bundled resource
- QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
- QStringLiteral("edit-clear-locationbar-rtl") :
- QStringLiteral("edit-clear-locationbar-ltr"),
- QIcon::fromTheme(QStringLiteral("edit-clear"), createIconSet(QStringLiteral("cleartext.png"))));
-
- m_button->setIcon(icon);
- m_button->setToolTip(tr("Clear text"));
- connect(m_button, SIGNAL(clicked()), this, SLOT(reset()));
- connect(m_editor, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString)));
- connect(m_editor, SIGNAL(textEdited(QString)), this, SIGNAL(filterChanged(QString)));
-}
-
-QString FilterWidget::text() const
-{
- return m_editor->text();
-}
-
-void FilterWidget::checkButton(const QString &text)
-{
- if (m_oldText.isEmpty() || text.isEmpty())
- m_button->animateShow(!m_editor->text().isEmpty());
- m_oldText = text;
-}
-
-QIcon FilterWidget::createIconSet(const QString &name)
-{
- QStringList candidates = QStringList()
- << (QString::fromUtf8(":/icons/") + name)
-#ifdef Q_OS_MAC
- << (QString::fromUtf8(":/icons/mac/") + name);
-#else
- << (QString::fromUtf8(":/icons/win/") + name);
-#endif
-
- foreach (const QString &f, candidates) {
- if (QFile::exists(f))
- return QIcon(f);
- }
-
- return QIcon();
-}
-
-void FilterWidget::reset()
-{
- if (!m_editor->text().isEmpty()) {
- // Editor has lost focus once this is pressed
- m_editor->clear();
- emit filterChanged(QString());
- }
-}
-
-void FilterWidget::resizeEvent(QResizeEvent *)
-{
- QRect contentRect = m_editor->rect();
- if (layoutDirection() == Qt::LeftToRight) {
- const int iconoffset = m_editor->textMargins().right() + 4;
- m_button->setGeometry(contentRect.adjusted(m_editor->width() - iconoffset, 0, 0, 0));
- } else {
- const int iconoffset = m_editor->textMargins().left() + 4;
- m_button->setGeometry(contentRect.adjusted(0, 0, -m_editor->width() + iconoffset, 0));
- }
-}
-
-bool FilterWidget::refuseFocus() const
-{
- return m_editor->refuseFocus();
-}
-
-void FilterWidget::setRefuseFocus(bool v)
-{
- m_editor->setRefuseFocus(v);
-}
-
-#include "moc_filterwidget_p.cpp"
-
-QT_END_NAMESPACE
diff --git a/src/wrappedobjectswidgets/internal/filterwidget_p.h b/src/wrappedobjectswidgets/internal/filterwidget_p.h
deleted file mode 100644
index b34921c6..00000000
--- a/src/wrappedobjectswidgets/internal/filterwidget_p.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef FILTERWIDGET_P_H
-#define FILTERWIDGET_P_H
-
-#include "../qtwrappedobjectswidgetsglobal.h"
-
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QToolButton>
-
-#define ICONBUTTON_SIZE 16
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT HintLineEdit : public QLineEdit
-{
- Q_OBJECT
-
-public:
- explicit HintLineEdit(QWidget *parent = 0);
-
- bool refuseFocus() const;
- void setRefuseFocus(bool v);
-
-protected:
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void focusInEvent(QFocusEvent *e);
-
-private:
- const Qt::FocusPolicy m_defaultFocusPolicy;
- bool m_refuseFocus;
-};
-
-// IconButton: This is a simple helper class that represents clickable icons
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT IconButton: public QToolButton
-{
- Q_OBJECT
- Q_PROPERTY(float fader READ fader WRITE setFader)
-
-public:
- IconButton(QWidget *parent);
- void paintEvent(QPaintEvent *event);
- float fader() { return m_fader; }
- void setFader(float value) { m_fader = value; update(); }
- void animateShow(bool visible);
-
-private:
- float m_fader;
-};
-
-// FilterWidget: For filtering item views, with reset button Uses HintLineEdit.
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT FilterWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- enum LayoutMode {
- // For use in toolbars: Expand to the right
- LayoutAlignRight,
- // No special alignment
- LayoutAlignNone
- };
-
- explicit FilterWidget(QWidget *parent = 0, LayoutMode lm = LayoutAlignNone);
-
- QString text() const;
- void resizeEvent(QResizeEvent *);
- bool refuseFocus() const; // see HintLineEdit
- void setRefuseFocus(bool v);
-
-Q_SIGNALS:
- void filterChanged(const QString &);
-
-public Q_SLOTS:
- void reset();
-
-private Q_SLOTS:
- void checkButton(const QString &text);
-
-private:
- QIcon createIconSet(const QString &name);
-
- HintLineEdit *m_editor;
- IconButton *m_button;
- int m_buttonwidth;
- QString m_oldText;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // FILTERWIDGET_P_H
-
diff --git a/src/wrappedobjectswidgets/internal/propertyeditor.cpp b/src/wrappedobjectswidgets/internal/propertyeditor.cpp
deleted file mode 100644
index f4282d4c..00000000
--- a/src/wrappedobjectswidgets/internal/propertyeditor.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "propertyeditor_p.h"
-
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QToolButton>
-#include <QtWidgets/QComboBox>
-#include <QtWidgets/QCheckBox>
-
-#include <QtWrappedObjects/QMetaPropertyInfo>
-#include <QtWrappedObjects/QWrappedObject>
-
-QT_BEGIN_NAMESPACE
-
-PropertyEditor::PropertyEditor(QWidget *widget, QMetaPropertyInfo *metaPropertyInfo, QWidget *parent) :
- QWidget(parent), _widget(widget), _metaPropertyInfo(metaPropertyInfo)
-{
- QHBoxLayout *layout = new QHBoxLayout;
- layout->setMargin(0);
- layout->setSpacing(0);
- layout->addWidget(_widget);
- if (widget && _metaPropertyInfo->metaProperty.isResettable()) {
- QToolButton *toolButton = new QToolButton;
- toolButton->setIcon(QPixmap(QString::fromLatin1(":/icons/resetproperty.png")));
- toolButton->setMaximumSize(22, 22);
- toolButton->setEnabled(_metaPropertyInfo->propertyWrappedObject->isPropertyModified(_metaPropertyInfo->metaProperty));
- connect(toolButton, &QToolButton::clicked, this, &PropertyEditor::resetClicked);
- layout->addWidget(toolButton);
- }
- setLayout(layout);
-
- if (QComboBox *comboBox = qobject_cast<QComboBox *>(_widget))
- connect(comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &PropertyEditor::currentIndexChanged);
- if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(_widget))
- connect(checkBox, &QCheckBox::stateChanged, this, &PropertyEditor::currentIndexChanged);
-}
-
-int PropertyEditor::value() const
-{
- if (QComboBox *comboBox = qobject_cast<QComboBox *>(_widget))
- return comboBox->currentIndex();
- if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(_widget))
- return checkBox->isChecked() ? 1:0;
- return -1;
-}
-
-QWidget *PropertyEditor::widget() const
-{
- return _widget;
-}
-
-void PropertyEditor::setValue(int value)
-{
- if (QComboBox *comboBox = qobject_cast<QComboBox *>(_widget)) {
- if (comboBox->currentIndex() != value) {
- comboBox->setCurrentIndex(value);
- emit commitData(this);
- }
- }
- if (QCheckBox *checkBox = qobject_cast<QCheckBox *>(_widget)) {
- if (checkBox->isChecked() != (value == 0 ? false:true)) {
- checkBox->setChecked(value == 0 ? false:true);
- emit commitData(this);
- }
- }
-}
-
-void PropertyEditor::resetClicked()
-{
- _metaPropertyInfo->metaProperty.reset(_metaPropertyInfo->propertyWrappedObject);
- emit closeEditor(this);
-}
-
-void PropertyEditor::currentIndexChanged()
-{
- emit commitData(this);
-}
-
-#include "moc_propertyeditor_p.cpp"
-
-QT_END_NAMESPACE
diff --git a/src/wrappedobjectswidgets/internal/propertyeditor_p.h b/src/wrappedobjectswidgets/internal/propertyeditor_p.h
deleted file mode 100644
index 2f61c754..00000000
--- a/src/wrappedobjectswidgets/internal/propertyeditor_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef PROPERTYEDITOR_H
-#define PROPERTYEDITOR_H
-
-#include "../qtwrappedobjectswidgetsglobal.h"
-
-#include <QtWidgets/QAbstractItemDelegate>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-struct QMetaPropertyInfo;
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT PropertyEditor : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY(int value READ value WRITE setValue USER true)
-
-public:
- explicit PropertyEditor(QWidget *widget, QMetaPropertyInfo *metaPropertyInfo, QWidget *parent = 0);
-
- int value() const;
- QWidget *widget() const;
-
-public Q_SLOTS:
- void setValue(int value);
-
-Q_SIGNALS:
- void commitData(QWidget *editor);
- void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint = QAbstractItemDelegate::NoHint);
-
-private Q_SLOTS:
- void resetClicked();
- void currentIndexChanged();
-
-private:
- QWidget *_widget;
- QMetaPropertyInfo *_metaPropertyInfo;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // PROPERTYEDITOR_H
-
diff --git a/src/wrappedobjectswidgets/internal/propertyeditoritemdelegate.cpp b/src/wrappedobjectswidgets/internal/propertyeditoritemdelegate.cpp
deleted file mode 100644
index e0fc9e04..00000000
--- a/src/wrappedobjectswidgets/internal/propertyeditoritemdelegate.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "propertyeditoritemdelegate_p.h"
-
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QComboBox>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QTreeView>
-
-#include <QtWrappedObjects/QWrappedObject>
-#include <QtWrappedObjects/QMetaPropertyInfo>
-
-#include <QtWrappedObjectsWidgets/QWrappedObjectModel>
-#include <QtWrappedObjectsWidgets/QWrappedObjectPropertyModel>
-#include <QtWrappedObjectsWidgets/QWrappedObjectPropertyEditor>
-
-#include "propertyeditor_p.h"
-
-QT_BEGIN_NAMESPACE
-
-PropertyEditorItemDelegate::PropertyEditorItemDelegate(QObject *parent) :
- QStyledItemDelegate(parent)
-{
-}
-
-QWidget *PropertyEditorItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
- if (QMetaPropertyInfo *metaPropertyInfo = qvariant_cast<QMetaPropertyInfo *>(index.data(Qt::UserRole))) {
- QMetaProperty metaProperty = metaPropertyInfo->metaProperty;
-
- if (metaProperty.type() == QVariant::Bool || metaProperty.isEnumType() || QString::fromLatin1(metaProperty.typeName()).endsWith('*')) {
- QWidget *widget = 0;
- QWrappedObject *rootObject = qTopLevelWrapper(metaPropertyInfo->propertyWrappedObject);
- while (rootObject->parent())
- rootObject = qTopLevelWrapper(qobject_cast<QWrappedObject *>(rootObject->parent()));
- if (metaProperty.type() == QVariant::Bool) {
- widget = new QCheckBox;
- }
- else if (metaProperty.isEnumType()) {
- QComboBox *comboBox = new QComboBox(parent);
- QMetaEnum metaEnum = metaProperty.enumerator();
- int keyCount = metaEnum.keyCount();
- for (int j = 0; j < keyCount; ++j)
- comboBox->addItem(QString::fromLatin1((metaEnum.key(j))).toLower().remove(QString::fromLatin1((metaProperty.name()))));
- comboBox->setMaximumHeight(22);
- widget = comboBox;
- }
- else if (QString::fromLatin1(metaProperty.typeName()).endsWith('*')) {
- if (rootObject->role() != QWrappedObject::ModelElementRole)
- return 0;
- QComboBox *comboBox = new QComboBox(parent);
- QTreeView *view = qobject_cast<QTreeView *>(this->parent());
- QWrappedObjectPropertyEditor *editor = qobject_cast<QWrappedObjectPropertyEditor *>(view->parent());
- QWrappedObjectPropertyModel *propertyModel = editor->model();
- QWrappedObjectModel *wrappedObjectModel = qobject_cast<QWrappedObjectModel *>((qobject_cast<QObject *>(propertyModel))->parent());
- foreach (QWrappedObject *wrappedObject, wrappedObjectModel->wrappedObjects()) {
- if (wrappedObject->role() != QWrappedObject::AppliedProfileRole) {
- QString typeName = QString::fromLatin1(metaProperty.typeName());
- typeName.chop(1);
- populateTypeCombo(comboBox, wrappedObject, typeName);
- }
- }
- comboBox->setMaximumHeight(22);
- widget = comboBox;
- }
- PropertyEditor *propertyEditor = new PropertyEditor(widget, metaPropertyInfo, parent);
- connect(propertyEditor, &PropertyEditor::commitData, this, &PropertyEditorItemDelegate::commitData);
- connect(propertyEditor, &PropertyEditor::closeEditor, this, &PropertyEditorItemDelegate::closeEditor);
- return propertyEditor;
- }
- else if (metaProperty.type() == QVariant::String)
- return QStyledItemDelegate::createEditor(parent, option, index);
- else return 0;
- }
- return QStyledItemDelegate::createEditor(parent, option, index);
-}
-
-void PropertyEditorItemDelegate::populateTypeCombo(QComboBox *comboBox, QWrappedObject *wrappedObject, QString className) const
-{
- const QMetaObject *metaObject = wrappedObject->metaObject();
- while (metaObject) {
- if (QString::fromLatin1(metaObject->className()) == className) {
- int numberOfItens = comboBox->count();
- int i;
- for (i = 0; i < numberOfItens; ++i)
- if (comboBox->itemText(i) == qTopLevelWrapper(wrappedObject)->objectName())
- break;
- if (i != numberOfItens)
- break;
- comboBox->addItem(qTopLevelWrapper(wrappedObject)->objectName(), QVariant::fromValue(wrappedObject));
- break;
- }
- metaObject = metaObject->superClass();
- }
- foreach (QWrappedObject *wrappedWrappedObject, wrappedObject->wrappedObjects())
- populateTypeCombo(comboBox, wrappedWrappedObject, className);
- foreach (QObject *object, wrappedObject->children()) {
- QWrappedObject *childWrappedObject = qobject_cast<QWrappedObject *>(object);
- populateTypeCombo(comboBox, childWrappedObject, className);
- }
-}
-
-void PropertyEditorItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
-{
- if (QMetaPropertyInfo *metaPropertyInfo = qvariant_cast<QMetaPropertyInfo *>(index.data(Qt::UserRole))) {
- QMetaProperty metaProperty = metaPropertyInfo->metaProperty;
- PropertyEditor *propertyEditor = qobject_cast<PropertyEditor *>(editor);
- if (metaProperty.type() == QVariant::Bool)
- propertyEditor->setValue(metaProperty.read(metaPropertyInfo->propertyWrappedObject).toBool() == true ? 1:0);
- else if (metaProperty.isEnumType())
- propertyEditor->setValue(metaProperty.read(metaPropertyInfo->propertyWrappedObject).toInt());
- else if (QString::fromLatin1(metaProperty.typeName()).endsWith('*')) {
- QComboBox *comboBox = qobject_cast<QComboBox *>(propertyEditor->widget());
- QObject *propertyValue = metaProperty.read(metaPropertyInfo->propertyWrappedObject).value<QObject *>();
- if (comboBox && propertyValue) {
- int numberOfItens = comboBox->count();
- for (int i = 0; i < numberOfItens; ++i) {
- if (comboBox->itemText(i) == propertyValue->objectName()) {
- comboBox->setCurrentIndex(i);
- break;
- }
- }
- }
- }
- else
- QStyledItemDelegate::setEditorData(editor, index);
- }
- else
- QStyledItemDelegate::setEditorData(editor, index);
-}
-
-void PropertyEditorItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
- if (index.column() == 1 && index.isValid()) {
- QVariant variant = index.data(Qt::DisplayRole);
- if (variant.isValid() && variant.type() == QVariant::Bool) {
- bool checked = variant.toBool();
- QStyleOptionButton opt;
- opt.state = QStyle::State_Enabled;
- opt.state |= (checked) ? QStyle::State_On:QStyle::State_Off;
- opt.direction = QApplication::layoutDirection();
- opt.rect = option.rect;
- QApplication::style()->drawControl(QStyle::CE_CheckBox, &opt, painter);
- }
- else
- QStyledItemDelegate::paint(painter, option, index);
- }
- else
- QStyledItemDelegate::paint(painter, option, index);
-}
-
-void PropertyEditorItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
-{
- if (QMetaPropertyInfo *metaPropertyInfo = qvariant_cast<QMetaPropertyInfo *>(index.data(Qt::UserRole))) {
- QMetaProperty metaProperty = metaPropertyInfo->metaProperty;
- if (metaProperty.type() == QVariant::Bool || metaProperty.isEnumType()) {
- PropertyEditor *propertyEditor = qobject_cast<PropertyEditor *>(editor);
- model->setData(index, propertyEditor->value(), Qt::DisplayRole);
- }
- else if (metaProperty.type() == QVariant::String) {
- QLineEdit *lineEdit = qobject_cast<QLineEdit *>(editor);
- model->setData(index, lineEdit->text(), Qt::DisplayRole);
- }
- else if (QString::fromLatin1(metaProperty.typeName()).endsWith('*')) {
- PropertyEditor *propertyEditor = qobject_cast<PropertyEditor *>(editor);
- QComboBox *comboBox = qobject_cast<QComboBox *>(propertyEditor->widget());
- model->setData(index, comboBox->itemData(comboBox->currentIndex(), Qt::UserRole), Qt::DisplayRole);
- }
- else
- QStyledItemDelegate::setModelData(editor, model, index);
- }
- else
- QStyledItemDelegate::setModelData(editor, model, index);
-}
-
-bool PropertyEditorItemDelegate::eventFilter(QObject *object, QEvent *event)
-{
- if (event->type() == QEvent::FocusOut)
- return false;
- else
- return QStyledItemDelegate::eventFilter(object, event);
-}
-
-#include "moc_propertyeditoritemdelegate_p.cpp"
-
-QT_END_NAMESPACE
diff --git a/src/wrappedobjectswidgets/internal/propertyeditoritemdelegate_p.h b/src/wrappedobjectswidgets/internal/propertyeditoritemdelegate_p.h
deleted file mode 100644
index 13de33f6..00000000
--- a/src/wrappedobjectswidgets/internal/propertyeditoritemdelegate_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef PROPERTYEDITORITEMDELEGATE_P_H
-#define PROPERTYEDITORITEMDELEGATE_P_H
-
-#include "../qtwrappedobjectswidgetsglobal.h"
-
-#include <QtWidgets/QStyledItemDelegate>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QComboBox;
-class QWrappedObject;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT PropertyEditorItemDelegate : public QStyledItemDelegate
-{
- Q_OBJECT
-
-public:
- explicit PropertyEditorItemDelegate(QObject *parent = 0);
-
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
- bool eventFilter(QObject *object, QEvent *event);
-
-private:
- void populateTypeCombo(QComboBox *comboBox, QWrappedObject *wrappedObject, QString className) const;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // PROPERTYEDITORITEMDELEGATE_P_H
-
diff --git a/src/wrappedobjectswidgets/qtwrappedobjectswidgetsglobal.h b/src/wrappedobjectswidgets/qtwrappedobjectswidgetsglobal.h
deleted file mode 100644
index d588e3a2..00000000
--- a/src/wrappedobjectswidgets/qtwrappedobjectswidgetsglobal.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTSWIDGETSGLOBAL_H
-#define QTWRAPPEDOBJECTSWIDGETSGLOBAL_H
-
-#include <QtCore/QtGlobal>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_WRAPPEDOBJECTSWIDGETS_LIB)
-# define Q_WRAPPEDOBJECTSWIDGETS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_WRAPPEDOBJECTSWIDGETS_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_WRAPPEDOBJECTSWIDGETS_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QTWRAPPEDOBJECTSWIDGETSGLOBAL_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectmodel.cpp b/src/wrappedobjectswidgets/qwrappedobjectmodel.cpp
deleted file mode 100644
index 8c4a9a76..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectmodel.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwrappedobjectmodel.h"
-#include "qwrappedobjectmodel_p.h"
-
-#include <QtGui/QFont>
-#include <QtWidgets/QApplication>
-
-#include <QtWrappedObjects/QWrappedObject>
-
-QT_BEGIN_NAMESPACE
-
-QWrappedObjectModelPrivate::QWrappedObjectModelPrivate()
-{
-}
-
-QWrappedObjectModel::QWrappedObjectModel(QObject *parent) :
- QAbstractItemModel(*new QWrappedObjectModelPrivate, parent)
-{
-}
-
-void QWrappedObjectModel::addWrappedObject(QWrappedObject *wrappedObject)
-{
- Q_D(QWrappedObjectModel);
-
- if (wrappedObject && !d->wrappedObjects.contains(wrappedObject)) {
- beginResetModel();
- d->wrappedObjects.append(wrappedObject);
- endResetModel();
- }
-}
-
-QList<QWrappedObject *> QWrappedObjectModel::wrappedObjects() const
-{
- Q_D(const QWrappedObjectModel);
-
- return d->wrappedObjects;
-}
-
-QModelIndex QWrappedObjectModel::index(int row, int column, const QModelIndex &parent) const
-{
- Q_D(const QWrappedObjectModel);
-
- if (d->wrappedObjects.isEmpty() || row < 0 || column < 0 || column >= 2 || (parent.isValid() && parent.column() != 0))
- return QModelIndex();
-
- if (!parent.isValid())
- return createIndex(row, column, static_cast<void *>(qTopLevelWrapper(d->wrappedObjects.at(row))));
-
- QWrappedObject *wrappedObject = static_cast<QWrappedObject *>(parent.internalPointer());
- if (!wrappedObject)
- return QModelIndex();
-
- return createIndex(row, column, static_cast<void *>(wrappedObject->children().at(row)));
-}
-
-QModelIndex QWrappedObjectModel::parent(const QModelIndex &child) const
-{
- Q_D(const QWrappedObjectModel);
-
- QWrappedObject *wrappedObject = static_cast<QWrappedObject *>(child.internalPointer());
- if (d->wrappedObjects.isEmpty() || !child.isValid() || !wrappedObject)
- return QModelIndex();
-
- QWrappedObject *parentWrappedObject = qTopLevelWrapper(dynamic_cast<QWrappedObject *>(wrappedObject->parent()));
- if (!parentWrappedObject)
- return QModelIndex();
-
- QWrappedObject *grandParentWrappedObject = qTopLevelWrapper(dynamic_cast<QWrappedObject *>(parentWrappedObject->parent()));
- if (!grandParentWrappedObject)
- return createIndex(0, 0, parentWrappedObject);
-
- return createIndex(grandParentWrappedObject->children().indexOf(parentWrappedObject), 0, static_cast<void *>(parentWrappedObject));
-}
-
-int QWrappedObjectModel::rowCount(const QModelIndex &parent) const
-{
- Q_D(const QWrappedObjectModel);
-
- if (d->wrappedObjects.isEmpty() || (parent.isValid() && parent.column() != 0))
- return 0;
-
- if (parent.row() == -1)
- return d->wrappedObjects.count();
-
- QWrappedObject *wrappedObject = qTopLevelWrapper(static_cast<QWrappedObject *>(parent.internalPointer()));
- if (!wrappedObject)
- return 0;
-
- return wrappedObject->children().size();
-}
-
-int QWrappedObjectModel::columnCount(const QModelIndex &parent) const
-{
- Q_D(const QWrappedObjectModel);
-
- return (d->wrappedObjects.isEmpty() || (parent.isValid() && parent.column() != 0)) ? 0:2;
-}
-
-QVariant QWrappedObjectModel::data(const QModelIndex &index, int role) const
-{
- Q_D(const QWrappedObjectModel);
-
- if (d->wrappedObjects.isEmpty() || index.column() < 0 || index.column() >= 2)
- return QVariant();
- switch (role) {
- case Qt::DisplayRole:
- case Qt::EditRole: {
- QWrappedObject *wrappedObject = static_cast<QWrappedObject *>(index.internalPointer());
- QString elementRole = QString::fromLatin1("");
- if (wrappedObject->role() == QWrappedObject::ImportedElementRole)
- elementRole = QString::fromLatin1(" (imported element)");
- else if (wrappedObject->role() == QWrappedObject::ImportedPackageRole)
- elementRole = QString::fromLatin1(" (imported package)");
- else if (wrappedObject->role() == QWrappedObject::AppliedProfileRole)
- elementRole = QString::fromLatin1(" (applied profile)");
- return index.column() == 0 ? qTopLevelWrapper(wrappedObject)->objectName()+elementRole:QString::fromLatin1(qTopLevelWrapper(wrappedObject)->metaObject()->className());
- }
- case Qt::FontRole: {
- QFont font = QApplication::font();
- QWrappedObject *wrappedObject = static_cast<QWrappedObject *>(index.internalPointer());
- if (index.parent().row() == -1 && wrappedObject->role() == QWrappedObject::ModelElementRole)
- font.setBold(true);
- return font;
- }
- case Qt::UserRole: {
- return qVariantFromValue(static_cast<QWrappedObject *>(index.internalPointer()));
- }
- }
- return QVariant();
-}
-
-bool QWrappedObjectModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- return QAbstractItemModel::setData(index, value, role);
-}
-
-QVariant QWrappedObjectModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if ((section == 0 || section == 1) && orientation == Qt::Horizontal && role == Qt::DisplayRole)
- return QString::fromLatin1(section == 0 ? "Object":"Class");
- return QVariant();
-}
-
-Qt::ItemFlags QWrappedObjectModel::flags(const QModelIndex &index) const
-{
- return QAbstractItemModel::flags(index);
-}
-
-void QWrappedObjectModel::updateIndex(const QModelIndex &index)
-{
- if (!index.isValid()) {
- beginResetModel();
- //emit layoutChanged();
- endResetModel();
- }
- else
- emit dataChanged(index, index, QVector<int>() << Qt::DisplayRole);
-}
-
-void QWrappedObjectModel::clear()
-{
- Q_D(QWrappedObjectModel);
-
- foreach (QWrappedObject *object, d->wrappedObjects)
- delete object;
- d->wrappedObjects.clear();
-}
-
-#include "moc_qwrappedobjectmodel.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectmodel.h b/src/wrappedobjectswidgets/qwrappedobjectmodel.h
deleted file mode 100644
index 21b55f31..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectmodel.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTMODEL_H
-#define QWRAPPEDOBJECTMODEL_H
-
-#include <QtWrappedObjectsWidgets/QtWrappedObjectsWidgetsGlobal>
-
-#include <QtCore/QAbstractItemModel>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QWrappedObject;
-
-class QWrappedObjectModelPrivate;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectModel : public QAbstractItemModel
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QWrappedObjectModel)
- Q_DECLARE_PRIVATE(QWrappedObjectModel)
-
-public:
- explicit QWrappedObjectModel(QObject *parent = 0);
-
- QList<QWrappedObject *> wrappedObjects() const;
-
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
-
-public Q_SLOTS:
- void addWrappedObject(QWrappedObject *wrappedObjects);
- void updateIndex(const QModelIndex &index);
- void clear();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTMODEL_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectmodel_p.h b/src/wrappedobjectswidgets/qwrappedobjectmodel_p.h
deleted file mode 100644
index cc7a318e..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectmodel_p.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTMODEL_P_H
-#define QWRAPPEDOBJECTMODEL_P_H
-
-#include "qtwrappedobjectswidgetsglobal.h"
-#include "private/qabstractitemmodel_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectModelPrivate : public QAbstractItemModelPrivate
-{
- Q_DECLARE_PUBLIC(QWrappedObjectModel)
-
-public:
- explicit QWrappedObjectModelPrivate();
-
- QList<QWrappedObject *> wrappedObjects;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTMODEL_P_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.cpp b/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.cpp
deleted file mode 100644
index 28ccaa6c..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwrappedobjectpropertyeditor.h"
-#include "qwrappedobjectpropertyeditor_p.h"
-#include "qwrappedobjectpropertymodel.h"
-#include "qwrappedobjectpropertyfiltermodel.h"
-#include "internal/filterwidget_p.h"
-#include "internal/propertyeditoritemdelegate_p.h"
-
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QTreeView>
-
-QT_BEGIN_NAMESPACE
-
-QWrappedObjectPropertyEditorPrivate::QWrappedObjectPropertyEditorPrivate() :
- label(new QLabel),
- treeView(new QTreeView),
- filter(new FilterWidget),
- proxyModel(new QWrappedObjectPropertyFilterModel(q_func())),
- propertyModel(0)
-{
-}
-
-QWrappedObjectPropertyEditor::QWrappedObjectPropertyEditor(QWidget *parent, Qt::WindowFlags f) :
- QWidget(*new QWrappedObjectPropertyEditorPrivate, parent, f)
-{
- Q_D(QWrappedObjectPropertyEditor);
-
- d->treeView->setMinimumSize(QSize(350, 0));
- d->treeView->setEditTriggers(QAbstractItemView::AllEditTriggers);
- d->treeView->setAlternatingRowColors(true);
- QPalette propertyPallete = d->treeView->palette();
- propertyPallete.setColor(QPalette::Active, QPalette::Base, QColor(255, 242, 222));
- propertyPallete.setColor(QPalette::Inactive, QPalette::Base, QColor(255, 242, 222));
- propertyPallete.setColor(QPalette::Active, QPalette::AlternateBase, QColor(255, 255, 191));
- propertyPallete.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(255, 255, 191));
- d->treeView->setPalette(propertyPallete);
- d->treeView->setUniformRowHeights(true);
- d->treeView->setItemDelegateForColumn(1, new PropertyEditorItemDelegate(d->treeView));
- d->treeView->setModel(d->proxyModel);
-
- d->proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setSpacing(2);
- layout->setContentsMargins(0, 0, 0, 0);
- layout->addWidget(d->filter);
- layout->addWidget(d->label);
- layout->addWidget(d->treeView);
-
- connect(d->filter, &FilterWidget::filterChanged,
- d->proxyModel, static_cast<void (QSortFilterProxyModel::*)(const QString &)>(&QSortFilterProxyModel::setFilterRegExp));
- connect(d->filter, &FilterWidget::filterChanged, this, &QWrappedObjectPropertyEditor::filterChanged);
-}
-
-void QWrappedObjectPropertyEditor::setModel(QWrappedObjectPropertyModel *propertyModel)
-{
- Q_D(QWrappedObjectPropertyEditor);
-
- if (d->propertyModel)
- disconnect(d->propertyModel, 0, this, 0);
- d->propertyModel = propertyModel;
- d->proxyModel->setSourceModel(d->propertyModel);
- if (propertyModel) {
- connect(propertyModel, &QAbstractItemModel::modelReset, this, &QWrappedObjectPropertyEditor::modelReset);
- }
-}
-
-QWrappedObjectPropertyModel *QWrappedObjectPropertyEditor::model() const
-{
- Q_D(const QWrappedObjectPropertyEditor);
-
- return d->propertyModel;
-}
-
-void QWrappedObjectPropertyEditor::filterChanged()
-{
- Q_D(QWrappedObjectPropertyEditor);
-
- d->treeView->expandAll();
- d->treeView->resizeColumnToContents(0);
- d->treeView->resizeColumnToContents(1);
-}
-
-void QWrappedObjectPropertyEditor::modelReset()
-{
- Q_D(QWrappedObjectPropertyEditor);
-
- d->label->setText(QString::fromLatin1("%1: %2").arg(d->propertyModel->wrappedObject()->objectName()).arg(QString::fromLatin1(d->propertyModel->wrappedObject()->metaObject()->className())));
- d->treeView->expandAll();
- d->treeView->resizeColumnToContents(0);
- d->treeView->resizeColumnToContents(1);
-}
-
-#include "moc_qwrappedobjectpropertyeditor.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.h b/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.h
deleted file mode 100644
index ed347a79..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTPROPERTYEDITOR_H
-#define QWRAPPEDOBJECTPROPERTYEDITOR_H
-
-#include <QtWrappedObjectsWidgets/QtWrappedObjectsWidgetsGlobal>
-
-#include <QtWidgets/QWidget>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QWrappedObjectPropertyModel;
-
-class QWrappedObjectPropertyEditorPrivate;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectPropertyEditor : public QWidget
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QWrappedObjectPropertyEditor)
- Q_DECLARE_PRIVATE(QWrappedObjectPropertyEditor)
-
-public:
- explicit QWrappedObjectPropertyEditor(QWidget *parent = 0, Qt::WindowFlags f = 0);
-
- QWrappedObjectPropertyModel *model() const;
-
-public Q_SLOTS:
- void setModel(QWrappedObjectPropertyModel *model);
-
-private Q_SLOTS:
- void filterChanged();
- void modelReset();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTPROPERTYEDITOR_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor_p.h b/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor_p.h
deleted file mode 100644
index b50de69b..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertyeditor_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTPROPERTYEDITOR_P_H
-#define QWRAPPEDOBJECTPROPERTYEDITOR_P_H
-
-#include "qtwrappedobjectswidgetsglobal.h"
-#include "private/qwidget_p.h"
-
-#include <QtWrappedObjects/QWrappedObject>
-
-#include <QtWidgets/QHBoxLayout>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QLabel;
-class QTreeView;
-
-class QWrappedObjectPropertyModel;
-class QWrappedObjectPropertyFilterModel;
-class FilterWidget;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectPropertyEditorPrivate : public QWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QWrappedObjectPropertyEditor)
-
-public:
- explicit QWrappedObjectPropertyEditorPrivate();
-
- QLabel *label;
- QTreeView *treeView;
- FilterWidget *filter;
- QWrappedObjectPropertyFilterModel *proxyModel;
- QWrappedObjectPropertyModel *propertyModel;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTPROPERTYEDITOR_P_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.cpp b/src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.cpp
deleted file mode 100644
index 6a213b76..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwrappedobjectpropertyfiltermodel.h"
-
-QT_BEGIN_NAMESPACE
-
-QWrappedObjectPropertyFilterModel::QWrappedObjectPropertyFilterModel(QObject *parent) :
- QSortFilterProxyModel(parent)
-{
-}
-
-bool QWrappedObjectPropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
-{
- int rows;
- QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent);
- if ((rows = sourceModel()->rowCount(sourceIndex)) > 0) {
- for (int i = 0; i < rows; ++i)
- if (filterAcceptsRow(i, sourceIndex))
- return true;
- return false;
- }
- else {
- return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
- }
-}
-
-#include "moc_qwrappedobjectpropertyfiltermodel.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.h b/src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.h
deleted file mode 100644
index b9815d91..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertyfiltermodel.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTPROPERTYFILTERMODEL_H
-#define QWRAPPEDOBJECTPROPERTYFILTERMODEL_H
-
-#include <QtWrappedObjectsWidgets/QtWrappedObjectsWidgetsGlobal>
-
-#include <QtCore/QSortFilterProxyModel>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectPropertyFilterModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-public:
- explicit QWrappedObjectPropertyFilterModel(QObject *parent = 0);
-
-protected:
- bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTPROPERTYFILTERMODEL_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertymodel.cpp b/src/wrappedobjectswidgets/qwrappedobjectpropertymodel.cpp
deleted file mode 100644
index 95ddd1f6..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertymodel.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwrappedobjectpropertymodel.h"
-#include "qwrappedobjectpropertymodel_p.h"
-
-#include <QtWrappedObjects/QWrappedObject>
-#include <QtWrappedObjects/QMetaPropertyInfo>
-
-#include <QtGui/QFontMetrics>
-
-#include <QtCore/QRegularExpression>
-
-QT_BEGIN_NAMESPACE
-
-QWrappedObjectPropertyModelPrivate::QWrappedObjectPropertyModelPrivate() :
- wrappedObject(0), metaWrappedObject(0)
-{
-}
-
-QWrappedObjectPropertyModel::QWrappedObjectPropertyModel(QObject *parent) :
- QAbstractItemModel(*new QWrappedObjectPropertyModelPrivate, parent)
-{
-}
-
-void QWrappedObjectPropertyModel::setWrappedObject(QWrappedObject *wrappedObject, QModelIndex index)
-{
- Q_D(QWrappedObjectPropertyModel);
-
- if (wrappedObject && d->metaWrappedObject != wrappedObject->metaWrappedObject()) {
- beginResetModel();
- d->wrappedObject = wrappedObject;
- d->metaWrappedObject = d->wrappedObject->metaWrappedObject();
- d->wrappedObjectIndex = index;
- endResetModel();
- }
-}
-
-QModelIndex QWrappedObjectPropertyModel::index(int row, int column, const QModelIndex &parent) const
-{
- Q_D(const QWrappedObjectPropertyModel);
-
- if (!d->metaWrappedObject || row < 0 || column < 0 || column >= 2 || (parent.isValid() && parent.column() != 0))
- return QModelIndex();
- return createIndex(row, column, (parent.isValid()) ? static_cast<void *>(&d->metaWrappedObject->property(parent.row(), row)):0);
-}
-
-QModelIndex QWrappedObjectPropertyModel::parent(const QModelIndex &child) const
-{
- Q_D(const QWrappedObjectPropertyModel);
-
- QMetaPropertyInfo *metaPropertyInfo = static_cast<QMetaPropertyInfo *>(child.internalPointer());
- if (!d->metaWrappedObject || !child.isValid() || !metaPropertyInfo)
- return QModelIndex();
- return createIndex(d->metaWrappedObject->indexOfGroup(metaPropertyInfo->propertyMetaObject->className()), 0);
-}
-
-int QWrappedObjectPropertyModel::rowCount(const QModelIndex &parent) const
-{
- Q_D(const QWrappedObjectPropertyModel);
-
- if (!d->metaWrappedObject || (parent.isValid() && parent.column() != 0))
- return 0;
- return (parent.row() == -1) ? d->metaWrappedObject->propertyGroupCount():
- (!parent.internalPointer()) ? d->metaWrappedObject->propertyCount(parent.row()):0;
-}
-
-int QWrappedObjectPropertyModel::columnCount(const QModelIndex &parent) const
-{
- Q_D(const QWrappedObjectPropertyModel);
-
- return (!d->metaWrappedObject || (parent.isValid() && parent.column() != 0)) ? 0:2;
-}
-
-QVariant QWrappedObjectPropertyModel::data(const QModelIndex &index, int role) const
-{
- Q_D(const QWrappedObjectPropertyModel);
-
- if (!d->metaWrappedObject || d->metaWrappedObject->propertyCount() == 0 || index.column() < 0 || index.column() >= 2)
- return QVariant();
- switch (role) {
- case Qt::DisplayRole:
- case Qt::EditRole: {
- QMetaPropertyInfo *metaPropertyInfo = static_cast<QMetaPropertyInfo *>(index.internalPointer());
- switch (index.column()) {
- case 0: {
- if (metaPropertyInfo) {
- QMetaProperty metaProperty = metaPropertyInfo->metaProperty;
- QString propertyName = QString::fromLatin1(metaProperty.name()).remove(QRegularExpression(QString::fromLatin1("_$")));
- if (propertyName != propertyName.toUpper())
- propertyName = propertyName.replace(0, 1, propertyName.left(1).toLower());
- return propertyName.append(QString::fromLatin1(!metaProperty.isWritable() ? " (RO)":""));
- }
- return QString::fromLatin1(d->metaWrappedObject->property(index.row(), 0).propertyMetaObject->className());
- }
- case 1: {
- if (index.parent().row() != -1 && metaPropertyInfo) {
- QMetaProperty metaProperty = metaPropertyInfo->metaProperty;
- QWrappedObject *propertyWrappedObject = metaPropertyInfo->propertyWrappedObject;
- QString typeName = QString::fromLatin1(metaProperty.typeName());
- QVariant variant = metaProperty.read(propertyWrappedObject);
- if (metaProperty.type() == QVariant::String) {
- if (QString::fromLatin1(metaProperty.name()) == QString::fromLatin1("objectName"))
- propertyWrappedObject = qTopLevelWrapper(propertyWrappedObject);
- return metaProperty.read(propertyWrappedObject);
- }
- else if (metaProperty.type() == QVariant::Bool) {
- return variant;
- }
- else if (metaProperty.isEnumType())
- return QString::fromLatin1(metaProperty.enumerator().valueToKey(variant.toInt())).toLower().remove(QString::fromLatin1(metaProperty.name()));
- else if (typeName.endsWith('*') && qvariant_cast<QWrappedObject *>(variant)) {
- QWrappedObject *objectElement = qvariant_cast<QWrappedObject *>(variant);
- if (objectElement) {
- QString returnedValue = qTopLevelWrapper(objectElement)->objectName();
- if (!metaProperty.isStored())
- delete objectElement;
- return returnedValue;
- }
- else
- return QVariant();
- }
- else if (typeName.contains(QString::fromLatin1("QSet")) && variant.isValid()) {
- QSet<QWrappedObject *> elements = *(static_cast<QSet<QWrappedObject *> *>(variant.data()));
- QString str;
- if (elements.size() > 0) {
- str.append(QString::fromLatin1("["));
- foreach (QWrappedObject *object, elements)
- if (object)
- str.append((qTopLevelWrapper(object))->objectName().append(QString::fromLatin1(", ")));
- str.chop(2);
- str.append(QString::fromLatin1("]"));
- }
- return !str.isEmpty() ? str:QVariant();
- }
- else if (typeName.contains(QString::fromLatin1("QList")) && variant.isValid()) {
- QList<QWrappedObject *> elements = *(static_cast<QList<QWrappedObject *> *>(variant.data()));
- QString str;
- if (elements.size() > 0) {
- str.append(QString::fromLatin1("["));
- foreach (QWrappedObject *object, elements)
- str.append((qTopLevelWrapper(object))->objectName().append(QString::fromLatin1(", ")));
- str.chop(2);
- str.append(QString::fromLatin1("]"));
- }
- return !str.isEmpty() ? str:QVariant();
- }
- }
- return QVariant();
- }
- default:
- Q_ASSERT(false);
- }
- }
- case Qt::SizeHintRole: {
- QFont font;
- QFontMetrics fontMetrics(font);
- return QSize(fontMetrics.width(data(index, Qt::DisplayRole).toString()) + 10, 22);
- }
- case Qt::FontRole: {
- QFont font;
- QMetaPropertyInfo *metaPropertyInfo = static_cast<QMetaPropertyInfo *>(index.internalPointer());
- if (metaPropertyInfo && index.column() == 0 && metaPropertyInfo->metaProperty.isResettable())
- font.setBold(metaPropertyInfo->propertyWrappedObject->isPropertyModified(metaPropertyInfo->metaProperty));
- if (metaPropertyInfo && index.column() == 0)
- font.setItalic(QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::AggregationRole).toString() == QString::fromLatin1("composite"));
- return font;
- }
- case Qt::ToolTipRole: {
- QMetaPropertyInfo *metaPropertyInfo = static_cast<QMetaPropertyInfo *>(index.internalPointer());
- if (metaPropertyInfo) {
- QString toolTip = QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::DocumentationRole).toString().remove(QRegularExpression(QString::fromLatin1(".$"))).append(QString::fromLatin1("."));
- if (QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::IsDerivedUnionRole).toBool())
- toolTip += QString::fromLatin1(" This is a derived union property.");
- else if (!metaPropertyInfo->metaProperty.isStored())
- toolTip += QString::fromLatin1(" This is a derived property.");
- int i = 50;
- while (i < toolTip.length()) {
- toolTip = toolTip.replace(toolTip.lastIndexOf(QString::fromLatin1(" "), i), 1, QString::fromLatin1("\n"));
- i += 50;
- }
- if (!toolTip.isEmpty())
- toolTip += QString::fromLatin1("\n\n");
- toolTip += QString::fromLatin1("Type: %1").arg(QString::fromLatin1(metaPropertyInfo->metaProperty.typeName()));
- QVariant variant = QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::AggregationRole);
- if (variant.isValid() && variant.toString() != QString::fromLatin1("none"))
- toolTip += QString::fromLatin1("\nAggregation: %1").arg(variant.toString());
- QString redefinedProperties = QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::RedefinedPropertiesRole).toString();
- if (!redefinedProperties.isEmpty())
- toolTip += QString::fromLatin1("\nRedefines: %1").arg(redefinedProperties);
- QString subsettedProperties = QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::SubsettedPropertiesRole).toString();
- if (!subsettedProperties.isEmpty())
- toolTip += QString::fromLatin1("\nSubsets: %1").arg(subsettedProperties);
- QString oppositeEnd = QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo->propertyMetaObject->className()), metaPropertyInfo->metaProperty, QtWrappedObjects::OppositeEndRole).toString();
- if (!oppositeEnd.isEmpty())
- toolTip += QString::fromLatin1("\nOpposite end: %1").arg(oppositeEnd);
- return toolTip;
- }
- else {
- return QString::fromLatin1("");
- }
- }
- case Qt::UserRole: {
- return qVariantFromValue(static_cast<QMetaPropertyInfo *>(index.internalPointer()));
- }
- }
- return QVariant();
-}
-
-bool QWrappedObjectPropertyModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- Q_D(QWrappedObjectPropertyModel);
-
- if (!d->metaWrappedObject || d->metaWrappedObject->propertyCount() == 0 || index.column() < 0 || index.column() >= 2)
- return false;
- switch (role) {
- case Qt::DisplayRole: {
- QMetaPropertyInfo *metaPropertyInfo = static_cast<QMetaPropertyInfo *>(index.internalPointer());
- QMetaProperty metaProperty = metaPropertyInfo->metaProperty;
- QWrappedObject *propertyWrappedObject = metaPropertyInfo->propertyWrappedObject;
- if (QString::fromLatin1(metaProperty.name()) == QString::fromLatin1("objectName")) {
- propertyWrappedObject = qTopLevelWrapper(propertyWrappedObject);
- propertyWrappedObject->setProperty("name", value);
- emit indexChanged(d->wrappedObjectIndex);
- }
- if (QString::fromLatin1(metaProperty.name()) == QString::fromLatin1("name"))
- emit indexChanged(d->wrappedObjectIndex);
- if (metaProperty.read(propertyWrappedObject) != value)
- metaProperty.write(propertyWrappedObject, value);
- if (QString::fromLatin1(metaProperty.typeName()).endsWith('*'))
- emit indexChanged(QModelIndex());
- return true;
- }
- }
- return false;
-}
-
-QVariant QWrappedObjectPropertyModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if ((section == 0 || section == 1) && orientation == Qt::Horizontal && role == Qt::DisplayRole)
- return QString::fromLatin1(section == 0 ? "Property":"Value");
- return QVariant();
-}
-
-Qt::ItemFlags QWrappedObjectPropertyModel::flags(const QModelIndex &index) const
-{
- QMetaPropertyInfo *metaPropertyInfo = static_cast<QMetaPropertyInfo *>(index.internalPointer());
- if (metaPropertyInfo && metaPropertyInfo->metaProperty.isWritable() && index.column() == 1)
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
- return QAbstractItemModel::flags(index);
-}
-
-QWrappedObject *QWrappedObjectPropertyModel::wrappedObject() const
-{
- Q_D(const QWrappedObjectPropertyModel);
-
- return d->wrappedObject;
-}
-
-#include "moc_qwrappedobjectpropertymodel.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertymodel.h b/src/wrappedobjectswidgets/qwrappedobjectpropertymodel.h
deleted file mode 100644
index bdac6b8f..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertymodel.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTPROPERTYMODEL_H
-#define QWRAPPEDOBJECTPROPERTYMODEL_H
-
-#include <QtWrappedObjectsWidgets/QtWrappedObjectsWidgetsGlobal>
-
-#include <QtCore/QAbstractItemModel>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QWrappedObject;
-
-class QWrappedObjectPropertyModelPrivate;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectPropertyModel : public QAbstractItemModel
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QWrappedObjectPropertyModel)
- Q_DECLARE_PRIVATE(QWrappedObjectPropertyModel)
-
-public:
- explicit QWrappedObjectPropertyModel(QObject *parent = 0);
-
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- Qt::ItemFlags flags(const QModelIndex & index) const;
-
- QWrappedObject *wrappedObject() const;
-
-public Q_SLOTS:
- void setWrappedObject(QWrappedObject *wrappedObject, QModelIndex index);
-
-Q_SIGNALS:
- void indexChanged(const QModelIndex &wrappedObjectIndex);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTPROPERTYMODEL_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectpropertymodel_p.h b/src/wrappedobjectswidgets/qwrappedobjectpropertymodel_p.h
deleted file mode 100644
index ed4bf7f8..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectpropertymodel_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTPROPERTYMODEL_P_H
-#define QWRAPPEDOBJECTPROPERTYMODEL_P_H
-
-#include "qtwrappedobjectswidgetsglobal.h"
-#include "private/qabstractitemmodel_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QMetaWrappedObject;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectPropertyModelPrivate : public QAbstractItemModelPrivate
-{
- Q_DECLARE_PUBLIC(QWrappedObjectPropertyModel)
-
-public:
- explicit QWrappedObjectPropertyModelPrivate();
-
- QModelIndex wrappedObjectIndex;
- QWrappedObject *wrappedObject;
- const QMetaWrappedObject *metaWrappedObject;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTPROPERTYMODEL_P_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectview.cpp b/src/wrappedobjectswidgets/qwrappedobjectview.cpp
deleted file mode 100644
index 626d7d33..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectview.cpp
+++ /dev/null
@@ -1,303 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwrappedobjectview.h"
-#include "qwrappedobjectview_p.h"
-#include "qwrappedobjectmodel.h"
-
-#include <QtWrappedObjects/QWrappedObject>
-#include <QtWrappedObjects/QMetaWrappedObject>
-
-#include <QtCore/QRegularExpression>
-
-#include <QtWidgets/QMenu>
-#include <QtWidgets/QTreeView>
-#include <QtWidgets/QVBoxLayout>
-#include <QtWidgets/QMessageBox>
-
-QT_BEGIN_NAMESPACE
-
-QWrappedObjectViewPrivate::QWrappedObjectViewPrivate() :
- treeView(new QTreeView)
-{
-}
-
-void QWrappedObjectViewPrivate::populateContextMenu(QMenu &menu, QWrappedObject *element)
-{
- Q_Q(QWrappedObjectView);
-
- const QMetaWrappedObject *metaWrappedObject = element->metaWrappedObject();
- int propertyCount = metaWrappedObject->propertyCount();
- for (int i = 0; i < propertyCount; ++i) {
- QString propertyName = QString::fromLatin1(metaWrappedObject->property(i).metaProperty.name());
- QString propertyType = QString::fromLatin1(metaWrappedObject->property(i).metaProperty.typeName());
- QString modifiedPropertyName = QString(propertyName.left(1).toUpper()+propertyName.mid(1)).remove(QRegularExpression(QString::fromLatin1("s$"))).replace(QRegularExpression(QString::fromLatin1("ie$")), QString::fromLatin1("y")).replace(QRegularExpression(QString::fromLatin1("se$")), QString::fromLatin1("s")).replace(QRegularExpression(QString::fromLatin1("ice$")), QString::fromLatin1("ex")).replace(QRegularExpression(QString::fromLatin1("ce$")), QString::fromLatin1("x")).remove(QRegularExpression(QString::fromLatin1("_$")));
- QString methodSignature;
- QString actionText;
- if (propertyType.contains(QString::fromLatin1("QList")) || propertyType.contains(QString::fromLatin1("QSet")) || propertyType.endsWith(QString::fromLatin1("*"))) {
- if (propertyType.contains(QString::fromLatin1("QList")) || propertyType.contains(QString::fromLatin1("QSet"))) {
- propertyType = propertyType.remove(QString::fromLatin1("QList<")).remove(QString::fromLatin1("QSet<")).remove(QString::fromLatin1(">"));
- QString unqualifiedPropertyType = propertyType;
- methodSignature = QString::fromLatin1("add%1(%2)").arg(modifiedPropertyName).arg(unqualifiedPropertyType.remove(QRegularExpression(QString::fromLatin1("^.*::"))));
- actionText = QObject::tr("Add %1").arg(modifiedPropertyName);
- }
- else if (propertyType.endsWith(QString::fromLatin1("*"))) {
- QString unqualifiedPropertyType = propertyType;
- methodSignature = QString::fromLatin1("set%1(%2)").arg(modifiedPropertyName).arg(unqualifiedPropertyType.remove(QRegularExpression(QString::fromLatin1("^.*::"))));
- actionText = QObject::tr("Set %1").arg(modifiedPropertyName);
- }
- int metaMethodIndex;
- if ((metaMethodIndex = element->metaObject()->indexOfMethod(methodSignature.toLatin1())) != -1 && !visitedAddMethods.contains(actionText)) {
- QAction *action = new QAction(actionText, q);
- visitedAddMethods[actionText] = QPair<QObject *, QMetaMethod>(element, element->metaObject()->method(metaMethodIndex));
- action->setData(propertyType);
- QObject::connect(action, &QAction::triggered, q, &QWrappedObjectView::handleAddMethod);
- menu.addAction(action);
- }
- }
- }
- if (element->parent()) {
- menu.addSeparator();
- QAction *action = new QAction(QObject::tr("&Delete"), q);
- action->setIcon(QIcon::fromTheme(QString::fromLatin1("edit-delete")));
- QObject::connect(action, &QAction::triggered, q, &QWrappedObjectView::deleteObject);
- menu.addAction(action);
- }
- menu.addSeparator();
- QAction *action = new QAction(QObject::tr("&Add to view"), q);
- QObject::connect(action, &QAction::triggered, q, &QWrappedObjectView::addElementToView);
- menu.addAction(action);
-}
-
-QWrappedObjectView::QWrappedObjectView(QWidget *parent, Qt::WindowFlags f) :
- QWidget(*new QWrappedObjectViewPrivate, parent, f)
-{
- Q_D(QWrappedObjectView);
-
- d->treeView->setEditTriggers(QAbstractItemView::AllEditTriggers);
- d->treeView->setAlternatingRowColors(true);
- QPalette modelPallete = d->treeView->palette();
- modelPallete.setColor(QPalette::Active, QPalette::Base, QColor(255, 255, 255));
- modelPallete.setColor(QPalette::Inactive, QPalette::Base, QColor(255, 255, 255));
- modelPallete.setColor(QPalette::Active, QPalette::AlternateBase, QColor(248, 247, 246));
- modelPallete.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(248, 247, 246));
- d->treeView->setPalette(modelPallete);
- d->treeView->setUniformRowHeights(true);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setSpacing(0);
- layout->setContentsMargins(0, 0, 0, 0);
- layout->addWidget(d->treeView);
-}
-
-void QWrappedObjectView::setModel(QAbstractItemModel *model)
-{
- Q_D(QWrappedObjectView);
-
- if (d->treeView->model())
- disconnect(d->treeView->model(), 0, this, 0);
- if (d->treeView->selectionModel())
- disconnect(d->treeView->selectionModel(), 0, this, 0);
- d->treeView->setModel(model);
- if (model) {
- connect(model, &QAbstractItemModel::modelReset, this, &QWrappedObjectView::modelReset);
- connect(model, &QAbstractItemModel::rowsInserted, this, &QWrappedObjectView::rowsInserted);
- connect(d->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QWrappedObjectView::selectionChanged);
- }
-}
-
-void QWrappedObjectView::updateSelected()
-{
- Q_D(QWrappedObjectView);
-
- (dynamic_cast<QWrappedObjectModel *>(d->treeView->model()))->updateIndex(d->treeView->selectionModel()->selectedIndexes().first());
- // FIX ME
- QModelIndex index = d->treeView->selectionModel()->selectedIndexes().first();
- d->treeView->setCurrentIndex(d->treeView->model()->index(0, 0));
- d->treeView->setCurrentIndex(index);
-}
-
-void QWrappedObjectView::contextMenuEvent(QContextMenuEvent *event)
-{
- Q_D(QWrappedObjectView);
-
- QMenu menu(this);
- QWrappedObject *element = qvariant_cast<QWrappedObject *>(d->treeView->currentIndex().data(Qt::UserRole));
- d->visitedAddMethods.clear();
- d->populateContextMenu(menu, element);
- menu.exec(event->globalPos());
-}
-
-void QWrappedObjectView::handleAddMethod()
-{
- Q_D(QWrappedObjectView);
-
- QAction *action = qobject_cast<QAction *>(sender());
- if (action) {
- QObject *element = d->visitedAddMethods[action->text()].first;
- QMetaMethod metaMethod = d->visitedAddMethods[action->text()].second;
- QString elementType = action->data().toString();
- int type;
- if ((type = QMetaType::type(elementType.toLatin1())) != QMetaType::UnknownType) {
- const QMetaObject *metaObject = QMetaType::metaObjectForType(type);
- if (metaObject) {
- QObject *addedElement = metaObject->newInstance();
- if (addedElement) {
- addedElement->setObjectName(QString::fromLatin1("Unamed %1").arg(elementType.remove(QString::fromLatin1("*"))));
- metaMethod.invoke(element, ::Q_ARG(QObject *, addedElement));
- }
- }
- }
- }
- QWrappedObjectModel *wrappedObjectModel = dynamic_cast<QWrappedObjectModel *>(d->treeView->model());
- wrappedObjectModel->updateIndex(QModelIndex());
-}
-
-void QWrappedObjectView::addElementToView()
-{
- Q_D(QWrappedObjectView);
-
- emit addToView(qvariant_cast<QWrappedObject *>(d->treeView->selectionModel()->selectedIndexes().first().data(Qt::UserRole)));
-}
-
-void QWrappedObjectView::deleteObject()
-{
- Q_D(QWrappedObjectView);
-
- QWrappedObject *usedObject = qvariant_cast<QWrappedObject *>(d->treeView->selectionModel()->selection().indexes().first().data(Qt::UserRole));
-
- if (QMessageBox::question(this, tr("Delete element"), tr("Are you sure you want to delete '%1' element' ?").arg(qTopLevelWrapper(usedObject)->objectName())) == QMessageBox::Yes) {
- QWrappedObject *container = qvariant_cast<QWrappedObject *>(d->treeView->model()->index(0, 0, QModelIndex()).data(Qt::UserRole));
- removeObjectUse(container, usedObject);
- QWrappedObjectModel *wrappedObjectModel = dynamic_cast<QWrappedObjectModel *>(d->treeView->model());
- wrappedObjectModel->updateIndex(QModelIndex());
- d->treeView->setCurrentIndex(wrappedObjectModel->index(0, 0));
- emit wrappedObjectChanged(qvariant_cast<QWrappedObject *>(wrappedObjectModel->index(0, 0).data(Qt::UserRole)));
- d->treeView->expandAll();
- d->treeView->resizeColumnToContents(0);
- d->treeView->resizeColumnToContents(1);
- usedObject->deleteLater();
- }
-}
-
-void QWrappedObjectView::modelReset()
-{
- Q_D(QWrappedObjectView);
-
- d->treeView->setCurrentIndex(d->treeView->model()->index(0, 0));
- d->treeView->expandAll();
- d->treeView->resizeColumnToContents(0);
- d->treeView->resizeColumnToContents(1);
-}
-
-void QWrappedObjectView::rowsInserted(const QModelIndex &parent, int first)
-{
- Q_D(QWrappedObjectView);
-
- d->treeView->setCurrentIndex(d->treeView->model()->index(first, 0, parent));
-}
-
-void QWrappedObjectView::selectionChanged(const QItemSelection &selected)
-{
- emit wrappedObjectChanged(qvariant_cast<QWrappedObject *>(selected.indexes().first().data(Qt::UserRole)), selected.indexes().first());
-}
-
-void QWrappedObjectView::removeObjectUse(QWrappedObject *container, QWrappedObject *usedObject)
-{
- const QMetaWrappedObject *metaWrappedObject = container->metaWrappedObject();
- int propertyCount = metaWrappedObject->propertyCount();
- for (int i = 0; i < propertyCount; ++i) {
- QMetaProperty metaProperty = metaWrappedObject->property(i).metaProperty;
- QWrappedObject *propertyWrappedObject = metaWrappedObject->property(i).propertyWrappedObject;
- QString propertyName = QString::fromLatin1(metaProperty.name());
- QString modifiedPropertyName = QString(propertyName.left(1).toUpper()+propertyName.mid(1)).remove(QRegularExpression(QString::fromLatin1("s$"))).replace(QRegularExpression(QString::fromLatin1("ie$")), QString::fromLatin1("y")).replace(QRegularExpression(QString::fromLatin1("se$")), QString::fromLatin1("s")).replace(QRegularExpression(QString::fromLatin1("ice$")), QString::fromLatin1("ex")).replace(QRegularExpression(QString::fromLatin1("ce$")), QString::fromLatin1("x")).remove(QRegularExpression(QString::fromLatin1("_$")));
- QString typeName = QString::fromLatin1(metaProperty.typeName());
- QVariant variant = metaProperty.read(propertyWrappedObject);
- QString methodSignature;
- int metaMethodIndex;
- if (typeName.endsWith('*') && qvariant_cast<QWrappedObject *>(variant)) {
- QWrappedObject *object = qvariant_cast<QWrappedObject *>(variant);
- if (object == usedObject) {
- methodSignature = QString::fromLatin1("set%1(%2)").arg(modifiedPropertyName).arg(typeName.split(QString::fromLatin1("::")).last());
- if (!methodSignature.isEmpty() && (metaMethodIndex = container->metaObject()->indexOfMethod(methodSignature.toLatin1())) != -1) {
- container->metaObject()->method(metaMethodIndex).invoke(container, ::Q_ARG(QObject *, 0));
- }
- }
- else if (QWrappedObject::propertyData(QString::fromLatin1(metaWrappedObject->property(i).propertyMetaObject->className()), metaWrappedObject->property(i).metaProperty, QtWrappedObjects::AggregationRole).toString() == QString::fromLatin1("composite"))
- removeObjectUse(object, usedObject);
- }
- else if (typeName.contains(QString::fromLatin1("QSet")) && variant.isValid()) {
- QSet<QWrappedObject *> elements = *(static_cast<QSet<QWrappedObject *> *>(variant.data()));
- if (elements.size() > 0) {
- foreach (QWrappedObject *object, elements) {
- if (object == usedObject) {
- typeName = typeName.remove(QString::fromLatin1("QSet<")).remove(QString::fromLatin1(">"));
- methodSignature = QString::fromLatin1("remove%1(%2)").arg(modifiedPropertyName).arg(typeName.split(QString::fromLatin1("::")).last());
- if (!methodSignature.isEmpty() && (metaMethodIndex = container->metaObject()->indexOfMethod(methodSignature.toLatin1())) != -1) {
- container->metaObject()->method(metaMethodIndex).invoke(container, ::Q_ARG(QObject *, usedObject));
- }
- }
- else if (QWrappedObject::propertyData(QString::fromLatin1(metaWrappedObject->property(i).propertyMetaObject->className()), metaWrappedObject->property(i).metaProperty, QtWrappedObjects::AggregationRole).toString() == QString::fromLatin1("composite"))
- removeObjectUse(object, usedObject); }
- }
- }
- else if (typeName.contains(QString::fromLatin1("QList")) && variant.isValid()) {
- QList<QWrappedObject *> elements = *(static_cast<QList<QWrappedObject *> *>(variant.data()));
- if (elements.size() > 0) {
- foreach (QWrappedObject *object, elements) {
- if (object == usedObject) {
- typeName = typeName.remove(QString::fromLatin1("QList<")).remove(QString::fromLatin1(">"));
- methodSignature = QString::fromLatin1("remove%1(%2)").arg(modifiedPropertyName).arg(typeName.split(QString::fromLatin1("::")).last());
- if (!methodSignature.isEmpty() && (metaMethodIndex = container->metaObject()->indexOfMethod(methodSignature.toLatin1())) != -1) {
- container->metaObject()->method(metaMethodIndex).invoke(container, ::Q_ARG(QObject *, usedObject));
- }
- }
- else if (QWrappedObject::propertyData(QString::fromLatin1(metaWrappedObject->property(i).propertyMetaObject->className()), metaWrappedObject->property(i).metaProperty, QtWrappedObjects::AggregationRole).toString() == QString::fromLatin1("composite"))
- removeObjectUse(object, usedObject);
- }
- }
- }
- }
-}
-
-#include "moc_qwrappedobjectview.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectview.h b/src/wrappedobjectswidgets/qwrappedobjectview.h
deleted file mode 100644
index 1a5a36e1..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectview.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTVIEW_H
-#define QWRAPPEDOBJECTVIEW_H
-
-#include <QtCore/QModelIndex>
-
-#include <QtWrappedObjectsWidgets/QtWrappedObjectsWidgetsGlobal>
-
-#include <QtWidgets/QWidget>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QAbstractItemModel;
-class QItemSelection;
-class QQuickItem;
-class QWrappedObject;
-
-class QWrappedObjectViewPrivate;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectView : public QWidget
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QWrappedObjectView)
- Q_DECLARE_PRIVATE(QWrappedObjectView)
-
-public:
- explicit QWrappedObjectView(QWidget *parent = 0, Qt::WindowFlags f = 0);
-
-public Q_SLOTS:
- virtual void setModel(QAbstractItemModel *model);
- void updateSelected();
-
-Q_SIGNALS:
- void wrappedObjectChanged(QWrappedObject *selectedWrappedObject, QModelIndex index = QModelIndex());
- void addToView(QWrappedObject *selectedWrappedObject, QQuickItem *parent = 0);
-
-protected:
- void contextMenuEvent(QContextMenuEvent *event);
-
-private Q_SLOTS:
- void handleAddMethod();
- void addElementToView();
- void deleteObject();
- void modelReset();
- void rowsInserted(const QModelIndex &parent, int first);
- void selectionChanged(const QItemSelection &selected);
-
-private:
- void removeObjectUse(QWrappedObject *container, QWrappedObject *usedObject);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTVIEW_H
-
diff --git a/src/wrappedobjectswidgets/qwrappedobjectview_p.h b/src/wrappedobjectswidgets/qwrappedobjectview_p.h
deleted file mode 100644
index bcb5c2a6..00000000
--- a/src/wrappedobjectswidgets/qwrappedobjectview_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjectsWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWRAPPEDOBJECTVIEW_P_H
-#define QWRAPPEDOBJECTVIEW_P_H
-
-#include "qtwrappedobjectswidgetsglobal.h"
-#include "private/qwidget_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjectsWidgets)
-
-class QTreeView;
-
-class Q_WRAPPEDOBJECTSWIDGETS_EXPORT QWrappedObjectViewPrivate : public QWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QWrappedObjectView)
-
-public:
- explicit QWrappedObjectViewPrivate();
-
- void populateContextMenu(QMenu &menu, QWrappedObject *element);
-
- QTreeView *treeView;
- QHash< QString, QPair<QObject *, QMetaMethod> > visitedAddMethods;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QWRAPPEDOBJECTVIEW_P_H
-
diff --git a/src/wrappedobjectswidgets/wrappedobjectswidgets.pro b/src/wrappedobjectswidgets/wrappedobjectswidgets.pro
deleted file mode 100644
index f259262c..00000000
--- a/src/wrappedobjectswidgets/wrappedobjectswidgets.pro
+++ /dev/null
@@ -1,37 +0,0 @@
-load(qt_build_config)
-
-TARGET = QtWrappedObjectsWidgets
-QT = core-private widgets-private wrappedobjects
-
-QMAKE_DOCS = $$PWD/doc/qtwrappedobjectswidgets.qdocconf
-
-load(qt_module)
-
-PUBLIC_HEADERS += \
- qwrappedobjectview.h \
- qwrappedobjectmodel.h \
- qtwrappedobjectswidgetsglobal.h \
- qwrappedobjectpropertymodel.h \
- qwrappedobjectpropertyeditor.h \
- qwrappedobjectpropertyfiltermodel.h \
-
-PRIVATE_HEADERS += \
- qwrappedobjectview_p.h \
- qwrappedobjectmodel_p.h \
- qwrappedobjectpropertymodel_p.h \
- qwrappedobjectpropertyeditor_p.h \
- internal/propertyeditoritemdelegate_p.h \
- internal/filterwidget_p.h \
- internal/propertyeditor_p.h
-
-SOURCES += \
- qwrappedobjectview.cpp \
- qwrappedobjectmodel.cpp \
- qwrappedobjectpropertymodel.cpp \
- qwrappedobjectpropertyeditor.cpp \
- qwrappedobjectpropertyfiltermodel.cpp \
- internal/filterwidget.cpp \
- internal/propertyeditor.cpp \
- internal/propertyeditoritemdelegate.cpp
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS