/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Controls module 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$
**
****************************************************************************/
.pragma library
var daysInAWeek = 7;
var monthsInAYear = 12;
// Not the number of weeks per month, but the number of weeks that are
// shown on a typical calendar.
var weeksOnACalendarMonth = 6;
// Can't create year 1 directly...
var minimumCalendarDate = new Date(-1, 0, 1);
minimumCalendarDate.setFullYear(minimumCalendarDate.getFullYear() + 2);
var maximumCalendarDate = new Date(275759, 9, 25);
function daysInMonth(date) {
// Passing 0 as the day will give us the previous month, which will be
// date.getMonth() since we added 1 to it.
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
}
/*!
Returns a copy of \a date with its month set to \a month, keeping the same
day if possible. Does not modify \a date.
*/
function setMonth(date, month) {
var oldDay = date.getDate();
var newDate = new Date(date);
// Set the day first, because setting the month could cause it to skip ahead
// a month if the day is larger than the latest day in that month.
newDate.setDate(1);
newDate.setMonth(month);
// We'd like to have the previous day still selected when we change
// months, but it might not be possible, so use the smallest of the two.
newDate.setDate(Math.min(oldDay, daysInMonth(newDate)));
return newDate;
}
/*!
Returns the cell rectangle for the cell at the given \a index, assuming
that the grid has a number of columns equal to \a columns and rows
equal to \a rows, with an available width of \a availableWidth and height
of \a availableHeight.
If \a gridLineWidth is greater than \c 0, the cell rectangle will be
calculated under the assumption that there is a grid between the cells:
31 | 1 | 2 | 3 | 4 | 5 | 6
--------------------------------
7 | 8 | 9 | 10 | 11 | 12 | 13
--------------------------------
14 | 15 | 16 | 17 | 18 | 19 | 20
--------------------------------
21 | 22 | 23 | 24 | 25 | 26 | 27
--------------------------------
28 | 29 | 30 | 31 | 1 | 2 | 3
--------------------------------
4 | 5 | 6 | 7 | 8 | 9 | 10
*/
function cellRectAt(index, columns, rows, availableWidth, availableHeight, gridLineWidth) {
var col = Math.floor(index % columns);
var row = Math.floor(index / columns);
var availableWidthMinusGridLines = availableWidth - ((columns - 1) * gridLineWidth);
var availableHeightMinusGridLines = availableHeight - ((rows - 1) * gridLineWidth);
var remainingHorizontalSpace = Math.floor(availableWidthMinusGridLines % columns);
var remainingVerticalSpace = Math.floor(availableHeightMinusGridLines % rows);
var baseCellWidth = Math.floor(availableWidthMinusGridLines / columns);
var baseCellHeight = Math.floor(availableHeightMinusGridLines / rows);
var rect = Qt.rect(0, 0, 0, 0);
rect.x = baseCellWidth * col;
rect.width = baseCellWidth;
if (remainingHorizontalSpace > 0) {
if (col < remainingHorizontalSpace) {
++rect.width;
}
// This cell's x position should be increased by 1 for every column above it.
rect.x += Math.min(remainingHorizontalSpace, col);
}
rect.y = baseCellHeight * row;
rect.height = baseCellHeight;
if (remainingVerticalSpace > 0) {
if (row < remainingVerticalSpace) {
++rect.height;
}
// This cell's y position should be increased by 1 for every row above it.
rect.y += Math.min(remainingVerticalSpace, row);
}
rect.x += col * gridLineWidth;
rect.y += row * gridLineWidth;
return rect;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
RedisDesktopManager Version 0.999 (1026个子文件)
qt.conf 22B
opengl32sw.dll 15.25MB
Qt5Gui.dll 4.96MB
Qt5Core.dll 4.65MB
Qt5Widgets.dll 4.22MB
D3Dcompiler_47.dll 3.31MB
Qt5Quick.dll 2.87MB
Qt5Qml.dll 2.52MB
libGLESV2.dll 1.86MB
qtquickcontrols2imaginestyleplugin.dll 1.72MB
libeay32.dll 1.31MB
qwindows.dll 1.1MB
Qt5Charts.dll 1.09MB
Qt5Network.dll 961KB
qtchartsqml2d.dll 853KB
qtquickextrasflatplugin.dll 799KB
Qt5QuickTemplates2.dll 742KB
Qt5Multimedia.dll 568KB
qwebp.dll 404KB
qtchartsqml2.dll 388KB
ssleay32.dll 330KB
qtiff.dll 320KB
qjpeg.dll 291KB
qtquicktemplates2plugin.dll 260KB
Qt5Svg.dll 259KB
qtquickcontrolsplugin.dll 254KB
qsgd3d12backend.dll 246KB
Qt5WinExtras.dll 229KB
dsengine.dll 225KB
declarative_multimedia.dll 223KB
Qt5Test.dll 201KB
Qt5QuickControls2.dll 140KB
qwindowsvistastyle.dll 121KB
qmldbg_debugger.dll 114KB
dialogplugin.dll 113KB
Qt5QuickTest.dll 110KB
qtquickcontrols2plugin.dll 105KB
widgetsplugin.dll 96KB
Qt5MultimediaQuick.dll 89KB
qtquickcontrols2materialstyleplugin.dll 84KB
qtaudio_wasapi.dll 80KB
qml_winextras.dll 75KB
qquicklayoutsplugin.dll 71KB
qtlabscalendarplugin.dll 70KB
qtquickcontrols2universalstyleplugin.dll 66KB
qtquickextrasplugin.dll 59KB
qtgraphicaleffectsplugin.dll 56KB
qmldbg_profiler.dll 55KB
qmldbg_inspector.dll 54KB
qtquickcontrols2fusionstyleplugin.dll 52KB
qtmedia_audioengine.dll 49KB
qmlfolderlistmodelplugin.dll 47KB
qtaudio_windows.dll 46KB
qmldbg_server.dll 46KB
wmfengine.dll 43KB
qtgraphicaleffectsprivate.dll 43KB
qnativewifibearer.dll 41KB
qdds.dll 40KB
qmldbg_nativedebugger.dll 39KB
qgenericbearer.dll 38KB
dialogsprivateplugin.dll 37KB
qicns.dll 33KB
qsvgicon.dll 31KB
qmltestplugin.dll 29KB
qmlsettingsplugin.dll 27KB
qmldbg_native.dll 26KB
qico.dll 26KB
qgif.dll 26KB
qmldbg_quickprofiler.dll 24KB
qtmultimedia_m3u.dll 23KB
qsvg.dll 21KB
qtga.dll 21KB
qmldbg_local.dll 20KB
qwbmp.dll 20KB
qmldbg_tcp.dll 19KB
qmldbg_messages.dll 18KB
qtquick2plugin.dll 16KB
modelsplugin.dll 16KB
windowplugin.dll 16KB
libEGL.dll 13KB
vc_redist.x86.exe 13.79MB
rdm.exe 2.7MB
uninstall.exe 403KB
crashreporter.exe 239KB
CalendarUtils.js 6KB
testlogger.js 3KB
style.js 2KB
StackView.js 2KB
CalendarUtils.jsc 3KB
style.jsc 2KB
StackView.jsc 1KB
qtcharts.metainfo 7KB
spinner_large.png 5KB
needle.png 2KB
knob.png 2KB
areaseries-polar-icon.png 2KB
lineseries-polar-icon.png 2KB
splineseries-polar-icon.png 2KB
spinner_medium.png 2KB
scatterseries-polar-icon.png 2KB
共 1026 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
Left_0ut
- 粉丝: 18
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功