Skip to content

Commit 557a9b9

Browse files
添加coolpage到示例仓库
1 parent 2f08135 commit 557a9b9

File tree

157 files changed

+35587
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+35587
-0
lines changed

qt_coolpge/QCoolPage.pro

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#-------------------------------------------------
2+
#
3+
# Project created by QtCreator 2019-06-16T13:01:16
4+
#
5+
#-------------------------------------------------
6+
7+
QT += core gui printsupport
8+
9+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10+
11+
TARGET = QCoolPage
12+
TEMPLATE = app
13+
14+
MOC_DIR = $$OUT_PWD/mocfile
15+
OBJECTS_DIR = $$OUT_PWD/objfile
16+
UI_DIR = $$OUT_PWD/uifile
17+
RCC_DIR = $$OUT_PWD/rcfile
18+
19+
20+
SOURCES += main.cpp\
21+
mainwindow.cpp \
22+
titlebar/maintitlebar.cpp \
23+
titlebar/titlebar.cpp \
24+
maincontent/controltabwidget.cpp \
25+
maincontent/controltreewidget.cpp \
26+
systemtray/systemtray.cpp \
27+
maincontent/controlwidget/cylindercontrol/cylinderwidget.cpp \
28+
maincontent/controlwidget/progresscontrol/progresswidget.cpp \
29+
maincontent/controlwidget/progresscontrol/progresscontrol.cpp \
30+
maincontent/controlwidget/cylindercontrol/cylindercontrol.cpp \
31+
flowlayout/flowlayout.cpp \
32+
maincontent/controlwidget/framecontrol/framecontrol.cpp \
33+
maincontent/controlwidget/framecontrol/framewidget.cpp \
34+
maincontent/controlwidget/bannacontrol/bannacontrol.cpp \
35+
maincontent/controlwidget/bannacontrol/bannawidget.cpp \
36+
qcustomplot/qcustomplot.cpp \
37+
maincontent/controlwidget/plotcontrol/plotwidget.cpp \
38+
maincontent/controlwidget/plotcontrol/plotcontrol.cpp \
39+
maincontent/controlwidget/movecontrol/movecontrol.cpp \
40+
maincontent/controlwidget/movecontrol/movewidget.cpp \
41+
maincontent/controlwidget/tablecontrol/tablecontrol.cpp \
42+
maincontent/controlwidget/tablecontrol/tablewidget.cpp \
43+
numberanimation/numberanimation.cpp \
44+
maincontent/controlwidget/slidercontrol/slidercontrol.cpp \
45+
maincontent/controlwidget/slidercontrol/sliderwidget.cpp \
46+
maincontent/controlwidget/openglcontrol/cameralibrary.cpp \
47+
maincontent/controlwidget/openglcontrol/objectfactory.cpp \
48+
maincontent/controlwidget/openglcontrol/shaderlibrary.cpp \
49+
maincontent/controlwidget/openglcontrol/texturelibrary.cpp \
50+
maincontent/controlwidget/openglcontrol/objectmodel/objectparent.cpp \
51+
maincontent/controlwidget/openglcontrol/objectmodel/objectcube.cpp \
52+
maincontent/controlwidget/openglcontrol/openglcontrol.cpp \
53+
maincontent/controlwidget/openglcontrol/openglwidget.cpp \
54+
maincontent/controlwidget/processcontrol/processcontrol.cpp \
55+
maincontent/controlwidget/processcontrol/processwidget.cpp \
56+
maincontent/controlwidget/listcontrol/listcontrol.cpp \
57+
maincontent/controlwidget/listcontrol/listwidget.cpp \
58+
screen/mainobject.cpp \
59+
screen/splashscreen.cpp
60+
61+
62+
HEADERS += mainwindow.h \
63+
globaldef.hpp \
64+
titlebar/maintitlebar.h \
65+
titlebar/titlebar.h \
66+
maincontent/controltabwidget.h \
67+
maincontent/controltreewidget.h \
68+
systemtray/systemtray.h \
69+
maincontent/controlwidget/cylindercontrol/cylinderwidget.h \
70+
maincontent/controlwidget/progresscontrol/progresswidget.h \
71+
maincontent/controlwidget/progresscontrol/progresscontrol.h \
72+
maincontent/controlwidget/cylindercontrol/cylindercontrol.h \
73+
flowlayout/flowlayout.h \
74+
maincontent/controlwidget/framecontrol/framecontrol.h \
75+
maincontent/controlwidget/framecontrol/framewidget.h \
76+
maincontent/controlwidget/bannacontrol/bannacontrol.h \
77+
maincontent/controlwidget/bannacontrol/bannawidget.h \
78+
qcustomplot/qcustomplot.h \
79+
maincontent/controlwidget/plotcontrol/plotwidget.h \
80+
maincontent/controlwidget/plotcontrol/plotcontrol.h \
81+
maincontent/controlwidget/movecontrol/movecontrol.h \
82+
maincontent/controlwidget/movecontrol/movewidget.h \
83+
maincontent/controlwidget/tablecontrol/tablecontrol.h \
84+
maincontent/controlwidget/tablecontrol/tablewidget.h \
85+
numberanimation/numberanimation.h \
86+
maincontent/controlwidget/slidercontrol/slidercontrol.h \
87+
maincontent/controlwidget/slidercontrol/sliderwidget.h \
88+
maincontent/controlwidget/openglcontrol/cameralibrary.h \
89+
maincontent/controlwidget/openglcontrol/objectfactory.h \
90+
maincontent/controlwidget/openglcontrol/opengldef.h \
91+
maincontent/controlwidget/openglcontrol/shaderlibrary.h \
92+
maincontent/controlwidget/openglcontrol/texturelibrary.h \
93+
maincontent/controlwidget/openglcontrol/objectmodel/objectparent.h \
94+
maincontent/controlwidget/openglcontrol/objectmodel/objectcube.h \
95+
maincontent/controlwidget/openglcontrol/openglcontrol.h \
96+
maincontent/controlwidget/openglcontrol/openglwidget.h \
97+
maincontent/controlwidget/processcontrol/processcontrol.h \
98+
maincontent/controlwidget/processcontrol/processwidget.h \
99+
maincontent/controlwidget/listcontrol/listcontrol.h \
100+
maincontent/controlwidget/listcontrol/listwidget.h \
101+
screen/mainobject.h \
102+
screen/splashscreen.h
103+
104+
105+
FORMS += mainwindow.ui \
106+
titlebar/maintitlebar.ui \
107+
maincontent/controltabwidget.ui \
108+
maincontent/controltreewidget.ui \
109+
maincontent/controlwidget/cylindercontrol/cylinderwidget.ui \
110+
maincontent/controlwidget/progresscontrol/progresswidget.ui \
111+
maincontent/controlwidget/progresscontrol/progresscontrol.ui \
112+
maincontent/controlwidget/cylindercontrol/cylindercontrol.ui \
113+
maincontent/controlwidget/framecontrol/framewidget.ui \
114+
maincontent/controlwidget/bannacontrol/bannacontrol.ui \
115+
maincontent/controlwidget/bannacontrol/bannawidget.ui \
116+
maincontent/controlwidget/plotcontrol/plotwidget.ui \
117+
maincontent/controlwidget/plotcontrol/plotcontrol.ui \
118+
maincontent/controlwidget/movecontrol/movecontrol.ui \
119+
maincontent/controlwidget/movecontrol/movewidget.ui \
120+
maincontent/controlwidget/tablecontrol/tablecontrol.ui \
121+
maincontent/controlwidget/tablecontrol/tablewidget.ui \
122+
maincontent/controlwidget/slidercontrol/slidercontrol.ui \
123+
maincontent/controlwidget/slidercontrol/sliderwidget.ui \
124+
maincontent/controlwidget/openglcontrol/openglwidget.ui \
125+
maincontent/controlwidget/processcontrol/processcontrol.ui \
126+
maincontent/controlwidget/processcontrol/processwidget.ui \
127+
maincontent/controlwidget/listcontrol/listcontrol.ui \
128+
maincontent/controlwidget/listcontrol/listwidget.ui
129+
130+
RESOURCES += \
131+
res.qrc \
132+
res/shaders.qrc \
133+
res/textures.qrc
134+
135+
RC_FILE += myapp.rc

