Skip to content
Snippets Groups Projects
Commit fae744cb authored by andrey.daragan's avatar andrey.daragan
Browse files

[*] The draft has been amended.

parent a7452ee8
No related branches found
No related tags found
1 merge request!11Cellframe clone
Showing
with 328 additions and 73 deletions
[submodule "libdap"]
path = libdap
url = https://github.com/kelvinblockchain/libdap.git
branch = master
[submodule "libdap-qt-ui-qml"] [submodule "libdap-qt-ui-qml"]
path = libdap-qt-ui-qml path = libdap-qt-ui-qml
url = git://github.com/kelvinblockchain/libdap-qt-ui-qml.git url = git://github.com/kelvinblockchain/libdap-qt-ui-qml.git
......
...@@ -2,5 +2,18 @@ ...@@ -2,5 +2,18 @@
DapScreenDialog::DapScreenDialog(QObject *parent) : QObject(parent) DapScreenDialog::DapScreenDialog(QObject *parent) : QObject(parent)
{ {
m_proxyModel = new QSortFilterProxyModel;
m_proxyModel->setSourceModel(&DapUiQmlWidgetModel::getInstance());
m_proxyModel->setFilterRegExp(QRegExp("true"));
m_proxyModel->setFilterRole(VisibleRole);
}
QSortFilterProxyModel *DapScreenDialog::proxyModel() const
{
return m_proxyModel;
}
void DapScreenDialog::setProxyModel(QSortFilterProxyModel *proxyModel)
{
m_proxyModel = proxyModel;
} }
...@@ -2,16 +2,26 @@ ...@@ -2,16 +2,26 @@
#define DAPSCREENDIALOG_H #define DAPSCREENDIALOG_H
#include <QObject> #include <QObject>
#include <QSortFilterProxyModel>
#include "DapUiQmlWidgetModel.h"
class DapScreenDialog : public QObject class DapScreenDialog : public QObject
{ {
Q_OBJECT Q_OBJECT
QSortFilterProxyModel *m_proxyModel;
public: public:
explicit DapScreenDialog(QObject *parent = nullptr); explicit DapScreenDialog(QObject *parent = nullptr);
signals: Q_PROPERTY(QSortFilterProxyModel* ProxyModel MEMBER m_proxyModel READ proxyModel WRITE setProxyModel NOTIFY proxyModelChanged)
QSortFilterProxyModel *proxyModel() const;
void setProxyModel(QSortFilterProxyModel *proxyModel);
signals:
void proxyModelChanged(QSortFilterProxyModel *proxyModel);
public slots: public slots:
}; };
#endif // DAPSCREENDIALOG_H #endif // DAPSCREENDIALOG_H
\ No newline at end of file
...@@ -2,5 +2,18 @@ ...@@ -2,5 +2,18 @@
DapScreenDialogChangeWidget::DapScreenDialogChangeWidget(QObject *parent) : QObject(parent) DapScreenDialogChangeWidget::DapScreenDialogChangeWidget(QObject *parent) : QObject(parent)
{ {
m_proxyModel = new QSortFilterProxyModel;
m_proxyModel->setSourceModel(&DapUiQmlWidgetModel::getInstance());
m_proxyModel->setFilterRegExp(QRegExp("false"));
m_proxyModel->setFilterRole(VisibleRole);
}
QSortFilterProxyModel *DapScreenDialogChangeWidget::proxyModel() const
{
return m_proxyModel;
}
void DapScreenDialogChangeWidget::setProxyModel(QSortFilterProxyModel *proxyModel)
{
m_proxyModel = proxyModel;
} }
...@@ -2,16 +2,25 @@ ...@@ -2,16 +2,25 @@
#define DAPSCREENDIALOGCHANGEWIDGET_H #define DAPSCREENDIALOGCHANGEWIDGET_H
#include <QObject> #include <QObject>
#include <QSortFilterProxyModel>
#include "DapUiQmlWidgetModel.h"
class DapScreenDialogChangeWidget : public QObject class DapScreenDialogChangeWidget : public QObject
{ {
Q_OBJECT Q_OBJECT
QSortFilterProxyModel *m_proxyModel;
public: public:
explicit DapScreenDialogChangeWidget(QObject *parent = nullptr); explicit DapScreenDialogChangeWidget(QObject *parent = nullptr);
signals: Q_PROPERTY(QSortFilterProxyModel* ProxyModel MEMBER m_proxyModel READ proxyModel WRITE setProxyModel NOTIFY proxyModelChanged)
QSortFilterProxyModel *proxyModel() const;
void setProxyModel(QSortFilterProxyModel *proxyModel);
signals:
void proxyModelChanged(QSortFilterProxyModel *proxyModel);
public slots: public slots:
}; };
#endif // DAPSCREENDIALOGCHANGEWIDGET_H #endif // DAPSCREENDIALOGCHANGEWIDGET_H
\ No newline at end of file
#include "DapSettings.h"
DapSettings::DapSettings(QObject *parent) : QObject(parent)
{
}
#ifndef DAPSETTINGS_H
#define DAPSETTINGS_H
#include <QObject>
class DapSettings : public QObject
{
Q_OBJECT
public:
explicit DapSettings(QObject *parent = nullptr);
signals:
public slots:
};
#endif // DAPSETTINGS_H
\ No newline at end of file
import QtQuick 2.4 import QtQuick 2.9
import QtQml 2.11
import QtQuick.Controls 1.4
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.2
import QtQml.Models 2.2
import KelvinDashboard 1.0
DapUiQmlScreenChangeWidgetForm { Dialog {
id: dialogChangeWidget
function addWidget() {
dialogChangeWidget.open();
}
width: parent.width/1.5
height: parent.width/1.5
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
focus: true
modal: true
title: qsTr("Change widget...")
contentItem:
Rectangle {
id: b
width: dialogChangeWidget.width
height: dialogChangeWidget.height
border.color: "gray"
clip: true
DapScreenDialogChangeWidget {
id: widgetModel
}
// DelegateModel {
// id: delegateModel
// model: widgetModel.ProxyModel
// groups: [
// DelegateModelGroup {
// id: group
// name: "selected"
// }
// ]
// delegate:
// Rectangle {
// id: item
// height: text.height+10
// width: listViewDapWidgets.width
// RowLayout {
// anchors.fill: parent
// Text {
// id: text
// text: name
// Layout.alignment: Qt.AlignVCenter
// Layout.leftMargin: 10
// }
// }
// MouseArea {
// anchors.fill: parent
// onClicked:
// {
// item.DelegateModel.inSelected = !item.DelegateModel.inSelected
// if (item.DelegateModel.inSelected)
// {
// item.color = "aliceblue"
// }
// else
// {
// item.color = "transparent"
// }
// }
// }
// }
// }
// ListView {
// id: listViewDapWidgets
// anchors.fill: parent
// anchors.margins: 1
// model: delegateModel
// ScrollBar.vertical: ScrollBar { }
// }
ListView {
id: listViewDapWidgets
anchors.fill: parent
anchors.margins: 1
model: DapUiQmlWidgetModel
clip: true
delegate:
Rectangle {
id: itemWidget
height: checkBoxWidget.height+10
width: listViewDapWidgets.width
Row {
anchors.fill: parent
CheckBox {
id: checkBoxWidget
checkable: true
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 10
}
Text
{
id: textWidget
text: qsTr(name)
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
anchors.fill: parent
onClicked:
{
listViewDapWidgets.currentIndex = index
var item = DapUiQmlWidgetModel.get(index)
DapUiQmlWidgetModel.set(index, DapUiQmlWidgetModel.get(index).name, DapUiQmlWidgetModel.get(index).URLpage, DapUiQmlWidgetModel.get(index).image, !item.visible)
console.log("I: " +index + " : " + DapUiQmlWidgetModel.get(index) + " value = " + !item.visible)
if(checkBoxWidget.checked)
{
checkBoxWidget.checkState = Qt.Unchecked
}
else
{
checkBoxWidget.checkState = Qt.Checked
}
}
}
}
ScrollBar.vertical: ScrollBar { }
highlight: Rectangle { color: "aliceblue"; radius: 5 }
focus: true
}
}
} }
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import KelvinDashboard 1.0
Page { Page {
id: dapUiQmlScreenDialog id: dapUiQmlScreenDialog
title: qsTr("Dashboard") title: qsTr("Dashboard")
anchors.fill: parent anchors.fill: parent
DapUiQmlScreenChangeWidget {
id: listViewDapWidgets
}
DapScreenDialog {
id: widgetModel
}
Rectangle { Rectangle {
color: "white" color: "white"
anchors.fill: parent anchors.fill: parent
GridView { GridView {
id: gridViewDashboard id: gridViewDashboard
signal pressAndHold(int index)
anchors.fill: parent anchors.fill: parent
cellWidth: width/3; cellHeight: height/2 cellWidth: width/3; cellHeight: height/2
focus: true focus: true
model: DapUiQmlListModelWidgets {} model: widgetModel.ProxyModel
highlight: Rectangle { width: gridViewDashboard.cellWidth; height: gridViewDashboard.cellHeight; radius: width/50; color: "aliceblue" } highlight: Rectangle { width: gridViewDashboard.cellWidth; height: gridViewDashboard.cellHeight; radius: width/50; color: "aliceblue" }
delegate: Item { delegate: DapUiQmlWidgetDelegateForm {
width: gridViewDashboard.cellWidth width: gridViewDashboard.cellWidth
height: gridViewDashboard.cellHeight height: gridViewDashboard.cellHeight
Rectangle {
anchors.fill: parent
border.color: "grey"
color: "transparent"
radius: width/50
anchors.margins: 5
clip: true
Column {
width: parent.width
anchors.centerIn: parent
spacing: width / 10
anchors.margins: width / 10
Image {
id: iconWidget
source: "qrc:/Resources/Icons/add.png"
width: parent.width * 2/3
height: width
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
text: name
color: "darkgrey"
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: onClicked:
{ {
parent.GridView.view.currentIndex = index; parent.GridView.view.currentIndex = index;
stackView.push(Qt.resolvedUrl(page), StackView.Immediate); stackView.push(Qt.resolvedUrl(URLpage), StackView.Immediate);
} }
} }
} }
} }
} }
RoundButton {
text: qsTr("+")
highlighted: true
anchors.margins: 10
anchors.right: parent.right
anchors.bottom: parent.bottom
onClicked: {
listViewDapWidgets.addWidget()
}
}
} }
#include "DapUiQmlWidget.h" #include "DapUiQmlWidget.h"
DapUiQmlWidget::DapUiQmlWidget(QObject *parent) : QObject(parent) bool DapUiQmlWidget::getVisible() const
{ {
return m_visible;
}
void DapUiQmlWidget::setVisible(bool visible)
{
m_visible = visible;
}
DapUiQmlWidget::DapUiQmlWidget(const QString &name, const QString &URLpage, const QString &image, const bool &visible, QObject *parent) : QObject(parent)
{
setName(name);
setURLpage(URLpage);
setImage(image);
setVisible(visible);
}
QString DapUiQmlWidget::getName() const
{
return m_name;
}
void DapUiQmlWidget::setName(const QString &name)
{
m_name = name;
}
QString DapUiQmlWidget::getURLpage() const
{
return m_URLpage;
}
void DapUiQmlWidget::setURLpage(const QString &URLpage)
{
m_URLpage = URLpage;
}
QString DapUiQmlWidget::getImage() const
{
return m_image;
}
void DapUiQmlWidget::setImage(const QString &image)
{
m_image = image;
} }
...@@ -6,12 +6,44 @@ ...@@ -6,12 +6,44 @@
class DapUiQmlWidget : public QObject class DapUiQmlWidget : public QObject
{ {
Q_OBJECT Q_OBJECT
protected:
QString m_name;
QString m_URLpage;
QString m_image;
bool m_visible{false};
public: public:
explicit DapUiQmlWidget(QObject *parent = nullptr); explicit DapUiQmlWidget(QObject *parent = nullptr);
explicit DapUiQmlWidget(const QString &name, const QString &URLpage, const QString &image, const bool &visible = false, QObject *parent = nullptr);
///
Q_PROPERTY(QString Name MEMBER m_nameService READ getName WRITE setName NOTIFY nameChanged)
///
Q_PROPERTY(QString URLpage MEMBER m_nameService READ getURLpage WRITE setURLpage NOTIFY URLpageChanged)
///
Q_PROPERTY(QString Image MEMBER m_nameService READ getImage WRITE setImage NOTIFY imageChanged)
///
Q_PROPERTY(bool Visible MEMBER m_nameService READ getVisible WRITE setVisible NOTIFY visibleChanged)
QString getName() const;
void setName(const QString &name);
QString getURLpage() const;
void setURLpage(const QString &URLpage);
QString getImage() const;
void setImage(const QString &image);
bool getVisible() const;
void setVisible(bool visible);
signals: signals:
void nameChanged(const QString &name);
void URLpageChanged(const QString &URLpage);
void imageChanged(const QString &image);
void visibleChanged(const bool &visible);
public slots: public slots:
}; };
#endif // DAPUIQMLWIDGET_H #endif // DAPUIQMLWIDGET_H
\ No newline at end of file
#include "DapUiQmlWidgetChainBallance.h" #include "DapUiQmlWidgetChainBallance.h"
DapUiQmlWidgetChainBallance::DapUiQmlWidgetChainBallance() DapUiQmlWidgetChainBallance::DapUiQmlWidgetChainBallance(const QString &name, const QString &URLpage, const QString &image) : DapUiQmlWidget(name, URLpage, image)
{ {
} }
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
class DapUiQmlWidgetChainBallance : public DapUiQmlWidget class DapUiQmlWidgetChainBallance : public DapUiQmlWidget
{ {
public: public:
DapUiQmlWidgetChainBallance(); explicit DapUiQmlWidgetChainBallance(const QString &name, const QString &URLpage, const QString &image);
}; };
#endif // DAPUIQMLWIDGETCHAINBALLANCE_H #endif // DAPUIQMLWIDGETCHAINBALLANCE_H
#include "DapUiQmlWidgetChainBlockExplorer.h" #include "DapUiQmlWidgetChainBlockExplorer.h"
DapUiQmlWidgetChainBlockExplorer::DapUiQmlWidgetChainBlockExplorer() DapUiQmlWidgetChainBlockExplorer::DapUiQmlWidgetChainBlockExplorer(const QString &name, const QString &URLpage, const QString &image) : DapUiQmlWidget(name, URLpage, image)
{ {
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
class DapUiQmlWidgetChainBlockExplorer : public DapUiQmlWidget class DapUiQmlWidgetChainBlockExplorer : public DapUiQmlWidget
{ {
public: public:
DapUiQmlWidgetChainBlockExplorer(); DapUiQmlWidgetChainBlockExplorer(const QString &name, const QString &URLpage, const QString &image);
}; };
#endif // DAPUIQMLWIDGETCHAINBLOCKEXPLORER_H #endif // DAPUIQMLWIDGETCHAINBLOCKEXPLORER_H
#include "DapUiQmlWidgetChainNodeLogs.h" #include "DapUiQmlWidgetChainNodeLogs.h"
DapUiQmlWidgetChainNodeLogs::DapUiQmlWidgetChainNodeLogs() DapUiQmlWidgetChainNodeLogs::DapUiQmlWidgetChainNodeLogs(const QString &name, const QString &URLpage, const QString &image) : DapUiQmlWidget(name, URLpage, image)
{ {
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
class DapUiQmlWidgetChainNodeLogs : public DapUiQmlWidget class DapUiQmlWidgetChainNodeLogs : public DapUiQmlWidget
{ {
public: public:
DapUiQmlWidgetChainNodeLogs(); explicit DapUiQmlWidgetChainNodeLogs(const QString &name, const QString &URLpage, const QString &image);
}; };
#endif // DAPUIQMLWIDGETCHAINNODELOGS_H #endif // DAPUIQMLWIDGETCHAINNODELOGS_H
#include "DapUiQmlWidgetChainOperations.h" #include "DapUiQmlWidgetChainOperations.h"
DapUiQmlWidgeChainOperations::DapUiQmlWidgeChainOperations() DapUiQmlWidgeChainOperations::DapUiQmlWidgeChainOperations(const QString &name, const QString &URLpage, const QString &image) : DapUiQmlWidget(name, URLpage, image)
{ {
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
class DapUiQmlWidgeChainOperations : public DapUiQmlWidget class DapUiQmlWidgeChainOperations : public DapUiQmlWidget
{ {
public: public:
DapUiQmlWidgeChainOperations(); explicit DapUiQmlWidgeChainOperations(const QString &name, const QString &URLpage, const QString &image);
}; };
#endif // DAPUIQMLWIDGECHAINOPERATIONS_H #endif // DAPUIQMLWIDGECHAINOPERATIONS_H
#include "DapUiQmlWidgetChainTransctions.h" #include "DapUiQmlWidgetChainTransctions.h"
DapUiQmlWidgetChainTransctions::DapUiQmlWidgetChainTransctions() DapUiQmlWidgetChainTransctions::DapUiQmlWidgetChainTransctions(const QString &name, const QString &URLpage, const QString &image) : DapUiQmlWidget(name, URLpage, image)
{ {
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment