1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-02-06 21:48:24 +08:00

update Model; update Color

This commit is contained in:
jared 2020-11-07 00:51:12 +08:00
parent 75ca962118
commit c3042aed1e
31 changed files with 224 additions and 350 deletions

View File

@ -1,8 +0,0 @@
#include "QuickItemBase.h"
QuickItemBase::QuickItemBase(QObject *parent)
: QObject(parent)
{
}
QuickItemBase::~QuickItemBase() {}

View File

@ -1,117 +0,0 @@
#include "QuickListModelBase.h"
#include "QuickItemBase.h"
QuickListModelBase::QuickListModelBase(QObject *parent)
: QAbstractListModel(parent)
{
}
QuickListModelBase::~QuickListModelBase() {}
int QuickListModelBase::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return mObjs.count();
}
QVariant QuickListModelBase::data(const QModelIndex &index, int role) const
{
if (index.row() < 0 || index.row() >= mObjs.size()) {
return {};
}
if (role == Qt::DisplayRole || role == Qt::EditRole) {
auto obj = mObjs.at(index.row());
return QVariant::fromValue(obj);
}
return {};
}
QVariant QuickListModelBase::data(int row, int role) const
{
if (row < 0 || row >= mObjs.size())
{
return {};
}
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
auto obj = mObjs.at(row);
return QVariant::fromValue(obj);
}
return {};
}
void QuickListModelBase::resetData(const QList<QuickItemBase *> &objs)
{
auto oldObjs = mObjs;
beginResetModel();
mObjs = objs;
endResetModel();
qDeleteAll(oldObjs);
updateCalcInfo();
}
void QuickListModelBase::append(const QList<QuickItemBase *> &objs)
{
beginInsertRows({}, mObjs.count(), mObjs.count());
mObjs.append(objs);
endInsertRows();
updateCalcInfo();
}
void QuickListModelBase::prepend(QuickItemBase *obj)
{
beginInsertRows({}, 0, 0);
mObjs.prepend(obj);
endInsertRows();
updateCalcInfo();
}
void QuickListModelBase::insert(int row, const QList<QuickItemBase *> &objs)
{
if (row < 0 || row >= mObjs.size()) {
return;
}
beginInsertRows({}, row, row);
int srow = row;
for (const auto &obj : objs) {
mObjs.insert(srow, obj);
srow++;
}
endInsertRows();
updateCalcInfo();
}
void QuickListModelBase::clear()
{
beginRemoveRows({}, 0, mObjs.count());
qDeleteAll(mObjs);
mObjs.clear();
endRemoveRows();
updateCalcInfo();
}
void QuickListModelBase::removeAt(int row)
{
if (row < 0 || row >= mObjs.size()) {
return;
}
beginRemoveRows({}, row, row);
auto obj = mObjs.at(row);
mObjs.removeAt(row);
endRemoveRows();
obj->deleteLater();
updateCalcInfo();
}
void QuickListModelBase::updateData(int row, QuickItemBase *obj)
{
if (row < 0 || row >= mObjs.size()) {
return;
}
auto oldObj = mObjs.at(row);
mObjs[row] = obj;
emit dataChanged(index(row, 0), index(row, 0));
oldObj->deleteLater();
updateCalcInfo();
}

View File

@ -1,48 +0,0 @@
#pragma once
#include <QAbstractListModel>
#include "TaoCommonGlobal.h"
class QuickItemBase;
class TAO_API QuickListModelBase : public QAbstractListModel
{
Q_OBJECT
public:
explicit QuickListModelBase(QObject *parent = nullptr);
~QuickListModelBase() override;
public:
//[begin] query data
int rowCount(const QModelIndex &parent) const override;
Q_INVOKABLE QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Q_INVOKABLE QVariant data(int row, int role = Qt::DisplayRole) const;
//[end] query data
//[begin] reset data
void resetData(const QList<QuickItemBase *> &objs);
const QList<QuickItemBase *> &datas() const
{
return mObjs;
}
//[end] reset data
//[begin] add data
void append(const QList<QuickItemBase *> &objs);
void prepend(QuickItemBase *obj);
void insert(int row, const QList<QuickItemBase *> &objs);
//[end] add data
//[begin] remove data
void clear();
void removeAt(int row);
//[end] remove data
//[begin] update data
void updateData(int row, QuickItemBase *obj);
//[end] update data
public:
virtual void updateCalcInfo() {}
protected:
QList<QuickItemBase *> mObjs;
};

View File

@ -1,6 +1,7 @@
#include "QuickTool.h" #include "QuickTool.h"
#include <QQuickItem> #include <QQuickItem>
#include <QGuiApplication> #include <QGuiApplication>
QuickTool::QuickTool(QObject *parent) : QObject(parent) {} QuickTool::QuickTool(QObject *parent) : QObject(parent) {}
QuickTool::QuickTool(QObject *rootObject, QObject *parent) QuickTool::QuickTool(QObject *rootObject, QObject *parent)
@ -37,9 +38,9 @@ QRect QuickTool::getItemGeometryToScene(const QString &targetObjName) const
return {}; return {};
} }
void QuickTool::setAppOverrideCursor(Qt::CursorShape shape) void QuickTool::setAppOverrideCursor(QCursor cursor)
{ {
qApp->setOverrideCursor(shape); qApp->setOverrideCursor(cursor);
} }
void QuickTool::restoreAppOverrideCursor() void QuickTool::restoreAppOverrideCursor()

View File

