/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtpropertymanager.h"
#include "qtpropertybrowserutils_p.h"
#include <QDateTime>
#include <QLocale>
#include <QMap>
#include <QTimer>
#include <QIcon>
#include <QMetaEnum>
#include <QFontDatabase>
#include <QStyleOption>
#include <QStyle>
#include <QApplication>
#include <QPainter>
#include <QLabel>
#include <QCheckBox>
#include <QLineEdit>
#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
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif
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())
{
typedef QMap<const QtProperty *, PrivateData> PropertyToData;
typedef typename PropertyToData::const_iterator PropertyToDataConstIterator;
const PropertyToDataConstIterator 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)
{
typedef QMap<const QtProperty *, Value> PropertyToData;
typedef typename PropertyToData::iterator PropertyToDataIterator;
const PropertyToDataIterator it = propertyMap.find(property);
if (it == propertyMap.end())
return;
if (it.value()
没有合适的资源?快使用搜索试试~ 我知道了~
qt 绘图工具 实例 C++ 2D 图形绘制 编辑
共326个文件
html:108个
png:80个
cpp:32个
需积分: 5 14 下载量 186 浏览量
2023-05-04
16:09:40
上传
评论 1
收藏 926KB RAR 举报
温馨提示
QT C++ 2D 绘图 可编辑图形 工程实例。可用于编写2D绘图软件参考。
资源推荐
资源详情
资源评论
收起资源包目录
qt 绘图工具 实例 C++ 2D 图形绘制 编辑 (326个子文件)
configure.bat 3KB
configure 689B
qtpropertymanager.cpp 211KB
qtcanvas.cpp 161KB
qtcanvas.cpp 161KB
qtvariantproperty.cpp 101KB
qteditorfactory.cpp 83KB
qtpropertybrowser.cpp 63KB
drawobj.cpp 41KB
qttreepropertybrowser.cpp 35KB
mainwindow.cpp 32KB
qtbuttonpropertybrowser.cpp 20KB
mainwindow.cpp 18KB
qtgroupboxpropertybrowser.cpp 17KB
customproperty.cpp 17KB
drawtool.cpp 17KB
qtpropertybrowserutils.cpp 15KB
mainwindow.cpp 15KB
objectcontroller.cpp 14KB
objectcontroller.cpp 14KB
drawscene.cpp 11KB
main.cpp 11KB
commands.cpp 10KB
main.cpp 10KB
main.cpp 9KB
drawview.cpp 9KB
rulebar.cpp 9KB
main.cpp 8KB
main.cpp 6KB
main.cpp 2KB
main.cpp 2KB
sizehandle.cpp 2KB
main.cpp 620B
document.cpp 50B
classic.css 4KB
qtpropertybrowser.dcf 46KB
qtpropertymanager.h 27KB
qtcanvas.h 19KB
qtcanvas.h 19KB
qteditorfactory.h 16KB
drawobj.h 12KB
qtpropertybrowser.h 11KB
qtvariantproperty.h 9KB
qtpropertybrowserutils_p.h 5KB
qttreepropertybrowser.h 5KB
mainwindow.h 4KB
mainwindow.h 4KB
mainwindow.h 4KB
commands.h 4KB
qtbuttonpropertybrowser.h 3KB
customproperty.h 3KB
drawtool.h 3KB
qtgroupboxpropertybrowser.h 3KB
objectcontroller.h 2KB
objectcontroller.h 2KB
drawscene.h 2KB
drawview.h 1KB
sizehandle.h 1KB
rulebar.h 984B
document.h 108B
qttreepropertybrowser-members.html 52KB
qtbuttonpropertybrowser-members.html 49KB
qtgroupboxpropertybrowser-members.html 48KB
qtabstractpropertybrowser-members.html 48KB
qtvariantpropertymanager.html 36KB
qtabstractpropertybrowser.html 28KB
qttreepropertybrowser.html 28KB
qtabstractpropertymanager.html 20KB
qtsizefpropertymanager.html 19KB
qtdoublepropertymanager.html 19KB
qtsizepropertymanager.html 17KB
qtintpropertymanager.html 17KB
qtabstracteditorfactory.html 17KB
qtrectfpropertymanager.html 16KB
qtproperty.html 16KB
qtenumpropertymanager.html 16KB
qtdatepropertymanager.html 16KB
qtrectpropertymanager.html 14KB
qtflagpropertymanager.html 14KB
qtfontpropertymanager.html 14KB
qtpointfpropertymanager.html 13KB
qtstringpropertymanager.html 13KB
qtbuttonpropertybrowser.html 13KB
qtsizepolicypropertymanager.html 12KB
qtvariantpropertymanager-members.html 12KB
qtcolorpropertymanager.html 12KB
qtdoublepropertymanager-members.html 12KB
qtsizefpropertymanager-members.html 11KB
qtlocalepropertymanager.html 11KB
qtpointpropertymanager.html 11KB
qtintpropertymanager-members.html 11KB
qtrectfpropertymanager-members.html 11KB
qtsizepropertymanager-members.html 11KB
qtenumpropertymanager-members.html 11KB
qtdatepropertymanager-members.html 11KB
qtpointfpropertymanager-members.html 11KB
qtrectpropertymanager-members.html 11KB
qtflagpropertymanager-members.html 10KB
qtcursorpropertymanager.html 10KB
qtfontpropertymanager-members.html 10KB
共 326 条
- 1
- 2
- 3
- 4
资源评论
liu876151990
- 粉丝: 0
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功