/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtpropertymanager.h"
#include "qtpropertybrowserutils_p.h"
#include <QtCore/QDateTime>
#include <QtCore/QLocale>
#include <QtCore/QMap>
#include <QtCore/QTimer>
#include <QtGui/QIcon>
#include <QtCore/QMetaEnum>
#include <QtGui/QFontDatabase>
#include <QtWidgets/QStyleOption>
#include <QtWidgets/QStyle>
#include <QtWidgets/QApplication>
#include <QtGui/QPainter>
#include <QtWidgets/QLabel>
#include <limits>
#include <limits.h>
#include <float.h>
#if defined(Q_CC_MSVC)
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
#endif
QT_BEGIN_NAMESPACE
template <class PrivateData, class Value>
static void setSimpleMinimumData(PrivateData *data, const Value &minVal)
{
data->minVal = minVal;
if (data->maxVal < data->minVal)
data->maxVal = data->minVal;
if (data->val < data->minVal)
data->val = data->minVal;
}
template <class PrivateData, class Value>
static void setSimpleMaximumData(PrivateData *data, const Value &maxVal)
{
data->maxVal = maxVal;
if (data->minVal > data->maxVal)
data->minVal = data->maxVal;
if (data->val > data->maxVal)
data->val = data->maxVal;
}
template <class PrivateData, class Value>
static void setSizeMinimumData(PrivateData *data, const Value &newMinVal)
{
data->minVal = newMinVal;
if (data->maxVal.width() < data->minVal.width())
data->maxVal.setWidth(data->minVal.width());
if (data->maxVal.height() < data->minVal.height())
data->maxVal.setHeight(data->minVal.height());
if (data->val.width() < data->minVal.width())
data->val.setWidth(data->minVal.width());
if (data->val.height() < data->minVal.height())
data->val.setHeight(data->minVal.height());
}
template <class PrivateData, class Value>
static void setSizeMaximumData(PrivateData *data, const Value &newMaxVal)
{
data->maxVal = newMaxVal;
if (data->minVal.width() > data->maxVal.width())
data->minVal.setWidth(data->maxVal.width());
if (data->minVal.height() > data->maxVal.height())
data->minVal.setHeight(data->maxVal.height());
if (data->val.width() > data->maxVal.width())
data->val.setWidth(data->maxVal.width());
if (data->val.height() > data->maxVal.height())
data->val.setHeight(data->maxVal.height());
}
template <class SizeValue>
static SizeValue qBoundSize(const SizeValue &minVal, const SizeValue &val, const SizeValue &maxVal)
{
SizeValue croppedVal = val;
if (minVal.width() > val.width())
croppedVal.setWidth(minVal.width());
else if (maxVal.width() < val.width())
croppedVal.setWidth(maxVal.width());
if (minVal.height() > val.height())
croppedVal.setHeight(minVal.height());
else if (maxVal.height() < val.height())
croppedVal.setHeight(maxVal.height());
return croppedVal;
}
// Match the exact signature of qBound for VS 6.
QSize qBound(QSize minVal, QSize val, QSize maxVal)
{
return qBoundSize(minVal, val, maxVal);
}
QSizeF qBound(QSizeF minVal, QSizeF val, QSizeF maxVal)
{
return qBoundSize(minVal, val, maxVal);
}
namespace {
namespace {
template <class Value>
void orderBorders(Value &minVal, Value &maxVal)
{
if (minVal > maxVal)
qSwap(minVal, maxVal);
}
template <class Value>
static void orderSizeBorders(Value &minVal, Value &maxVal)
{
Value fromSize = minVal;
Value toSize = maxVal;
if (fromSize.width() > toSize.width()) {
fromSize.setWidth(maxVal.width());
toSize.setWidth(minVal.width());
}
if (fromSize.height() > toSize.height()) {
fromSize.setHeight(maxVal.height());
toSize.setHeight(minVal.height());
}
minVal = fromSize;
maxVal = toSize;
}
void orderBorders(QSize &minVal, QSize &maxVal)
{
orderSizeBorders(minVal, maxVal);
}
void orderBorders(QSizeF &minVal, QSizeF &maxVal)
{
orderSizeBorders(minVal, maxVal);
}
}
}
////////
template <class Value, class PrivateData>
static Value getData(const QMap<const QtProperty *, PrivateData> &propertyMap,
Value PrivateData::*data,
const QtProperty *property, const Value &defaultValue = Value())
{
const auto it = propertyMap.constFind(property);
if (it == propertyMap.constEnd())
return defaultValue;
return it.value().*data;
}
template <class Value, class PrivateData>
static Value getValue(const QMap<const QtProperty *, PrivateData> &propertyMap,
const QtProperty *property, const Value &defaultValue = Value())
{
return getData<Value>(propertyMap, &PrivateData::val, property, defaultValue);
}
template <class Value, class PrivateData>
static Value getMinimum(const QMap<const QtProperty *, PrivateData> &propertyMap,
const QtProperty *property, const Value &defaultValue = Value())
{
return getData<Value>(propertyMap, &PrivateData::minVal, property, defaultValue);
}
template <class Value, class PrivateData>
static Value getMaximum(const QMap<const QtProperty *, PrivateData> &propertyMap,
const QtProperty *property, const Value &defaultValue = Value())
{
return getData<Value>(propertyMap, &PrivateData::maxVal, property, defaultValue);
}
template <class ValueChangeParameter, class Value, class PropertyManager>
static void setSimpleValue(QMap<const QtProperty *, Value> &propertyMap,
PropertyManager *manager,
void (PropertyManager::*propertyChangedSignal)(QtProperty *),
void (PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter),
QtProperty *property, const Value &val)
{
const auto it = propertyMap.find(property);
if (it == propertyMap.end())
return;
if (it.value() == val)
return;
it.value() = val;
emit (manager->*propertyChangedSignal)(property);
emit (man
没有合适的资源?快使用搜索试试~ 我知道了~
Qt控件用法:QDockWidget、树控件QTreeWidget及属性控件QtTreePropertyBrowser
共31个文件
cpp:10个
h:9个
svg:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 91 浏览量
2024-01-04
10:26:46
上传
评论
收藏 968KB ZIP 举报
温馨提示
主要使用Qt停靠控件QDockWidget、树控件QTreeWidget及Qt属性控件QtTreePropertyBrowser来搭建一个实用的主界面布局。 具体详细介绍实现效果可查看:https://blog.csdn.net/m0_37251750/article/details/135378454
资源推荐
资源详情
资源评论
收起资源包目录
QVisualSystem.zip (31个子文件)
QVisualSystem
QVisualSystem.h 871B
QVisualSystem.sln 901B
qtpropertybrowser
qttreepropertybrowser.h 5KB
qtgroupboxpropertybrowser.h 3KB
qtpropertybrowser.cpp 63KB
qtpropertybrowserutils.cpp 12KB
qttreepropertybrowser.cpp 35KB
qtvariantproperty.cpp 95KB
qtpropertybrowser.h 10KB
qtbuttonpropertybrowser.h 3KB
qtvariantproperty.h 8KB
qteditorfactory.h 16KB
qtgroupboxpropertybrowser.cpp 17KB
qtpropertybrowserutils_p.h 4KB
qteditorfactory.cpp 78KB
qtpropertymanager.cpp 211KB
qtbuttonpropertybrowser.cpp 20KB
qtpropertymanager.h 27KB
QVisualSystem.ui 3KB
main.cpp 197B
123.gif 909KB
QVisualSystem.cpp 8KB
res.qrc 324B
images
branch-end.svg 1015B
branch-open.svg 738B
background.png 16KB
branch-closed.svg 738B
branch-more.svg 1KB
branch-line.svg 910B
QVisualSystem.vcxproj.filters 4KB
QVisualSystem.vcxproj 6KB
共 31 条
- 1
资源评论
- 英莱特_IT陈2024-04-14资源很受用,资源主总结的很全面,内容与描述一致,解决了我当下的问题。
欧特克_Glodon
- 粉丝: 4w+
- 资源: 64
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功