/****************************************************************************
**
** 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;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SSokit.7z socket调试工具--SSokit Windows安装包 (717个子文件)
opengl32sw.dll 19.95MB
Qt5Gui.dll 6.19MB
Qt5Core.dll 6.18MB
Qt5Widgets.dll 5.42MB
Qt5Qml.dll 4.02MB
D3Dcompiler_47.dll 3.98MB
Qt5Quick.dll 3.94MB
libGLESV2.dll 3.8MB
qtquickcontrols2imaginestyleplugin.dll 2.19MB
qwindows.dll 1.75MB
Qt5Network.dll 1.66MB
libstdc++-6.dll 1.36MB
Qt5QuickTemplates2.dll 1.11MB
qsqlite.dll 1.01MB
Qt5Multimedia.dll 961KB
qtquickextrasflatplugin.dll 816KB
qtquickcontrols2materialstyleplugin.dll 564KB
qwebp.dll 533KB
qtquickcontrols2plugin.dll 501KB
qtiff.dll 490KB
qtquickcontrols2universalstyleplugin.dll 456KB
qtquickcontrols2fusionstyleplugin.dll 453KB
qtquickcontrolsplugin.dll 395KB
qjpeg.dll 384KB
dsengine.dll 382KB
qtquicktemplates2plugin.dll 368KB
Qt5Svg.dll 341KB
Qt5Bluetooth.dll 283KB
Qt5Sql.dll 266KB
qmldbg_debugger.dll 181KB
qwindowsvistastyle.dll 174KB
Qt5QuickControls2.dll 168KB
Qt5WebSockets.dll 167KB
qquicklayoutsplugin.dll 109KB
qgenericbearer.dll 100KB
qmldbg_preview.dll 94KB
declarative_bluetooth.dll 91KB
qtquickextrasplugin.dll 88KB
qtaudio_windows.dll 84KB
qmldbg_inspector.dll 80KB
qmldbg_profiler.dll 77KB
libgcc_s_seh-1.dll 73KB
qmldbg_server.dll 70KB
qtmedia_audioengine.dll 69KB
qtgraphicaleffectsprivate.dll 68KB
qtgraphicaleffectsplugin.dll 67KB
qmldbg_nativedebugger.dll 61KB
declarative_qmlwebsockets.dll 52KB
libwinpthread-1.dll 51KB
qicns.dll 49KB
qsvgicon.dll 46KB
qgif.dll 40KB
qmldbg_native.dll 39KB
qico.dll 39KB
qmldbg_quickprofiler.dll 35KB
qtmultimedia_m3u.dll 34KB
qsvg.dll 33KB
qwbmp.dll 31KB
qtga.dll 31KB
qmldbg_messages.dll 30KB
libEGL.dll 30KB
qmldbg_local.dll 29KB
qmldbg_tcp.dll 29KB
modelsplugin.dll 25KB
qtquick2plugin.dll 25KB
windowplugin.dll 25KB
SSokit.exe 1001KB
CalendarUtils.js 6KB
style.js 2KB
StackView.js 2KB
CalendarUtils.jsc 3KB
style.jsc 2KB
StackView.jsc 1KB
spinner_large.png 5KB
needle.png 2KB
knob.png 2KB
spinner_medium.png 2KB
progress-indeterminate.png 1KB
spinner_small.png 998B
scrollbar-handle-vertical.png 839B
scrollbar-handle-horizontal.png 825B
slider-groove.png 565B
button.png 554B
slider-handle.png 524B
tab_selected.png 437B
check@2x.png 417B
editbox.png 416B
tab.png 390B
header.png 383B
focusframe.png 271B
rightanglearrow.png 228B
groupbox.png 225B
leftanglearrow.png 206B
button_down.png 203B
check.png 176B
arrow-up@2x.png 155B
scrollbar-handle-transient.png 153B
arrow-right@2x.png 148B
arrow-left@2x.png 139B
arrow-down@2x.png 138B
共 717 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
洪博hopes
- 粉丝: 409
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功