2014-09-10 17:27:45 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpropertyformview.h
|
|
|
|
** @author hedgeware <internal(at)hedgeware.net>
|
|
|
|
** @date
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** All rights reserved. This program and the accompanying materials
|
|
|
|
** are made available under the terms of the GNU Lesser General Public License
|
|
|
|
** (LGPL) version 2.1 which accompanies this distribution, and is available at
|
|
|
|
** http://www.gnu.org/licenses/lgpl-2.1.html
|
|
|
|
**
|
|
|
|
** This library is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
** Lesser General Public License for more details.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VPROPERTYFORMVIEW_H
|
|
|
|
#define VPROPERTYFORMVIEW_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
2014-09-10 17:27:45 +02:00
|
|
|
#include <QPointer>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
#include "vpropertyexplorer_global.h"
|
2014-09-10 17:27:45 +02:00
|
|
|
#include "vpropertyformwidget.h"
|
|
|
|
|
2014-09-10 19:57:08 +02:00
|
|
|
namespace VPE
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
class VPropertyModel;
|
|
|
|
|
2021-09-25 16:18:33 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
|
|
|
|
QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
|
|
|
|
|
2014-09-10 17:27:45 +02:00
|
|
|
//! This class populates a form layout with the properties in a model
|
|
|
|
class VPROPERTYEXPLORERSHARED_EXPORT VPropertyFormView : public VPropertyFormWidget
|
|
|
|
{
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_OBJECT // NOLINT
|
2014-09-10 17:27:45 +02:00
|
|
|
public:
|
|
|
|
//! Constructor
|
2017-07-05 18:35:34 +02:00
|
|
|
explicit VPropertyFormView(QWidget *parent = nullptr);
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
//! Constructor
|
2017-07-05 18:35:34 +02:00
|
|
|
explicit VPropertyFormView(VPropertyModel* model, QWidget *parent = nullptr);
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
//! Constructor
|
2017-07-05 18:35:34 +02:00
|
|
|
explicit VPropertyFormView(VPropertySet* property_set, QWidget *parent = nullptr);
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
//! Destructor
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual ~VPropertyFormView() override;
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
//! Rebuilds the whole form
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void build() override;
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
//! Set the source model. Leads to the rebuild of the form
|
|
|
|
//! \param model The model to use
|
|
|
|
void setModel(VPropertyModel* model);
|
|
|
|
|
2014-09-10 19:57:08 +02:00
|
|
|
//! Set the property set to use. Note that if using a property set directly, adding and removing properties to the
|
|
|
|
//! property set leads to undifined behaviour for the property set misses notification signals.
|
2014-09-11 18:52:02 +02:00
|
|
|
//! \param property_set The property set to use
|
2014-09-10 17:27:45 +02:00
|
|
|
void setPropertySet(VPropertySet* property_set);
|
|
|
|
|
|
|
|
//! Called when a row gets removed in the model
|
|
|
|
void rowsRemoved(const QModelIndex& parent, int start, int end);
|
|
|
|
|
|
|
|
//! Called when a new row is being inserted into the model
|
|
|
|
void rowsInserted(const QModelIndex& parent, int start, int end);
|
|
|
|
|
|
|
|
//! Called when the model is being reset
|
|
|
|
void modelReset();
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
//! Called, when the model gets destroyed
|
|
|
|
void modelDestroyed();
|
|
|
|
|
|
|
|
//! Called when data in the model gets changed
|
|
|
|
void dataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right);
|
|
|
|
|
|
|
|
//! Updates the model when data was submitted by the view
|
|
|
|
void dataSubmitted(VProperty* property);
|
|
|
|
|
|
|
|
protected:
|
2018-06-26 14:53:48 +02:00
|
|
|
virtual void showEvent(QShowEvent* event) override;
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
//! Rebuilds the widegt only if it is visible
|
|
|
|
void updatePropertyList();
|
|
|
|
|
|
|
|
//! Removes the model and property set if they were set
|
|
|
|
void removeModelAndSet();
|
|
|
|
|
|
|
|
//! Function to handle newly created VPropertyWidgets
|
|
|
|
virtual void connectPropertyFormWidget(VPropertyFormWidget* widget);
|
|
|
|
|
2014-12-04 12:34:48 +01:00
|
|
|
private:
|
2022-08-12 17:50:13 +02:00
|
|
|
Q_DISABLE_COPY_MOVE(VPropertyFormView) // NOLINT
|
2014-09-10 17:27:45 +02:00
|
|
|
};
|
|
|
|
|
2021-09-25 16:18:33 +02:00
|
|
|
QT_WARNING_POP
|
2021-09-25 10:43:05 +02:00
|
|
|
|
2014-09-10 19:57:08 +02:00
|
|
|
} // Namespace VPE
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
#endif // VPROPERTYFORMVIEW_H
|