1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-31 21:22:58 +08:00

updat tables; add PropertyHelper.h

This commit is contained in:
jared 2020-11-13 12:03:23 +08:00
parent 6490901433
commit bb09cc2a37
3 changed files with 54 additions and 13 deletions

View File

@ -0,0 +1,47 @@
#pragma once
#include <QObject>
#define READ_PROPERTY(TYPE, NAME) \
private: \
Q_PROPERTY(TYPE NAME READ NAME NOTIFY NAME##Changed) \
public: \
const TYPE &NAME() const \
{ \
return m_##NAME; \
} \
Q_SIGNAL void NAME##Changed(const TYPE &value); \
\
private: \
TYPE m_##NAME;
#define READONLY_PROPERTY(TYPE, NAME) \
private: \
Q_PROPERTY(TYPE NAME READ NAME CONSTANT) \
public: \
const TYPE &NAME() const \
{ \
return m_##NAME; \
} \
\
private: \
TYPE m_##NAME;
#define AUTO_PROPERTY(TYPE, NAME) \
private: \
Q_PROPERTY(TYPE NAME READ NAME WRITE NAME NOTIFY NAME##Changed) \
public: \
const TYPE &NAME() const \
{ \
return m_##NAME; \
} \
void NAME(const TYPE &value) \
{ \
if (m_##NAME == value) \
return; \
m_##NAME = value; \
emit NAME##Changed(value); \
} \
Q_SIGNAL void NAME##Changed(const TYPE &value); \
\
private: \
TYPE m_##NAME;

View File

@ -6,6 +6,7 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/Common/FileReadWrite.h \
$$PWD/Common/PropertyHelper.h \
$$PWD/Common/ObjectMap.h \
$$PWD/QuickTool/QuickTool.h \
$$PWD/Common/Subject.h \

View File

@ -16,16 +16,13 @@ Item {
Row {
spacing: 10
CusLabel {
text: qsTr("selectCount: %1").arg(
deviceAddModel.selectedCount) + trans.transString
text: qsTr("selectCount: %1").arg(deviceAddModel.selectedCount) + trans.transString
}
CusLabel {
text: qsTr("checkedCount: %1").arg(
deviceAddModel.checkedCount) + trans.transString
text: qsTr("checkedCount: %1").arg(deviceAddModel.checkedCount) + trans.transString
}
CusLabel {
text: qsTr("visibledCount: %1").arg(
deviceAddModel.visibledCount) + trans.transString
text: qsTr("visibledCount: %1").arg(deviceAddModel.visibledCount) + trans.transString
}
}
CusTextField_Search {
@ -98,9 +95,7 @@ Item {
&& mouseX <= cusHeader.xList[2]) {
editInput.x = cusHeader.xList[1]
editInput.y = cusView.y + (parseInt(
mouseY / CusConfig.fixedHeight))
* CusConfig.fixedHeight
editInput.y = cusView.y + (parseInt(mouseY / CusConfig.fixedHeight)) * CusConfig.fixedHeight
editInput.width = cusHeader.widthList[1]
editInput.height = CusConfig.fixedHeight
editInput.index = index
@ -334,8 +329,7 @@ Item {
text: qsTr(" * Check All rows by header of Column 0") + trans.transString
}
CusLabel {
text: qsTr(" * Edit Column 1 by double click, and update data to model after edit")
+ trans.transString
text: qsTr(" * Edit Column 1 by double click, and update data to model after edit") + trans.transString
}
CusLabel {
text: qsTr(" * Fuzzy search") + trans.transString
@ -344,8 +338,7 @@ Item {
text: qsTr(" * Reset column width by drag header splite line") + trans.transString
}
CusLabel {
text: qsTr(" * Sort by click header, click again can switch ascending or descending")
+ trans.transString
text: qsTr(" * Sort by click header, click again can switch ascending or descending") + trans.transString
}
}
}