Skip to content

Commit

Permalink
新增农历控件
Browse files Browse the repository at this point in the history
  • Loading branch information
feiyangqingyun committed Dec 6, 2019
1 parent 75d6a01 commit a36e06a
Show file tree
Hide file tree
Showing 16 changed files with 3,046 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
| 26 | mouseline | 鼠标定位十字线 |
| 27 | emailtool | 邮件发送工具 |
| 28 | ntpclient | NTP服务器时间同步 |
| 29 | lunarcalendarwidget | 农历控件 |

![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/lightbutton.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/movewidget.gif)
Expand Down Expand Up @@ -57,4 +58,5 @@
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/buttondefence.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/mouseline.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/emailtool.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/ntpclient.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/ntpclient.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/snap/lunarcalendarwidget.gif)
38 changes: 38 additions & 0 deletions lunarcalendarwidget/frmlunarcalendarwidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "frmlunarcalendarwidget.h"
#include "ui_frmlunarcalendarwidget.h"

frmLunarCalendarWidget::frmLunarCalendarWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmLunarCalendarWidget)
{
ui->setupUi(this);
this->initForm();
}

frmLunarCalendarWidget::~frmLunarCalendarWidget()
{
delete ui;
}

void frmLunarCalendarWidget::initForm()
{
ui->cboxWeekNameFormat->setCurrentIndex(2);
}

void frmLunarCalendarWidget::on_cboxCalendarStyle_currentIndexChanged(int index)
{
ui->lunarCalendarWidget->setCalendarStyle((LunarCalendarWidget::CalendarStyle)index);
}

void frmLunarCalendarWidget::on_cboxSelectType_currentIndexChanged(int index)
{
ui->lunarCalendarWidget->setSelectType((LunarCalendarWidget::SelectType)index);
}

void frmLunarCalendarWidget::on_cboxWeekNameFormat_currentIndexChanged(int index)
{
ui->lunarCalendarWidget->setWeekNameFormat((LunarCalendarWidget::WeekNameFormat)index);
}

void frmLunarCalendarWidget::on_ckShowLunar_stateChanged(int arg1)
{
ui->lunarCalendarWidget->setShowLunar(arg1 != 0);
}
29 changes: 29 additions & 0 deletions lunarcalendarwidget/frmlunarcalendarwidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef FRMLUNARCALENDARWIDGET_H
#define FRMLUNARCALENDARWIDGET_H

#include <QWidget>

namespace Ui {
class frmLunarCalendarWidget;
}

class frmLunarCalendarWidget : public QWidget
{
Q_OBJECT

public:
explicit frmLunarCalendarWidget(QWidget *parent = 0);
~frmLunarCalendarWidget();

private:
Ui::frmLunarCalendarWidget *ui;

private slots:
void initForm();
void on_cboxCalendarStyle_currentIndexChanged(int index);
void on_cboxSelectType_currentIndexChanged(int index);
void on_cboxWeekNameFormat_currentIndexChanged(int index);
void on_ckShowLunar_stateChanged(int arg1);
};

#endif // FRMLUNARCALENDARWIDGET_H
176 changes: 176 additions & 0 deletions lunarcalendarwidget/frmlunarcalendarwidget.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frmLunarCalendarWidget</class>
<widget class="QWidget" name="frmLunarCalendarWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="LunarCalendarWidget" name="lunarCalendarWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widgetBottom" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labCalendarStyle">
<property name="text">
<string>整体样式</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboxCalendarStyle">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>红色风格</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="labSelectType">
<property name="text">
<string>选中样式</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboxSelectType">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>矩形背景</string>
</property>
</item>
<item>
<property name="text">
<string>圆形背景</string>
</property>
</item>
<item>
<property name="text">
<string>角标背景</string>
</property>
</item>
<item>
<property name="text">
<string>图片背景</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="labWeekNameFormat">
<property name="text">
<string>星期格式</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboxWeekNameFormat">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>短名称</string>
</property>
</item>
<item>
<property name="text">
<string>普通名称</string>
</property>
</item>
<item>
<property name="text">
<string>长名称</string>
</property>
</item>
<item>
<property name="text">
<string>英文名称</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ckShowLunar">
<property name="text">
<string>显示农历</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LunarCalendarWidget</class>
<extends>QWidget</extends>
<header>lunarcalendarwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Binary file added lunarcalendarwidget/image/bg_calendar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit a36e06a

Please sign in to comment.