qt_coolpge/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
3+
# 欢迎查看QCoolPage源代码
4+
> * 轮播图
5+
> * 柱状图
6+
> * 进度条
7+
> * 面板
8+
> * 列表
9+
> * 坐标系
10+
> * 可移动按钮
11+
> * 表格
12+
> * 移动进度
13+
> * 流程进度
14+
> * 三维模型
15+
16+
17+
## CSDN网址:
18+
https://blog.csdn.net/yinyuchen1/article/details/100639853
19+
20+
## QCoolPage源码讲解视频
21+
请下载视频进行观看,百度云盘分享
22+
https://pan.baidu.com/s/1VFC329KHYaalYUw-p_4umA
23+
提取码:wiqe
24+
25+
## 项目简介
26+
作者:`灏夏星辰`
27+
2021年01月07日
28+
可跨平台,已兼容Linux平台
29+
持续更新中...
30+

qt_coolpge/app.ico

4.19 KB
Binary file not shown.

qt_coolpge/etc/qt.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Platforms]
2+
WindowsArguments = dpiawareness=1

qt_coolpge/flowlayout/flowlayout.cpp

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
/****************************************************************************
2+
**
3+
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4+
** All rights reserved.
5+
** Contact: Nokia Corporation (qt-info@nokia.com)
6+
**
7+
** This file is part of the examples of the Qt Toolkit.
8+
**
9+
** $QT_BEGIN_LICENSE:LGPL$
10+
** Commercial Usage
11+
** Licensees holding valid Qt Commercial licenses may use this file in
12+
** accordance with the Qt Commercial License Agreement provided with the
13+
** Software or, alternatively, in accordance with the terms contained in
14+
** a written agreement between you and Nokia.
15+
**
16+
** GNU Lesser General Public License Usage
17+
** Alternatively, this file may be used under the terms of the GNU Lesser
18+
** General Public License version 2.1 as published by the Free Software
19+
** Foundation and appearing in the file LICENSE.LGPL included in the
20+
** packaging of this file. Please review the following information to
21+
** ensure the GNU Lesser General Public License version 2.1 requirements
22+
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23+
**
24+
** In addition, as a special exception, Nokia gives you certain additional
25+
** rights. These rights are described in the Nokia Qt LGPL Exception
26+
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27+
**
28+
** GNU General Public License Usage
29+
** Alternatively, this file may be used under the terms of the GNU
30+
** General Public License version 3.0 as published by the Free Software
31+
** Foundation and appearing in the file LICENSE.GPL included in the
32+
** packaging of this file. Please review the following information to
33+
** ensure the GNU General Public License version 3.0 requirements will be
34+
** met: http://www.gnu.org/copyleft/gpl.html.
35+
**
36+
** If you have questions regarding the use of this file, please contact
37+
** Nokia at qt-info@nokia.com.
38+
** $QT_END_LICENSE$
39+
**
40+
****************************************************************************/
41+
42+
#include <QtGui>
43+
44+
45+
#include "flowlayout.h"
46+
//! [1]
47+
FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing)
48+
: QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing)
49+
{
50+
setContentsMargins(margin, margin, margin, margin);
51+
}
52+
53+
FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing)
54+
: m_hSpace(hSpacing), m_vSpace(vSpacing)
55+
{
56+
setContentsMargins(margin, margin, margin, margin);
57+
}
58+
//! [1]
59+
60+
//! [2]
61+
FlowLayout::~FlowLayout()
62+
{
63+
QLayoutItem *item;
64+
while ((item = takeAt(0)))
65+
delete item;
66+
}
67+
//! [2]
68+
69+
//! [3]
70+
void FlowLayout::addItem(QLayoutItem *item)
71+
{
72+
itemList.append(item);
73+
}
74+
//! [3]
75+
76+
//! [4]
77+
int FlowLayout::horizontalSpacing() const
78+
{
79+
if (m_hSpace >= 0) {
80+
return m_hSpace;
81+
} else {
82+
return smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
83+
}
84+
}
85+
86+
int FlowLayout::verticalSpacing() const
87+
{
88+
if (m_vSpace >= 0) {
89+
return m_vSpace;
90+
} else {
91+
return smartSpacing(QStyle::PM_LayoutVerticalSpacing);
92+
}
93+
}
94+
//! [4]
95+
96+
//! [5]
97+
int FlowLayout::count() const
98+
{
99+
return itemList.size();
100+
}
101+
102+
QLayoutItem *FlowLayout::itemAt(int index) const
103+
{
104+
return itemList.value(index);
105+
}
106+
107+
QLayoutItem *FlowLayout::takeAt(int index)
108+
{
109+
if (index >= 0 && index < itemList.size())
110+
return itemList.takeAt(index);
111+
else
112+
return 0;
113+
}
114+
//! [5]
115+
116+
//! [6]
117+
Qt::Orientations FlowLayout::expandingDirections() const
118+
{
119+
return 0;
120+
}
121+
//! [6]
122+
123+
//! [7]
124+
bool FlowLayout::hasHeightForWidth() const
125+
{
126+
return true;
127+
}
128+
129+
int FlowLayout::heightForWidth(int width) const
130+
{
131+
int height = doLayout(QRect(0, 0, width, 0), true);
132+
return height;
133+
}
134+
//! [7]
135+
136+
//! [8]
137+
void FlowLayout::setGeometry(const QRect &rect)
138+
{
139+
QLayout::setGeometry(rect);
140+
doLayout(rect, false);
141+
}
142+
143+
QSize FlowLayout::sizeHint() const
144+
{
145+
return minimumSize();
146+
}
147+
148+
QSize FlowLayout::minimumSize() const
149+
{
150+
QSize size;
151+
QLayoutItem *item;
152+
foreach (item, itemList)
153+
size = size.expandedTo(item->minimumSize());
154+
155+
size += QSize(2*margin(), 2*margin());
156+
return size;
157+
}
158+
//! [8]
159+
160+
//! [9]
161+
int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
162+
{
163+
int left, top, right, bottom;
164+
getContentsMargins(&left, &top, &right, &bottom);
165+
QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom);
166+
int x = effectiveRect.x();
167+
int y = effectiveRect.y();
168+
int lineHeight = 0;
169+
//! [9]
170+
171+
//! [10]
172+
QLayoutItem *item;
173+
foreach (item, itemList) {
174+
QWidget *wid = item->widget();
175+
int spaceX = horizontalSpacing();
176+
if (spaceX == -1)
177+
spaceX = wid->style()->layoutSpacing(
178+
QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal);
179+
int spaceY = verticalSpacing();
180+
if (spaceY == -1)
181+
spaceY = wid->style()->layoutSpacing(
182+
QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical);
183+
//! [10]
184+
//! [11]
185+
int nextX = x + item->sizeHint().width() + spaceX;
186+
if (nextX - spaceX > effectiveRect.right() && lineHeight > 0) {
187+
x = effectiveRect.x();
188+
y = y + lineHeight + spaceY;
189+
nextX = x + item->sizeHint().width() + spaceX;
190+
lineHeight = 0;
191+
}
192+
193+
if (!testOnly)
194+
item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
195+
196+
x = nextX;
197+
lineHeight = qMax(lineHeight, item->sizeHint().height());
198+
}
199+
return y + lineHeight - rect.y() + bottom;
200+
}
201+
//! [11]
202+
//! [12]
203+
int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
204+
{
205+
QObject *parent = this->parent();
206+
if (!parent) {
207+
return -1;
208+
} else if (parent->isWidgetType()) {
209+
QWidget *pw = static_cast<QWidget *>(parent);
210+
return pw->style()->pixelMetric(pm, 0, pw);
211+
} else {
212+
return static_cast<QLayout *>(parent)->spacing();
213+
}
214+
}
215+
//! [12]

0 commit comments

Comments
 (0)