@ -2,6 +2,7 @@
#include <QObject> #include <QObject>
#include <QVariant> #include <QVariant>
#include <QRect> #include <QRect>
#include <QCursor>
#include "TaoCommonGlobal.h" #include "TaoCommonGlobal.h"
class TAO_API QuickTool : public QObject class TAO_API QuickTool : public QObject
{ {
@ -10,17 +11,10 @@ public:
explicit QuickTool(QObject *parent = nullptr); explicit QuickTool(QObject *parent = nullptr);
explicit QuickTool(QObject *rootObject, QObject *parent = nullptr); explicit QuickTool(QObject *rootObject, QObject *parent = nullptr);
virtual ~QuickTool() override; virtual ~QuickTool() override;
void setRootObjet(QObject *rootObj) void setRootObjet(QObject *rootObj) { pRootObject = rootObj; }
{ QObject *rootObject() const { return pRootObject; }
pRootObject = rootObj;
}
QObject *rootObject() const
{
return pRootObject;
}
void findRootByNode(QObject *nodeObject); void findRootByNode(QObject *nodeObject);
public slots: public slots:
QObject *getObject(const QString &targetObjName) const; QObject *getObject(const QString &targetObjName) const;
@ -34,8 +28,7 @@ public slots:
QRect getItemGeometryToScene(const QString &targetObjName) const; QRect getItemGeometryToScene(const QString &targetObjName) const;
void setAppOverrideCursor(QCursor cursor);
void setAppOverrideCursor(Qt::CursorShape shape);
void restoreAppOverrideCursor(); void restoreAppOverrideCursor();
QPoint cursorGlobalPos() const; QPoint cursorGlobalPos() const;

View File

@ -10,16 +10,15 @@ INCLUDEPATH += $$PWD \
HEADERS += \ HEADERS += \
$$PWD/Common/FileReadWrite.h \ $$PWD/Common/FileReadWrite.h \
$$PWD/Common/ObjectMap.h \ $$PWD/Common/ObjectMap.h \
$$PWD/QuickModel/TaoListModelBase.hpp \
$$PWD/QuickTool/QuickTool.h \ $$PWD/QuickTool/QuickTool.h \
$$PWD/Common/Subject.h \ $$PWD/Common/Subject.h \
$$PWD/Common/Package.h \ $$PWD/Common/Package.h \
$$PWD/Frameless/TaoFrameLessView.h \ $$PWD/Frameless/TaoFrameLessView.h \
$$PWD/Logger/LoggerTemplate.h \ $$PWD/Logger/LoggerTemplate.h \
$$PWD/Logger/Logger.h \ $$PWD/Logger/Logger.h \
$$PWD/QuickModel/QuickItemBase.h \ $$PWD/TaoModel/TaoListItemBase.h \
$$PWD/QuickModel/QuickListModel.h \ $$PWD/TaoModel/TaoListModel.h \
$$PWD/QuickModel/QuickListModelBase.h \ $$PWD/TaoModel/TaoListModelBase.hpp \
$$PWD/Thread/ThreadCommon.h \ $$PWD/Thread/ThreadCommon.h \
$$PWD/Thread/ThreadPool.h \ $$PWD/Thread/ThreadPool.h \
$$PWD/Thread/ThreadWorkerController.h \ $$PWD/Thread/ThreadWorkerController.h \
@ -29,10 +28,9 @@ HEADERS += \
SOURCES += \ SOURCES += \
$$PWD/Frameless/TaoFrameLessView.cpp \ $$PWD/Frameless/TaoFrameLessView.cpp \
$$PWD/Logger/Logger.cpp \ $$PWD/Logger/Logger.cpp \
$$PWD/QuickModel/QuickItemBase.cpp \
$$PWD/QuickModel/QuickListModel.cpp \
$$PWD/QuickModel/QuickListModelBase.cpp \
$$PWD/QuickTool/QuickTool.cpp \ $$PWD/QuickTool/QuickTool.cpp \
$$PWD/TaoModel/TaoListItemBase.cpp \
$$PWD/TaoModel/TaoListModel.cpp \
$$PWD/Thread/ThreadPool.cpp \ $$PWD/Thread/ThreadPool.cpp \
$$PWD/Trans/Trans.cpp $$PWD/Trans/Trans.cpp

View File

@ -0,0 +1,8 @@
#include "TaoListItemBase.h"
TaoListItemBase::TaoListItemBase(QObject *parent)
: QObject(parent)
{
}
TaoListItemBase::~TaoListItemBase() {}

View File

@ -2,7 +2,7 @@
#include <QObject> #include <QObject>
#include "TaoCommonGlobal.h" #include "TaoCommonGlobal.h"
class TAO_API QuickItemBase : public QObject class TAO_API TaoListItemBase : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isChecked READ isChecked WRITE setIsChecked NOTIFY isCheckedChanged) Q_PROPERTY(bool isChecked READ isChecked WRITE setIsChecked NOTIFY isCheckedChanged)
@ -10,8 +10,8 @@ class TAO_API QuickItemBase : public QObject
Q_PROPERTY(bool isVisible READ isVisible WRITE setIsVisible NOTIFY isVisibleChanged) Q_PROPERTY(bool isVisible READ isVisible WRITE setIsVisible NOTIFY isVisibleChanged)
Q_PROPERTY(bool isAlternate READ isAlternate WRITE setIsAlternate NOTIFY isAlternateChanged) Q_PROPERTY(bool isAlternate READ isAlternate WRITE setIsAlternate NOTIFY isAlternateChanged)
public: public:
explicit QuickItemBase(QObject *parent = nullptr); explicit TaoListItemBase(QObject *parent = nullptr);
~QuickItemBase() override; ~TaoListItemBase() override;
bool isChecked() const bool isChecked() const
{ {
return mIsChecked; return mIsChecked;

View File

@ -1,26 +1,26 @@
#include "QuickListModel.h" #include "TaoListModel.h"
#include "QuickItemBase.h"
#include <algorithm> #include <algorithm>
QuickListModel::QuickListModel(QObject *parent) TaoListModel::TaoListModel(QObject *parent)
: QuickListModelBase(parent) : TaoListModelBase(parent)
{ {
} }
QuickListModel::~QuickListModel() TaoListModel::~TaoListModel()
{ {
} }
void QuickListModel::check(int row, bool checked) void TaoListModel::check(int row, bool checked)
{ {
if (row < 0 || row >= mObjs.size()) if (row < 0 || row >= mDatas.size())
{ {
return; return;
} }
mObjs.at(row)->setIsChecked(checked); mDatas.at(row)->setIsChecked(checked);
if (mObjs.at(row)->isSelected()) if (mDatas.at(row)->isSelected())
{ {
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (obj->isVisible() && obj->isSelected()) if (obj->isVisible() && obj->isSelected())
{ {
@ -30,13 +30,13 @@ void QuickListModel::check(int row, bool checked)
} }
bool allCheck = true; bool allCheck = true;
if (checked == false || mObjs.count() <= 0) if (checked == false || mDatas.count() <= 0)
{ {
allCheck = false; allCheck = false;
} }
else else
{ {
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (obj->isVisible() && false == obj->isChecked()) if (obj->isVisible() && false == obj->isChecked())
{ {
@ -52,9 +52,9 @@ void QuickListModel::check(int row, bool checked)
} }
updateCheckedCount(); updateCheckedCount();
} }
void QuickListModel::setAllChecked(bool allChecked) void TaoListModel::setAllChecked(bool allChecked)
{ {
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (obj->isVisible()) if (obj->isVisible())
{ {
@ -68,10 +68,10 @@ void QuickListModel::setAllChecked(bool allChecked)
mAllChecked = allChecked; mAllChecked = allChecked;
emit allCheckedChanged(mAllChecked); emit allCheckedChanged(mAllChecked);
} }
void QuickListModel::search(const QString &searchKey) void TaoListModel::search(const QString &searchKey)
{ {
mSearchkey = searchKey.simplified(); mSearchkey = searchKey.simplified();
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (mVisibleCallback && false == mVisibleCallback(obj)) if (mVisibleCallback && false == mVisibleCallback(obj))
{ {
@ -92,9 +92,9 @@ void QuickListModel::search(const QString &searchKey)
updateCalcInfo(); updateCalcInfo();
} }
void QuickListModel::deselectAll() void TaoListModel::deselectAll()
{ {
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (obj->isVisible()) if (obj->isVisible())
{ {
@ -104,9 +104,9 @@ void QuickListModel::deselectAll()
updateSelectedCount(); updateSelectedCount();
} }
void QuickListModel::selectAll() void TaoListModel::selectAll()
{ {
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (obj->isVisible()) if (obj->isVisible())
{ {
@ -116,63 +116,63 @@ void QuickListModel::selectAll()
updateSelectedCount(); updateSelectedCount();
} }
bool QuickListModel::isSelected(int row) const bool TaoListModel::isSelected(int row) const
{ {
if (row < 0 || row >= mObjs.size()) if (row < 0 || row >= mDatas.size())
{ {
return false; return false;
} }
return mObjs.at(row)->isSelected(); return mDatas.at(row)->isSelected();
} }
void QuickListModel::select(int row) void TaoListModel::select(int row)
{ {
if (row < 0 || row >= mObjs.size()) if (row < 0 || row >= mDatas.size())
{ {
return; return;
} }
mObjs.at(row)->setIsSelected(true); mDatas.at(row)->setIsSelected(true);
updateSelectedCount(); updateSelectedCount();
} }
void QuickListModel::deselect(int row) void TaoListModel::deselect(int row)
{ {
if (row < 0 || row >= mObjs.size()) if (row < 0 || row >= mDatas.size())
{ {
return; return;
} }
mObjs.at(row)->setIsSelected(false); mDatas.at(row)->setIsSelected(false);
updateSelectedCount(); updateSelectedCount();
} }
void QuickListModel::selectRange(int from, int to) void TaoListModel::selectRange(int from, int to)
{ {
int minRow = qMin(from, to); int minRow = qMin(from, to);
int maxRow = qMax(from, to); int maxRow = qMax(from, to);
for (int i = 0; i < mObjs.size(); ++i) for (int i = 0; i < mDatas.size(); ++i)
{ {
mObjs.at(i)->setIsSelected(mObjs.at(i)->isVisible() && minRow <= i && i <= maxRow); mDatas.at(i)->setIsSelected(mDatas.at(i)->isVisible() && minRow <= i && i <= maxRow);
} }
updateSelectedCount(); updateSelectedCount();
} }
void QuickListModel::selectSingle(int row) void TaoListModel::selectSingle(int row)
{ {
for (int i = 0; i < mObjs.size(); ++i) for (int i = 0; i < mDatas.size(); ++i)
{ {
mObjs.at(i)->setIsSelected(i == row); mDatas.at(i)->setIsSelected(i == row);
} }
updateSelectedCount(); updateSelectedCount();
} }
void QuickListModel::doPress(int row, bool shift, bool ctrl, bool outRange) void TaoListModel::doPress(int row, bool shift, bool ctrl, bool outRange)
{ {
if (outRange) if (outRange)
{ {
row = mObjs.size(); row = mDatas.size();
} }
else else
{ {
if (row < 0 || row >= mObjs.size()) if (row < 0 || row >= mDatas.size())
{ {
return; return;
} }
@ -193,16 +193,16 @@ void QuickListModel::doPress(int row, bool shift, bool ctrl, bool outRange)
selectSingle(mLastPressedRow); selectSingle(mLastPressedRow);
} }
} }
void QuickListModel::doMove(int row, bool outRange) void TaoListModel::doMove(int row, bool outRange)
{ {
if (outRange) if (outRange)
{ {
row = mObjs.size(); row = mDatas.size();
} }
else else
{ {
if (row < 0 || row >= mObjs.size()) if (row < 0 || row >= mDatas.size())
{ {
return; return;
} }
@ -211,37 +211,37 @@ void QuickListModel::doMove(int row, bool outRange)
selectRange(mLastPressedRow, row); selectRange(mLastPressedRow, row);
} }
} }
void QuickListModel::doRelease() void TaoListModel::doRelease()
{ {
mIsPressed = false; mIsPressed = false;
} }
void QuickListModel::sortByRole() void TaoListModel::sortByRole()
{ {
const static auto addRessStr = QStringLiteral("address"); const static auto addRessStr = QStringLiteral("address");
if (mObjs.isEmpty()) if (mDatas.isEmpty())
{ {
return; return;
} }
const auto &addressCallback = mSortCallbacks.value(addRessStr); const auto &addressCallback = mSortCallbacks.value(addRessStr);
QList<QuickItemBase *> copyObjs; QList<TaoListItemBase *> copyObjs;
if (mSortRole == addRessStr) if (mSortRole == addRessStr)
{ {
if (addressCallback) if (addressCallback)
{ {
copyObjs = mObjs; copyObjs = mDatas;
if (mSortOrder == Qt::SortOrder::AscendingOrder) if (mSortOrder == Qt::SortOrder::AscendingOrder)
{ {
std::sort(copyObjs.begin(), copyObjs.end(), addressCallback); std::sort(copyObjs.begin(), copyObjs.end(), addressCallback);
} }
else else
{ {
std::sort(copyObjs.begin(), copyObjs.end(), [=](QuickItemBase *obj1, QuickItemBase *obj2) -> bool { return addressCallback(obj2, obj1); }); std::sort(copyObjs.begin(), copyObjs.end(), [=](TaoListItemBase *obj1, TaoListItemBase *obj2) -> bool { return addressCallback(obj2, obj1); });
} }
beginResetModel(); beginResetModel();
mObjs = copyObjs; mDatas = copyObjs;
endResetModel(); endResetModel();
} }
} }
@ -249,21 +249,21 @@ void QuickListModel::sortByRole()
{ {
if (addressCallback) if (addressCallback)
{ {
copyObjs = mObjs; copyObjs = mDatas;
if (mSortOrder == Qt::SortOrder::AscendingOrder) if (mSortOrder == Qt::SortOrder::AscendingOrder)
{ {
std::sort(copyObjs.begin(), copyObjs.end(), addressCallback); std::sort(copyObjs.begin(), copyObjs.end(), addressCallback);
} }
else else
{ {
std::sort(copyObjs.begin(), copyObjs.end(), [=](QuickItemBase *obj1, QuickItemBase *obj2) -> bool { return addressCallback(obj2, obj1); }); std::sort(copyObjs.begin(), copyObjs.end(), [=](TaoListItemBase *obj1, TaoListItemBase *obj2) -> bool { return addressCallback(obj2, obj1); });
} }
} }
if (mSortCallbacks.value(mSortRole)) if (mSortCallbacks.value(mSortRole))
{ {
if (copyObjs.isEmpty()) if (copyObjs.isEmpty())
{ {
copyObjs = mObjs; copyObjs = mDatas;
} }
if (mSortOrder == Qt::SortOrder::AscendingOrder) if (mSortOrder == Qt::SortOrder::AscendingOrder)
{ {
@ -271,19 +271,19 @@ void QuickListModel::sortByRole()
} }
else else
{ {
std::sort(copyObjs.begin(), copyObjs.end(), [=](QuickItemBase *obj1, QuickItemBase *obj2) -> bool { std::sort(copyObjs.begin(), copyObjs.end(), [=](TaoListItemBase *obj1, TaoListItemBase *obj2) -> bool {
return mSortCallbacks.value(mSortRole)(obj2, obj1); return mSortCallbacks.value(mSortRole)(obj2, obj1);
}); });
} }
beginResetModel(); beginResetModel();
mObjs = copyObjs; mDatas = copyObjs;
endResetModel(); endResetModel();
} }
} }
updateAlternate(); updateAlternate();
} }
void QuickListModel::setHeaderRoles(const QStringList &headerRoles) void TaoListModel::setHeaderRoles(const QStringList &headerRoles)
{ {
if (mHeaderRoles == headerRoles) if (mHeaderRoles == headerRoles)
return; return;
@ -292,7 +292,7 @@ void QuickListModel::setHeaderRoles(const QStringList &headerRoles)
emit headerRolesChanged(mHeaderRoles); emit headerRolesChanged(mHeaderRoles);
} }
void QuickListModel::setSortOrder(Qt::SortOrder sortOrder) void TaoListModel::setSortOrder(Qt::SortOrder sortOrder)
{ {
if (mSortOrder == sortOrder) if (mSortOrder == sortOrder)
return; return;
@ -301,7 +301,7 @@ void QuickListModel::setSortOrder(Qt::SortOrder sortOrder)
emit sortOrderChanged(mSortOrder); emit sortOrderChanged(mSortOrder);
} }
void QuickListModel::setSortRole(const QString &sortRole) void TaoListModel::setSortRole(const QString &sortRole)
{ {
if (mSortRole == sortRole) if (mSortRole == sortRole)
return; return;
@ -310,11 +310,11 @@ void QuickListModel::setSortRole(const QString &sortRole)
emit sortRoleChanged(mSortRole); emit sortRoleChanged(mSortRole);
} }
void QuickListModel::updateAllCheck() void TaoListModel::updateAllCheck()
{ {
bool allCheck = true; bool allCheck = true;
if (!mObjs.empty()) { if (!mDatas.empty()) {
allCheck = std::all_of(mObjs.begin(), mObjs.end(), [](QuickItemBase *obj){ allCheck = std::all_of(mDatas.begin(), mDatas.end(), [](TaoListItemBase *obj){
return obj->isVisible() && obj->isChecked(); return obj->isVisible() && obj->isChecked();
}); });
} }
@ -325,33 +325,33 @@ void QuickListModel::updateAllCheck()
emit allCheckedChanged(mAllChecked); emit allCheckedChanged(mAllChecked);
} }
void QuickListModel::updateVisibleCount() void TaoListModel::updateVisibleCount()
{ {
int count = std::count_if(mObjs.begin(), mObjs.end(), [](QuickItemBase *obj){ int count = std::count_if(mDatas.begin(), mDatas.end(), [](TaoListItemBase *obj){
return obj->isVisible(); return obj->isVisible();
}); });
setVisibledCount(count); setVisibledCount(count);
} }
void QuickListModel::updateSelectedCount() void TaoListModel::updateSelectedCount()
{ {
int count = std::count_if(mObjs.begin(), mObjs.end(), [](QuickItemBase *obj){ int count = std::count_if(mDatas.begin(), mDatas.end(), [](TaoListItemBase *obj){
return obj->isVisible() && obj->isSelected(); return obj->isVisible() && obj->isSelected();
}); });
setSelectedCount(count); setSelectedCount(count);
} }
void QuickListModel::updateCheckedCount() void TaoListModel::updateCheckedCount()
{ {
int count = std::count_if(mObjs.begin(), mObjs.end(), [](QuickItemBase *obj){ int count = std::count_if(mDatas.begin(), mDatas.end(), [](TaoListItemBase *obj){
return obj->isVisible() && obj->isChecked(); return obj->isVisible() && obj->isChecked();
}); });
setCheckedCount(count); setCheckedCount(count);
} }
void QuickListModel::updateAlternate() void TaoListModel::updateAlternate()
{ {
bool alter = false; bool alter = false;
for (const auto &obj : mObjs) for (const auto &obj : mDatas)
{ {
if (obj->isVisible()) if (obj->isVisible())
{ {
@ -360,7 +360,7 @@ void QuickListModel::updateAlternate()
} }
} }
} }
void QuickListModel::setVisibledCount(int visibledCount) void TaoListModel::setVisibledCount(int visibledCount)
{ {
if (mVisibledCount == visibledCount) if (mVisibledCount == visibledCount)
return; return;
@ -369,7 +369,7 @@ void QuickListModel::setVisibledCount(int visibledCount)
emit visibledCountChanged(mVisibledCount); emit visibledCountChanged(mVisibledCount);
} }
void QuickListModel::setSelectedCount(int selectedCount) void TaoListModel::setSelectedCount(int selectedCount)
{ {
if (mSelectedCount == selectedCount) if (mSelectedCount == selectedCount)
return; return;
@ -378,7 +378,7 @@ void QuickListModel::setSelectedCount(int selectedCount)
emit selectedCountChanged(mSelectedCount); emit selectedCountChanged(mSelectedCount);
} }
void QuickListModel::setCheckedCount(int checkedCount) void TaoListModel::setCheckedCount(int checkedCount)
{ {
if (mCheckedCount == checkedCount) if (mCheckedCount == checkedCount)
return; return;
@ -387,7 +387,7 @@ void QuickListModel::setCheckedCount(int checkedCount)
emit checkedCountChanged(mCheckedCount); emit checkedCountChanged(mCheckedCount);
} }
void QuickListModel::updateCalcInfo() void TaoListModel::updateCalcInfo()
{ {
updateAllCheck(); updateAllCheck();
updateCheckedCount(); updateCheckedCount();

View File

@ -1,8 +1,9 @@
#pragma once #pragma once
#include "QuickListModelBase.h" #include "TaoListModelBase.hpp"
#include "TaoListItemBase.h"
#include "TaoCommonGlobal.h" #include "TaoCommonGlobal.h"
class TAO_API QuickListModel : public QuickListModelBase class TAO_API TaoListModel : public TaoListModelBase<TaoListItemBase *>
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool allChecked READ allChecked WRITE setAllChecked NOTIFY allCheckedChanged) Q_PROPERTY(bool allChecked READ allChecked WRITE setAllChecked NOTIFY allCheckedChanged)
@ -15,8 +16,8 @@ class TAO_API QuickListModel : public QuickListModelBase
Q_PROPERTY(QString sortRole READ sortRole WRITE setSortRole NOTIFY sortRoleChanged) Q_PROPERTY(QString sortRole READ sortRole WRITE setSortRole NOTIFY sortRoleChanged)
public: public:
explicit QuickListModel(QObject *parent = nullptr); explicit TaoListModel(QObject *parent = nullptr);
~QuickListModel() override; ~TaoListModel() override;
//[begin] check //[begin] check
bool allChecked() const bool allChecked() const
@ -29,7 +30,7 @@ public:
//[begin] search. control visible //[begin] search. control visible
Q_INVOKABLE void search(const QString &searchKey); Q_INVOKABLE void search(const QString &searchKey);
//控制显示隐藏的回调。返回true则show返回false则hide //控制显示隐藏的回调。返回true则show返回false则hide
using VisibleCallback = std::function<bool(QuickItemBase *)>; using VisibleCallback = std::function<bool(TaoListItemBase *)>;
void setVisibleFilter(const VisibleCallback &callback) void setVisibleFilter(const VisibleCallback &callback)
{ {
mVisibleCallback = callback; mVisibleCallback = callback;
@ -65,7 +66,7 @@ public:
{ {
return mSortRole; return mSortRole;
} }
using SortCallback = std::function<bool(QuickItemBase *, QuickItemBase *)>; using SortCallback = std::function<bool(TaoListItemBase *, TaoListItemBase *)>;
//Map <key, callBack> ,key should match to headerRoles //Map <key, callBack> ,key should match to headerRoles
void setSortCallbacks(const QMap<QString, SortCallback> &callbacksMap) void setSortCallbacks(const QMap<QString, SortCallback> &callbacksMap)
{ {

View File

@ -16,14 +16,17 @@ Item {
width: 600 width: 600
height: 300 height: 300
border.color: "lightblue" border.color: "lightblue"
color: CusConfig.backgroundColor
Rectangle { Rectangle {
x: 10 x: 10
y: 40 y: 40
width: 100 width: 100
height: 100 height: 100
border.color: "red" border.color: "red"
color: CusConfig.themeColor
smooth: true smooth: true
antialiasing: true antialiasing: true
MoveArea { MoveArea {
anchors.fill: parent anchors.fill: parent
onMove: { onMove: {
@ -38,6 +41,7 @@ Item {
width: 200 width: 200
height: 160 height: 160
border.color: "red" border.color: "red"
color: CusConfig.backgroundColor
smooth: true smooth: true
antialiasing: true antialiasing: true
CusTemplateDragBorder { CusTemplateDragBorder {
@ -57,7 +61,7 @@ Item {
width: 600 width: 600
height: 300 height: 300
border.color: "lightblue" border.color: "lightblue"
color: CusConfig.backgroundColor
CusRectDraw { CusRectDraw {
anchors.fill: parent anchors.fill: parent
} }

View File

@ -36,6 +36,20 @@ Item {
} }
placeholderText: qsTr("Search") + trans.transString placeholderText: qsTr("Search") + trans.transString
} }
Rectangle {
border.color: CusConfig.controlBorderColor
color: CusConfig.backgroundColor
anchors {
left: cusHeader.left
leftMargin: -1
right: cusHeader.right
rightMargin: -1
top: cusHeader.top
topMargin: -1
bottom: cusView.bottom
bottomMargin: -1
}
}
CusTableHeader { CusTableHeader {
id: cusHeader id: cusHeader
y: 50 y: 50

View File

@ -14,7 +14,7 @@ CusButton {
background: Rectangle { background: Rectangle {
width: expandBtn.width width: expandBtn.width
height: expandBtn.height height: expandBtn.height
color: expandBtn.pressed ? CusConfig.controlBorderColor_pressed : (expandBtn.hovered ? CusConfig.controlBorderColor_hovered : CusConfig.controlBorderColor) color: expandBtn.pressed ? CusConfig.controlBorderColor_pressed : (expandBtn.hovered ? CusConfig.controlBorderColor_hovered : CusConfig.controlColor)
radius: 2 radius: 2
CusImage { CusImage {
source: imgPath + "Button/expand.png" source: imgPath + "Button/expand.png"

View File

@ -70,7 +70,7 @@ Item {
name: "Content Pane" name: "Content Pane"
descript: "show current selected content by list" descript: "show current selected content by list"
targetObjectName: "contentRect" targetObjectName: "contentRect"
arrowType: Qt.LeftArrow arrowType: Qt.RightArrow
} }
ListElement { ListElement {
name: "Tool Buttons" name: "Tool Buttons"

View File

@ -73,10 +73,9 @@ Item {
noDataText: qsTr("No Data") + trans.transString noDataText: qsTr("No Data") + trans.transString
section.property: "group" section.property: "group"
section.delegate: Rectangle { section.delegate: Item {
width: listView.width width: listView.width
height: CusConfig.fixedHeight height: CusConfig.fixedHeight
opacity: 0.8
ExpandBtn { ExpandBtn {
id: sectionBtn id: sectionBtn
text: qsTr(section) + trans.transString text: qsTr(section) + trans.transString

View File

@ -1,6 +1,6 @@
#include "DeviceAddItem.h" #include "DeviceAddItem.h"
DeviceAddItem::DeviceAddItem(QObject *parent) DeviceAddItem::DeviceAddItem(QObject *parent)
: QuickItemBase(parent) : TaoListItemBase(parent)
{ {
} }

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "QuickModel/QuickItemBase.h" #include "TaoModel/TaoListItemBase.h"
#include <QObject> #include <QObject>
class DeviceAddItem : public QuickItemBase class DeviceAddItem : public TaoListItemBase
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)

View File

@ -2,9 +2,9 @@
#include "DeviceAddItem.h" #include "DeviceAddItem.h"
#include <QHostAddress> #include <QHostAddress>
DeviceAddModel::DeviceAddModel(QObject *parent) DeviceAddModel::DeviceAddModel(QObject *parent)
: QuickListModel(parent) : TaoListModel(parent)
{ {
QList<QuickItemBase *> objs; QList<TaoListItemBase *> objs;
for (int i = 0; i < 20; ++i) { for (int i = 0; i < 20; ++i) {
auto item = new DeviceAddItem; auto item = new DeviceAddItem;
item->setOnline(i % 7 == 0); item->setOnline(i % 7 == 0);
@ -17,13 +17,13 @@ DeviceAddModel::DeviceAddModel(QObject *parent)
setHeaderRoles({ "name", "address", "modelString" }); setHeaderRoles({ "name", "address", "modelString" });
QMap<QString, SortCallback> callBacks; QMap<QString, SortCallback> callBacks;
callBacks["name"] callBacks["name"]
= [](QuickItemBase *b1, QuickItemBase *b2) -> bool { return (static_cast<DeviceAddItem *>(b1))->name() < (static_cast<DeviceAddItem *>(b2))->name(); }; = [](TaoListItemBase *b1, TaoListItemBase *b2) -> bool { return (static_cast<DeviceAddItem *>(b1))->name() < (static_cast<DeviceAddItem *>(b2))->name(); };
callBacks["address"] = [](QuickItemBase *b1, QuickItemBase *b2) -> bool { callBacks["address"] = [](TaoListItemBase *b1, TaoListItemBase *b2) -> bool {
QHostAddress add1(static_cast<DeviceAddItem *>(b1)->address()); QHostAddress add1(static_cast<DeviceAddItem *>(b1)->address());
QHostAddress add2(static_cast<DeviceAddItem *>(b2)->address()); QHostAddress add2(static_cast<DeviceAddItem *>(b2)->address());
return add1.toIPv4Address() < add2.toIPv4Address(); return add1.toIPv4Address() < add2.toIPv4Address();
}; };
callBacks["modelString"] = [](QuickItemBase *b1, QuickItemBase *b2) -> bool { callBacks["modelString"] = [](TaoListItemBase *b1, TaoListItemBase *b2) -> bool {
const QString &s1 = static_cast<DeviceAddItem *>(b1)->modelString(); const QString &s1 = static_cast<DeviceAddItem *>(b1)->modelString();
const QString &s2 = static_cast<DeviceAddItem *>(b2)->modelString(); const QString &s2 = static_cast<DeviceAddItem *>(b2)->modelString();
auto m1 = s1.mid(6, s1.length() - 6).toInt(); auto m1 = s1.mid(6, s1.length() - 6).toInt();
@ -44,5 +44,5 @@ void DeviceAddModel::doUpdateName(int row, const QString &name)
{ {
return; return;
} }
static_cast<DeviceAddItem *>(mObjs.at(row))->setName(name); static_cast<DeviceAddItem *>(mDatas.at(row))->setName(name);
} }

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <QObject> #include <QObject>
#include "QuickModel/QuickListModel.h" #include "TaoModel/TaoListModel.h"
class DeviceAddModel : public QuickListModel class DeviceAddModel : public TaoListModel
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -1,8 +1,5 @@
#一部分头文件加入编译预处理,提高编译速度 #一部分头文件加入编译预处理,提高编译速度
msvc | gcc | xcode { PRECOMPILED_HEADER = $$PWD/Src/stdafx.h
CONFIG += precompile_header
PRECOMPILED_HEADER = $$PWD/Src/stdafx.h
}
HEADERS += \ HEADERS += \
$$PWD/Src/AppInfo.h \ $$PWD/Src/AppInfo.h \

View File

@ -5,10 +5,10 @@ import "../.."
Switch { Switch {
id: cusSwitch id: cusSwitch
property color backgroundColor_on :"#579ee5" property color backgroundColor_on : CusConfig.themeColor
property color indicatorColor_on: "#ffffff" property color indicatorColor_on: "#ffffff"
property color backgroundColor_on_disable: "#108bcb" property color backgroundColor_on_disable: Qt.darker(backgroundColor_on, 1.2)
property color indicatorColor_on_disable: "#b6bdc5" property color indicatorColor_on_disable: "#b6bdc5"
property color backgroundColor_off :"#808080" property color backgroundColor_off :"#808080"

View File

@ -95,8 +95,11 @@ ComboBox {
model: cusComboBox.popup.visible ? cusComboBox.delegateModel : null model: cusComboBox.popup.visible ? cusComboBox.delegateModel : null
currentIndex: cusComboBox.highlightedIndex currentIndex: cusComboBox.highlightedIndex
ScrollBar.vertical: CusScrollBar { ScrollBar.vertical: CusScrollBar {
policy: (cusComboBox.popup.height // policy: (cusComboBox.popup.height
>= cusComboBox.defaultHeight) ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded // >= cusComboBox.defaultHeight) ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
opacity: cusComboBox.popup.height >= cusComboBox.defaultHeight ? 1.0 : 0.0
visible: opacity > 0
active: visible
} }
} }
@ -128,8 +131,8 @@ ComboBox {
Rectangle { Rectangle {
anchors { anchors {
fill: parent fill: parent
leftMargin: 4 leftMargin: 2
rightMargin: 14 rightMargin: 16
} }
radius: CusConfig.controlBorderRadius radius: CusConfig.controlBorderRadius
color: cusComboBox.hoveredIndex === index ? CusConfig.controlColor_hovered : (cusComboBox.currentIndex === index ? CusConfig.controlColor_pressed : CusConfig.controlColor) color: cusComboBox.hoveredIndex === index ? CusConfig.controlColor_hovered : (cusComboBox.currentIndex === index ? CusConfig.controlColor_pressed : CusConfig.controlColor)

View File

@ -54,7 +54,7 @@ QtObject {
property color controlBorderColor_hovered: Qt.darker(themeColor, 1.2) property color controlBorderColor_hovered: Qt.darker(themeColor, 1.2)
property color controlBorderColor_pressed: Qt.darker(themeColor, 1.4) property color controlBorderColor_pressed: Qt.darker(themeColor, 1.4)
property color controlColor: Qt.darker(backgroundColor, 1.2) property color controlColor
property color controlColor_hovered: Qt.darker(themeColor, 1.2) property color controlColor_hovered: Qt.darker(themeColor, 1.2)
property color controlColor_pressed: Qt.darker(themeColor, 1.4) property color controlColor_pressed: Qt.darker(themeColor, 1.4)
property color controlColor_disabled: Qt.lighter(controlColor, 2.0) property color controlColor_disabled: Qt.lighter(controlColor, 2.0)
@ -95,7 +95,7 @@ QtObject {
textColor_disabled = t.textColor_disabled textColor_disabled = t.textColor_disabled
textColor_hovered = t.textColor_hovered textColor_hovered = t.textColor_hovered
textColor_pressed = t.textColor_pressed textColor_pressed = t.textColor_pressed
controlColor = t.controlColor
controlBorderColor = t.controlBorderColor controlBorderColor = t.controlBorderColor
imageColor = t.imageColor imageColor = t.imageColor
imageColor_disabled = t.imageColor_disabled imageColor_disabled = t.imageColor_disabled
@ -120,6 +120,7 @@ QtObject {
textColor_hovered: "#686868" textColor_hovered: "#686868"
textColor_pressed: "#212121" textColor_pressed: "#212121"
controlColor: "#f5f5f6"
controlBorderColor: "#cbcbcb" controlBorderColor: "#cbcbcb"
imageColor: "#373737" imageColor: "#373737"
imageColor_disabled: "#9f9fcf" imageColor_disabled: "#9f9fcf"
@ -129,32 +130,32 @@ QtObject {
ListElement { ListElement {
name: "Black" name: "Black"
themeColor: "#222225" themeColor: "#222225"
backgroundColor: "#272c25" backgroundColor: "#2b2b2b"
textColor: "#adafb2" textColor: "#d0d0d0"
splitLineColor:"#c62f2f" splitLineColor:"#2d2d30"
invalidColor: "#e29696" invalidColor: "#782c2c"
alterColor: "#6a6a6b" alterColor: "#383838"
tipBackgroundColor: "#ffffff" tipBackgroundColor: "#ffffff"
tipBorderColor: "#767676" tipBorderColor: "#767676"
textColor_disabled: "#9f9fcf" textColor_disabled: "#877a66"
textColor_hovered: "#181818" textColor_hovered: "#ffffff"
textColor_pressed: "#000000" textColor_pressed: "#d2d2d2"
controlColor: "#333333"
controlBorderColor: "#cbcbcb" controlBorderColor: "#555555"
imageColor: "#373737" imageColor: "#adafb2"
imageColor_disabled: "#9f9fcf" imageColor_disabled: "#989898"
scrollBarBackgroundColor: "#e0e0e0" scrollBarBackgroundColor: "#3f3f3f"
scrollBarBackgroundColor_hovered: "#cfcfd1" scrollBarBackgroundColor_hovered: "#4a4a4a"
} }
ListElement { ListElement {
name: "Pink" name: "Pink"
themeColor: "#faa0c5" themeColor: "#faa0c5"
backgroundColor: "#f6f6f6" backgroundColor: "#ffffff"
textColor: "#5c5c5c" textColor: "#5c5c5c"
splitLineColor:"#c62f2f" splitLineColor:"#fbb8d0"
invalidColor: "#e29696" invalidColor: "#e29696"
alterColor: "#8a8a9b" alterColor: "#8a8a9b"
tipBackgroundColor: "#ffffff" tipBackgroundColor: "#ffffff"
@ -163,7 +164,7 @@ QtObject {
textColor_disabled: "#9f9fcf" textColor_disabled: "#9f9fcf"
textColor_hovered: "#181818" textColor_hovered: "#181818"
textColor_pressed: "#000000" textColor_pressed: "#000000"
controlColor: "#f5f5f6"
controlBorderColor: "#cbcbcb" controlBorderColor: "#cbcbcb"
imageColor: "#373737" imageColor: "#373737"
imageColor_disabled: "#9f9fcf" imageColor_disabled: "#9f9fcf"
@ -173,10 +174,10 @@ QtObject {
ListElement { ListElement {
name: "Gold" name: "Gold"
themeColor: "#fed98f" themeColor: "#fed98f"
backgroundColor: "#f6f6f6" backgroundColor: "#ffffff"
textColor: "#5c5c5c" textColor: "#5c5c5c"
splitLineColor:"#c62f2f" splitLineColor:"#f0c896"
invalidColor: "#e29696" invalidColor: "#e29696"
alterColor: "#8a8a9b" alterColor: "#8a8a9b"
tipBackgroundColor: "#ffffff" tipBackgroundColor: "#ffffff"
@ -185,7 +186,7 @@ QtObject {
textColor_disabled: "#9f9fcf" textColor_disabled: "#9f9fcf"
textColor_hovered: "#181818" textColor_hovered: "#181818"
textColor_pressed: "#000000" textColor_pressed: "#000000"
controlColor: "#f5f5f6"
controlBorderColor: "#cbcbcb" controlBorderColor: "#cbcbcb"
imageColor: "#373737" imageColor: "#373737"
imageColor_disabled: "#9f9fcf" imageColor_disabled: "#9f9fcf"
@ -195,10 +196,10 @@ QtObject {
ListElement { ListElement {
name: "Green" name: "Green"
themeColor: "#58c979" themeColor: "#58c979"
backgroundColor: "#f6f6f6" backgroundColor: "#ffffff"
textColor: "#5c5c5c" textColor: "#5c5c5c"
splitLineColor:"#c62f2f" splitLineColor:"#89d3ad"
invalidColor: "#e29696" invalidColor: "#e29696"
alterColor: "#8a8a9b" alterColor: "#8a8a9b"
tipBackgroundColor: "#ffffff" tipBackgroundColor: "#ffffff"
@ -207,7 +208,7 @@ QtObject {
textColor_disabled: "#9f9fcf" textColor_disabled: "#9f9fcf"
textColor_hovered: "#181818" textColor_hovered: "#181818"
textColor_pressed: "#000000" textColor_pressed: "#000000"
controlColor: "#f5f5f6"
controlBorderColor: "#cbcbcb" controlBorderColor: "#cbcbcb"
imageColor: "#373737" imageColor: "#373737"
imageColor_disabled: "#9f9fcf" imageColor_disabled: "#9f9fcf"
@ -217,10 +218,10 @@ QtObject {
ListElement { ListElement {
name: "Blue" name: "Blue"
themeColor: "#67c1fd" themeColor: "#67c1fd"
backgroundColor: "#f6f6f6" backgroundColor: "#ffffff"
textColor: "#5c5c5c" textColor: "#5c5c5c"
splitLineColor:"#c62f2f" splitLineColor:"#92cefc"
invalidColor: "#e29696" invalidColor: "#e29696"
alterColor: "#8a8a9b" alterColor: "#8a8a9b"
tipBackgroundColor: "#ffffff" tipBackgroundColor: "#ffffff"
@ -229,7 +230,7 @@ QtObject {
textColor_disabled: "#9f9fcf" textColor_disabled: "#9f9fcf"
textColor_hovered: "#181818" textColor_hovered: "#181818"
textColor_pressed: "#000000" textColor_pressed: "#000000"
controlColor: "#f5f5f6"
controlBorderColor: "#cbcbcb" controlBorderColor: "#cbcbcb"
imageColor: "#373737" imageColor: "#373737"
imageColor_disabled: "#9f9fcf" imageColor_disabled: "#9f9fcf"

View File

@ -0,0 +1,22 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
Item {
property alias source: srcImg.source
property alias color: overlayImg.color
Image {
id: srcImg
anchors.fill: parent
visible: false
}
ColorOverlay {
id: overlayImg
source: srcImg
anchors.fill: srcImg
width: srcImg.width
height: srcImg.height
}
}

View File

@ -118,11 +118,13 @@ Item {
color: (moveArea.pressed color: (moveArea.pressed
|| moveArea.containsMouse) ? CusConfig.controlBorderColor_pressed : CusConfig.controlBorderColor || moveArea.containsMouse) ? CusConfig.controlBorderColor_pressed : CusConfig.controlBorderColor
} }
CusImage { CusImageOverlay {
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
top: parent.top top: parent.top
} }
width: 8
height: 8
readonly property string ascUrl: CusConfig.imagePathPrefix + "Table_Asc.png" readonly property string ascUrl: CusConfig.imagePathPrefix + "Table_Asc.png"
readonly property string ascUrl_Hovered: CusConfig.imagePathPrefix readonly property string ascUrl_Hovered: CusConfig.imagePathPrefix
+ "Table_Asc_Hovered.png" + "Table_Asc_Hovered.png"
@ -136,6 +138,7 @@ Item {
source: visible ? (dataObj.sortOrder === 0 ? ascImageUrl : descImageUrl) : "" source: visible ? (dataObj.sortOrder === 0 ? ascImageUrl : descImageUrl) : ""
visible: dataObj && dataObj.sortRole === headerRoles[index] visible: dataObj && dataObj.sortRole === headerRoles[index]
color: headerArea.containsMouse ? CusConfig.imageColor_hovered : CusConfig.imageColor
} }
MouseArea { MouseArea {
id: headerArea id: headerArea

View File

@ -110,7 +110,7 @@ ListView {
top: parent.top top: parent.top
topMargin: 10 topMargin: 10
} }
visible: cusTableView.count <= 0 visible: cusTableView.model.visibledCount <= 0
} }
CusRectDraw { CusRectDraw {
id: tableRectItem id: tableRectItem

View File

@ -4,7 +4,7 @@ import ".."
import "../.." import "../.."
CusResizeBorder { CusResizeBorder {
id: root id: cusBorder
x: 0 x: 0
y: 0 y: 0
width: parent.width width: parent.width
@ -16,18 +16,19 @@ CusResizeBorder {
property bool rotationEnabled: true property bool rotationEnabled: true
property color rotateHandleColor: "lightgreen" property color rotateHandleColor: "lightgreen"
property color color: CusConfig.themeColor
property color borderColor: CusConfig.controlBorderColor
signal clicked(real x, real y) signal clicked(real x, real y)
signal doubleClicked(real x, real y) signal doubleClicked(real x, real y)
//big //big
Rectangle { Rectangle {
border.color: CusConfig.controlBorderColor border.color: cusBorder.borderColor
border.width: 1 border.width: 1
color: "transparent" color: cusBorder.color
radius: borderMargin radius: borderMargin
anchors.fill: parent anchors.fill: parent
anchors.margins: borderMargin anchors.margins: borderMargin + 1
} }
//line to rotateHandle and Border //line to rotateHandle and Border
Rectangle { Rectangle {
@ -203,10 +204,10 @@ CusResizeBorder {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
drag.target: controller drag.target: controller
onClicked: { onClicked: {
root.clicked(x, y) cusBorder.clicked(x, y)
} }
onDoubleClicked: { onDoubleClicked: {
root.doubleClicked(x, y) cusBorder.doubleClicked(x, y)
} }
} }
} }

View File

@ -19,6 +19,7 @@
<file>Qml/CusCheckBox/CusSwitch.qml</file> <file>Qml/CusCheckBox/CusSwitch.qml</file>
<file>Qml/CusComboBox/CusComboBox.qml</file> <file>Qml/CusComboBox/CusComboBox.qml</file>
<file>Qml/CusImage/CusImage.qml</file> <file>Qml/CusImage/CusImage.qml</file>
<file>Qml/CusImage/CusImageOverlay.qml</file>
<file>Qml/CusImage/CusImage_Tip.qml</file> <file>Qml/CusImage/CusImage_Tip.qml</file>
<file>Qml/CusInput/CusIPAddress.qml</file> <file>Qml/CusInput/CusIPAddress.qml</file>
<file>Qml/CusInput/CusTextField.qml</file> <file>Qml/CusInput/CusTextField.qml</file>

View File

@ -237,6 +237,20 @@ MetaInfo {
Property { name: "height"; type: "int"; value: 80 } Property { name: "height"; type: "int"; value: 80 }
} }
} }
Type {
name: "TaoQuick.Qml.CusImage.CusImageOverlay"
icon: "images/CusImageOverlay.png"
ItemLibraryEntry {
name: "CusImageOverlay"
category: "TaoQuick - CusImage"
libraryIcon: "images/CusImageOverlay.png"
version: "1.0"
requiredImport: "TaoQuick"
Property { name: "width"; type: "int"; value: 120 }
Property { name: "height"; type: "int"; value: 80 }
}
}
Type { Type {
name: "TaoQuick.Qml.CusImage.CusImage_Tip" name: "TaoQuick.Qml.CusImage.CusImage_Tip"
icon: "images/CusImage_Tip.png" icon: "images/CusImage_Tip.png"
@ -531,20 +545,6 @@ MetaInfo {
Property { name: "height"; type: "int"; value: 80 } Property { name: "height"; type: "int"; value: 80 }
} }
} }
Type {
name: "TaoQuick.Qml.CusWizard.CusWizardBackground"
icon: "images/CusWizardBackground.png"
ItemLibraryEntry {
name: "CusWizardBackground"
category: "TaoQuick - CusWizard"
libraryIcon: "images/CusWizardBackground.png"
version: "1.0"
requiredImport: "TaoQuick"
Property { name: "width"; type: "int"; value: 120 }
Property { name: "height"; type: "int"; value: 80 }
}
}
Type { Type {
name: "TaoQuick.Qml.CusWizard.CusWizardPage" name: "TaoQuick.Qml.CusWizard.CusWizardPage"
icon: "images/CusWizardPage.png" icon: "images/CusWizardPage.png"

View File

@ -16,6 +16,7 @@ CusCheckBox 1.0 Qml/CusCheckBox/CusCheckBox.qml
CusSwitch 1.0 Qml/CusCheckBox/CusSwitch.qml CusSwitch 1.0 Qml/CusCheckBox/CusSwitch.qml
CusComboBox 1.0 Qml/CusComboBox/CusComboBox.qml CusComboBox 1.0 Qml/CusComboBox/CusComboBox.qml
CusImage 1.0 Qml/CusImage/CusImage.qml CusImage 1.0 Qml/CusImage/CusImage.qml
CusImageOverlay 1.0 Qml/CusImage/CusImageOverlay.qml
CusImage_Tip 1.0 Qml/CusImage/CusImage_Tip.qml CusImage_Tip 1.0 Qml/CusImage/CusImage_Tip.qml
CusIPAddress 1.0 Qml/CusInput/CusIPAddress.qml CusIPAddress 1.0 Qml/CusInput/CusIPAddress.qml
CusTextField 1.0 Qml/CusInput/CusTextField.qml CusTextField 1.0 Qml/CusInput/CusTextField.qml