diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bf43c7..e3e0915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,7 @@ set(UTIL_FILES ) set(DATAPANEL_FILES + dataPanel/dpGlobals.h dataPanel/dpBaseWidget.h dataPanel/dpBaseWidget.cpp dataPanel/dpLineChart.h diff --git a/dataPanel/dpBaseWidget.h b/dataPanel/dpBaseWidget.h index 1a15b1e..b8ee00a 100644 --- a/dataPanel/dpBaseWidget.h +++ b/dataPanel/dpBaseWidget.h @@ -23,7 +23,10 @@ public: ~dpBaseWidget(); virtual void setTimeRange(TimeUnit) {} - virtual void viewHistoricalData(QDateTime) {} + virtual void setDateTime(const QDateTime&) {} + virtual void viewHistoricalData(const QDateTime&) {} + +private: }; #endif diff --git a/dataPanel/dpGlobals.h b/dataPanel/dpGlobals.h new file mode 100644 index 0000000..3cbb86c --- /dev/null +++ b/dataPanel/dpGlobals.h @@ -0,0 +1,17 @@ +#ifndef DP_GLOBALS_H +#define DP_GLOBALS_H + +enum DataPanelType +{ + lineChart = 0, //折线图 + curveChart, //曲线图 + barChart, //柱状图 + dotChart, //点图 + pieChart, //饼图 + heatMap, //热力图 + dial, //仪表图 + table, //数据表 + map //地图 +}; + +#endif diff --git a/dataPanel/dpLineChart.cpp b/dataPanel/dpLineChart.cpp index 9fc5b22..fa68392 100644 --- a/dataPanel/dpLineChart.cpp +++ b/dataPanel/dpLineChart.cpp @@ -9,6 +9,8 @@ dpLineChart::dpLineChart(QWidget* parent) m_pCustomPlot = new QCustomPlot(this); initQCP(); + m_timeRange = 60 * 1000; + QBoxLayout* mainLayout = new QBoxLayout(QBoxLayout::LeftToRight); mainLayout->setContentsMargins(0, 1, 0, 0); mainLayout->addWidget(m_pCustomPlot); @@ -22,49 +24,133 @@ dpLineChart::~dpLineChart() void dpLineChart::initQCP() { - m_pCustomPlot->axisRect()->setupFullAxesBox(); + //m_pCustomPlot->axisRect()->setupFullAxesBox(); + m_pCustomPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); + m_pCustomPlot->axisRect()->setRangeDrag(Qt::Horizontal); //只允许x轴方向的拖拽 + double zoomFactor = m_pCustomPlot->axisRect()->rangeZoomFactor(Qt::Horizontal); + m_pCustomPlot->axisRect()->setRangeZoomFactor(zoomFactor, 1); //只做x轴的缩放 m_pCustomPlot->xAxis->setSubTicks(false); m_pCustomPlot->xAxis2->setTicks(false); m_pCustomPlot->xAxis2->setSubTicks(false); m_pCustomPlot->yAxis->setSubTicks(false); m_pCustomPlot->yAxis2->setTicks(false); m_pCustomPlot->yAxis2->setSubTicks(false); + connect(m_pCustomPlot->xAxis, SIGNAL(rangeChanged(const QCPRange&)), this, SLOT(onSignal_rangeChanged_xAxis(const QCPRange&))); //背景颜色 m_pCustomPlot->setBackground(QBrush(Qt::transparent)); //坐标轴颜色 - QColor axisColor(100, 100, 100); + QColor axisColor(87, 100, 120); m_pCustomPlot->xAxis->setBasePen(axisColor); - m_pCustomPlot->xAxis->setTickPen(axisColor); m_pCustomPlot->xAxis2->setBasePen(axisColor); - m_pCustomPlot->xAxis2->setTickPen(axisColor); m_pCustomPlot->yAxis->setBasePen(axisColor); - m_pCustomPlot->yAxis->setTickPen(axisColor); m_pCustomPlot->yAxis2->setBasePen(axisColor); - m_pCustomPlot->yAxis2->setTickPen(axisColor); //坐标刻度颜色 - QColor tickColor(100, 100, 100); + QColor tickColor(87, 100, 120); m_pCustomPlot->xAxis->setTickPen(QPen(tickColor)); m_pCustomPlot->yAxis->setTickPen(QPen(tickColor)); //坐标刻度Label颜色 QColor tickLabelColor(250, 250, 250); m_pCustomPlot->xAxis->setTickLabelColor(tickLabelColor); - m_pCustomPlot->xAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 10)); + m_pCustomPlot->xAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 12)); m_pCustomPlot->yAxis->setTickLabelColor(tickLabelColor); - m_pCustomPlot->yAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 10)); + m_pCustomPlot->yAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 12)); //网格线颜色 - QColor gridColor(100, 100, 100); + QColor gridColor(87, 100, 120); m_pCustomPlot->xAxis->grid()->setPen(QPen(gridColor, 1, Qt::DotLine)); m_pCustomPlot->xAxis->grid()->setZeroLinePen(QPen(gridColor, 1, Qt::DotLine)); + //m_pCustomPlot->xAxis2->grid()->setPen(QPen(gridColor, 1, Qt::DotLine)); m_pCustomPlot->yAxis->grid()->setPen(QPen(gridColor, 1, Qt::DotLine)); m_pCustomPlot->yAxis->grid()->setZeroLinePen(QPen(gridColor, 1, Qt::DotLine)); + //m_pCustomPlot->yAxis2->grid()->setPen(QPen(gridColor, 1, Qt::DotLine)); + //x轴用时间格式 + QSharedPointer timeTicker(new QCPAxisTickerDateTime); + timeTicker->setDateTimeFormat("hh:mm:ss:zzz\nyyyy/MM/dd"); + //qDebug() << timeTicker->dateTimeFormat(); + m_pCustomPlot->xAxis->setTicker(timeTicker); + //qDebug() << m_pCustomPlot->xAxis->range(); } void dpLineChart::setTimeRange(TimeUnit unit) { - + switch(unit) + { + case TU_Year: + m_timeRange = m_curDateTime.date().daysInYear() * 24 * 60 * 60 * (qint64)1000; + break; + case TU_Month: + m_timeRange = m_curDateTime.date().daysInMonth() * 24 * 60 * 60 * (qint64)1000; + break; + case TU_Day: + m_timeRange = 24 * 60 * 60 * 1000; + break; + case TU_Hour: + m_timeRange = 60 * 60 *1000; + break; + case TU_Minute_30: + m_timeRange = 30 * 60 *1000; + break; + case TU_Minute_20: + m_timeRange = 20 * 60 *1000; + break; + case TU_Minute_15: + m_timeRange = 15 * 60 *1000; + break; + case TU_Minute_10: + m_timeRange = 10 * 60 *1000; + break; + case TU_Minute_5: + m_timeRange = 5 * 60 *1000; + break; + case TU_Minute_3: + m_timeRange = 3 * 60 *1000; + break; + case TU_Minute_1: + m_timeRange = 60 * 1000; + break; + case TU_Second_30: + m_timeRange = 30 * 1000; + break; + case TU_Second_10: + m_timeRange = 10 * 1000; + break; + case TU_Second_1: + m_timeRange = 1 * 1000; + break; + case TU_MSecond_500: + m_timeRange = 500; + break; + case TU_MSecond_100: + m_timeRange = 100; + break; + case TU_MSecond_50: + m_timeRange = 50; + break; + case TU_MSecond_10: + m_timeRange = 10; + break; + default: + break; + } } -void dpLineChart::viewHistoricalData(QDateTime dateTime) +void dpLineChart::setDateTime(const QDateTime& dateTime) +{ + qint64 timeValue = dateTime.toMSecsSinceEpoch() / 1000.0; + //qint64 timeValue = QCPAxisTickerDateTime::dateTimeToKey(dateTime); + m_pCustomPlot->xAxis->setRange(timeValue, m_timeRange / 1000.0, Qt::AlignRight); + m_pCustomPlot->replot(); + m_curDateTime = dateTime; +} + +void dpLineChart::viewHistoricalData(const QDateTime& dateTime) { } + +void dpLineChart::onSignal_rangeChanged_xAxis(const QCPRange& range) +{ + // qDebug() << "m_timeRange: " << m_timeRange; + // qDebug() << "range size: " << range.size(); + if(m_timeRange != range.size() * 1000) + m_timeRange = range.size() * 1000; +} diff --git a/dataPanel/dpLineChart.h b/dataPanel/dpLineChart.h index 0815d48..8df955f 100644 --- a/dataPanel/dpLineChart.h +++ b/dataPanel/dpLineChart.h @@ -13,6 +13,7 @@ #include "dpBaseWidget.h" class QCustomPlot; +class QCPRange; class dpLineChart : public dpBaseWidget { @@ -23,12 +24,18 @@ public: ~dpLineChart(); void setTimeRange(TimeUnit); - void viewHistoricalData(QDateTime); + void setDateTime(const QDateTime&); + void viewHistoricalData(const QDateTime&); + +public slots: + void onSignal_rangeChanged_xAxis(const QCPRange&); private: void initQCP(); QCustomPlot* m_pCustomPlot; + qint64 m_timeRange; + QDateTime m_curDateTime; }; #endif diff --git a/include/dashboard.h b/include/dashboard.h index 0f0cf4d..9f84adb 100644 --- a/include/dashboard.h +++ b/include/dashboard.h @@ -3,6 +3,8 @@ #include "qboxlayout.h" #include +#include "global.h" +#include "dataPanel/dpGlobals.h" class DashboardFrame; class CustomTab; @@ -24,10 +26,12 @@ public: CustomTab* tab(); QWidget* displayArea(); void setActive(bool); - void addPanel(const QString&); + void addPanel(DataPanelType); void removePanel(const QString&); void resizePanel(double, double); void deleteSubWidgets(); + void setDateTime(const QDateTime&); + void setTimeRange(TimeUnit); public slots: void contextMenu_tab(const QPoint&); diff --git a/include/dashboardFrame.h b/include/dashboardFrame.h index 65ce412..7bc57c7 100644 --- a/include/dashboardFrame.h +++ b/include/dashboardFrame.h @@ -3,6 +3,7 @@ #include #include "global.h" +#include "dataPanel/dpGlobals.h" QT_BEGIN_NAMESPACE namespace Ui { @@ -80,7 +81,7 @@ public slots: void onSignal_removeDashboard(); void onSignal_dashboardNaming(const QString&, const QString&); void onSignal_dashboardTabMoved(int, int); //拖动tab引发了位置变化 - void onSignal_panelSelectResult(const QString&); + void onSignal_panelSelectResult(DataPanelType); void onSignal_timeRangeChanged(TimeUnit); void onSignal_viewRealTimeData(); diff --git a/include/dataPanel.h b/include/dataPanel.h index 3d0e36b..ea0529e 100644 --- a/include/dataPanel.h +++ b/include/dataPanel.h @@ -2,6 +2,8 @@ #define DATAPANEL_H #include +#include "global.h" +#include "dataPanel/dpGlobals.h" QT_BEGIN_NAMESPACE namespace Ui { @@ -35,7 +37,7 @@ class DataPanel : public QDialog Q_OBJECT public: - DataPanel(QWidget *parent = nullptr); + DataPanel(QWidget *parent = nullptr, DataPanelType type = lineChart); ~DataPanel(); /** @@ -61,6 +63,8 @@ public: void setDisplayAreaSize(const QSize&); void resizeByRatio(double, double); //通过缩放比例做resize,在所属dasboard的resizeEvent中调用 void resizeByNewSize(const QSize&); //通过新的尺寸(所在区域)做resize,当所属dashboard被激活(显示)时调用 + void setDateTime(const QDateTime&); + void setTimeRange(TimeUnit); protected: bool event(QEvent*); @@ -87,6 +91,7 @@ signals: private: void setupScrollArea(); void autoSetGeometry(); //在缩放和移动时以其它panel和parent的border为依据自动调整 + void createDataWidget(DataPanelType); bool m_bMouseEnter; bool m_bConfigurationComplete; diff --git a/include/dateTimeWidget.h b/include/dateTimeWidget.h index 67cedea..3945d7a 100644 --- a/include/dateTimeWidget.h +++ b/include/dateTimeWidget.h @@ -20,7 +20,7 @@ public: DateTimeWidget(QWidget *parent = nullptr); ~DateTimeWidget(); - void setDateTime(QDateTime); + void setDateTime(const QDateTime&); void setState(DateTimeWidgetState); void setRange(TimeUnit); diff --git a/include/panelSelectionDialog.h b/include/panelSelectionDialog.h index 8b5f35c..ff455a3 100644 --- a/include/panelSelectionDialog.h +++ b/include/panelSelectionDialog.h @@ -2,6 +2,7 @@ #define PANELSELECTIONDIALOG_H #include +#include "dataPanel/dpGlobals.h" QT_BEGIN_NAMESPACE namespace Ui { @@ -21,7 +22,7 @@ protected: //void showEvent(QShowEvent*); signals: - void panelType(const QString&); + void panelType(DataPanelType); void sgl_hide(); public slots: @@ -29,6 +30,8 @@ public slots: void onBtnClicked_cancle(); private: + void initList(); + Ui::panelSelectionDialog* ui; }; diff --git a/source/dashboard.cpp b/source/dashboard.cpp index 70c8af4..b221cad 100644 --- a/source/dashboard.cpp +++ b/source/dashboard.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #define tabButtonHeight 41 Dashboard::Dashboard(const QString& strName, QObject *parent) @@ -134,9 +135,9 @@ void Dashboard::setActive(bool bActive) m_pTab->setActive(bActive); } -void Dashboard::addPanel(const QString& strType) +void Dashboard::addPanel(DataPanelType type) { - DataPanel* panel = new DataPanel(m_pDisplayArea); + DataPanel* panel = new DataPanel(m_pDisplayArea, type); connect(panel, SIGNAL(sgl_remove(const QString&)), this, SLOT(onSignal_removePanel(const QString&))); QString strDefaultName = "dataPanel-" + QString::number(m_nPanenlNameNumber); m_nPanenlNameNumber++; @@ -178,6 +179,18 @@ void Dashboard::resizePanel(double ratioX, double ratioY) m_dataPanels.at(n)->resizeByRatio(ratioX, ratioY); } +void Dashboard::setDateTime(const QDateTime& dateTime) +{ + for(int n = 0; n < m_dataPanels.count(); n++) + m_dataPanels.at(n)->setDateTime(dateTime); +} + +void Dashboard::setTimeRange(TimeUnit unit) +{ + for(int n = 0; n < m_dataPanels.count(); n++) + m_dataPanels.at(n)->setTimeRange(unit); +} + void Dashboard::contextMenu_tab(const QPoint& pos) { QPoint originPoint = m_pTab->mapToGlobal(QPoint(0, 0)); diff --git a/source/dashboardFrame.cpp b/source/dashboardFrame.cpp index 2a8a589..469e671 100644 --- a/source/dashboardFrame.cpp +++ b/source/dashboardFrame.cpp @@ -492,7 +492,7 @@ void DashboardFrame::onBtnClicked_addDataPanel() m_pPanelSelectionDialog = new PanelSelectionDialog(this); m_pPanelSelectionDialog->installEventFilter(this); connect(m_pPanelSelectionDialog, SIGNAL(sgl_hide()), this, SLOT(onSignal_subDialogClose())); - connect(m_pPanelSelectionDialog, SIGNAL(panelType(const QString&)), this, SLOT(onSignal_panelSelectResult(const QString&))); + connect(m_pPanelSelectionDialog, SIGNAL(panelType(DataPanelType)), this, SLOT(onSignal_panelSelectResult(DataPanelType))); } showTransparentMask(); @@ -557,6 +557,8 @@ void DashboardFrame::onTimeout_realTime() QDateTime curDateTime = QDateTime::currentDateTime(); m_pDateTimeWidget->setDateTime(curDateTime); m_pTimeLineWidget->setDateTime(curDateTime); + if(m_curActiveDashboard) + m_curActiveDashboard->setDateTime(curDateTime); } void DashboardFrame::onSignal_subDialogClose() @@ -627,11 +629,11 @@ void DashboardFrame::onSignal_renameDashboard() m_pDashboardNamingDialog->raise(); } -void DashboardFrame::onSignal_panelSelectResult(const QString& strType) +void DashboardFrame::onSignal_panelSelectResult(DataPanelType type) { //m_pPanelSelectionDialog->hide(); hideTransparentMask(); - m_curActiveDashboard->addPanel(strType); + m_curActiveDashboard->addPanel(type); } void DashboardFrame::onSignal_timeRangeChanged(TimeUnit unit) @@ -645,6 +647,9 @@ void DashboardFrame::onSignal_timeRangeChanged(TimeUnit unit) { m_pDateTimeWidget->setRange(unit); } + + if(m_curActiveDashboard) + m_curActiveDashboard->setTimeRange(unit); } void DashboardFrame::onSignal_viewRealTimeData() diff --git a/source/dataPanel.cpp b/source/dataPanel.cpp index a4ba18e..2f4afaa 100644 --- a/source/dataPanel.cpp +++ b/source/dataPanel.cpp @@ -5,6 +5,8 @@ #include "customBorderContainer.h" #include "customMenu.h" +#include "dataPanel/dpLineChart.h" + #include #include #include @@ -25,7 +27,7 @@ PanelToolWidget::~PanelToolWidget() } -DataPanel::DataPanel(QWidget *parent) +DataPanel::DataPanel(QWidget *parent, DataPanelType type) : QDialog(parent) { setWindowFlags(Qt::FramelessWindowHint | Qt::SubWindow); @@ -40,14 +42,14 @@ DataPanel::DataPanel(QWidget *parent) centralWidget->setObjectName("centralWidget"); centralWidget->setStyleSheet("QWidget #centralWidget{\n" " border:2px solid rgb(76,88,105);\n" - " background-color:rgba(36,43,50,250);\n" + " background-color:rgba(24,32,38,250);\n" "}\n"); QBoxLayout* centralLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); centralLayout->setContentsMargins(0, 0, 0, 0); centralLayout->addWidget(centralWidget); setLayout(centralLayout); - m_pLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); - m_pLayout->setContentsMargins(0, 0, 0, 0); + m_pLayout = new QBoxLayout(QBoxLayout::TopToBottom, centralWidget); + m_pLayout->setContentsMargins(10, 5, 10, 10); m_pLayout->setSpacing(0); centralWidget->setLayout(m_pLayout); @@ -70,6 +72,8 @@ DataPanel::DataPanel(QWidget *parent) m_pToolMenu->addAction(QString::fromWCharArray(L"移除面板"), this, SLOT(onAction_remove())); //m_pToolMenu->addAction(QString::fromWCharArray(L"放置最前"), this, SLOT(onAction_moveToFront())); m_pToolMenu->addAction(QString::fromWCharArray(L"放置最后"), this, SLOT(onAction_moveToBack())); + + createDataWidget(type); } DataPanel::~DataPanel() @@ -181,6 +185,21 @@ void DataPanel::autoSetGeometry() } +void DataPanel::createDataWidget(DataPanelType type) +{ + switch(type) + { + case lineChart: + { + dpLineChart* lineChart = new dpLineChart(this); + setWiget(lineChart); + break; + } + default: + break; + } +} + void DataPanel::setWiget(QWidget* pWidget, eInsertMode InsertMode) { if(m_pContentWidget) @@ -303,6 +322,20 @@ void DataPanel::resizeByNewSize(const QSize& newSize) resizeByRatio(ratioX, ratioY); } +void DataPanel::setDateTime(const QDateTime& dateTime) +{ + dpBaseWidget* baseWidget = qobject_cast(m_pContentWidget); + if(baseWidget) + baseWidget->setDateTime(dateTime); +} + +void DataPanel::setTimeRange(TimeUnit unit) +{ + dpBaseWidget* baseWidget = qobject_cast(m_pContentWidget); + if(baseWidget) + baseWidget->setTimeRange(unit); +} + void DataPanel::onToolBtnClicked_setting() { diff --git a/source/dateTimeWidget.cpp b/source/dateTimeWidget.cpp index b34df90..5682b9b 100644 --- a/source/dateTimeWidget.cpp +++ b/source/dateTimeWidget.cpp @@ -130,7 +130,7 @@ void DateTimeWidget::setState(DateTimeWidgetState state) } } -void DateTimeWidget::setDateTime(QDateTime dateTime) +void DateTimeWidget::setDateTime(const QDateTime& dateTime) { QString strTime = dateTime.time().toString("HH:mm:ss"); ui->label_time->setText(strTime); diff --git a/source/panelSelectionDialog.cpp b/source/panelSelectionDialog.cpp index f0ac6c4..6aed9f3 100644 --- a/source/panelSelectionDialog.cpp +++ b/source/panelSelectionDialog.cpp @@ -1,6 +1,8 @@ #include "panelSelectionDialog.h" #include "ui_panelSelectionDialog.h" +#define panelTye 1 + PanelSelectionDialog::PanelSelectionDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::panelSelectionDialog) @@ -8,8 +10,8 @@ PanelSelectionDialog::PanelSelectionDialog(QWidget *parent) ui->setupUi(this); setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); setAttribute(Qt::WA_TranslucentBackground); - if(ui->listWidget->count() > 0) - ui->listWidget->setCurrentRow(0); + + initList(); connect(ui->btnConfirm, SIGNAL(clicked()), this, SLOT(onBtnClicked_confirm())); connect(ui->btnCancle, SIGNAL(clicked()), this, SLOT(onBtnClicked_cancle())); @@ -20,6 +22,41 @@ PanelSelectionDialog::~PanelSelectionDialog() delete ui; } +void PanelSelectionDialog::initList() +{ + ui->listWidget->clear(); + + QListWidgetItem* item = new QListWidgetItem(QString::fromWCharArray(L"折线图")); + item->setData(Qt::UserRole + panelTye, lineChart); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"曲线图")); + item->setData(Qt::UserRole + panelTye, curveChart); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"柱状图")); + item->setData(Qt::UserRole + panelTye, barChart); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"点状图")); + item->setData(Qt::UserRole + panelTye, dotChart); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"饼状图")); + item->setData(Qt::UserRole + panelTye, pieChart); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"热力图")); + item->setData(Qt::UserRole + panelTye, heatMap); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"仪表盘")); + item->setData(Qt::UserRole + panelTye, dial); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"数据表")); + item->setData(Qt::UserRole + panelTye, table); + ui->listWidget->addItem(item); + item = new QListWidgetItem(QString::fromWCharArray(L"地图")); + item->setData(Qt::UserRole + panelTye, map); + ui->listWidget->addItem(item); + + ui->listWidget->setCurrentRow(0); +} + // void PanelSelectionDialog::showEvent(QShowEvent* event) // { // Q_UNUSED(event); @@ -32,10 +69,10 @@ void PanelSelectionDialog::onBtnClicked_confirm() QListWidgetItem* item = ui->listWidget->currentItem(); if(item) { - QString strType = item->text(); + DataPanelType type = (DataPanelType)item->data(Qt::UserRole + panelTye).toInt(); ui->listWidget->setCurrentRow(0); hide(); - emit panelType(strType); + emit panelType(type); } } diff --git a/ui/panelSelectionDialog.ui b/ui/panelSelectionDialog.ui index 3b7d14f..bacd793 100644 --- a/ui/panelSelectionDialog.ui +++ b/ui/panelSelectionDialog.ui @@ -7,7 +7,7 @@ 0 0 427 - 344 + 365 @@ -94,7 +94,7 @@ border-right:0px; 330 - 300 + 320 71 26 @@ -128,7 +128,7 @@ background-color:rgb(24,32,38); 240 - 300 + 320 71 26 @@ -164,7 +164,7 @@ background-color:rgb(67,160,249); 40 70 341 - 211 + 231 @@ -175,6 +175,11 @@ background-color:rgb(67,160,249); 折线图 + + + 曲线图 + + 柱状图 diff --git a/util/TimeLine/timeLineItem.cpp b/util/TimeLine/timeLineItem.cpp index 1c20c97..8c9b398 100644 --- a/util/TimeLine/timeLineItem.cpp +++ b/util/TimeLine/timeLineItem.cpp @@ -584,7 +584,7 @@ void TimeLineItem::setState(DateTimeWidgetState state) d_ptr->m_curState = state; } -void TimeLineItem::setTime(QDateTime time) +void TimeLineItem::setTime(const QDateTime& time) { if(time > QDateTime::currentDateTime()) return; diff --git a/util/TimeLine/timeLineItem.h b/util/TimeLine/timeLineItem.h index 5bf1d77..799d2a4 100644 --- a/util/TimeLine/timeLineItem.h +++ b/util/TimeLine/timeLineItem.h @@ -35,7 +35,7 @@ public: void setScaleSize(int); void setState(DateTimeWidgetState); - void setTime(QDateTime); + void setTime(const QDateTime&); QDateTime time(); qint64 getOffsetTimeValue(int); //获取时间的偏移值(相对当前时间,在鼠标移动拖拽时调用,通过拖拽时同步更改当前时间继而重绘时间轴从而模拟出拖拽效果) diff --git a/util/TimeLine/timeLineWidget.cpp b/util/TimeLine/timeLineWidget.cpp index 8fc953c..f4b7adf 100644 --- a/util/TimeLine/timeLineWidget.cpp +++ b/util/TimeLine/timeLineWidget.cpp @@ -127,7 +127,7 @@ void TimeLineWidget::setTimeScaleUnit(TimeUnit unit) d_ptr->m_timeLineItem->setTimeUnit(unit); } -void TimeLineWidget::setDateTime(QDateTime dateTime) +void TimeLineWidget::setDateTime(const QDateTime& dateTime) { d_ptr->m_timeLineItem->setTime(dateTime); } diff --git a/util/TimeLine/timeLineWidget.h b/util/TimeLine/timeLineWidget.h index e9652f5..e009892 100644 --- a/util/TimeLine/timeLineWidget.h +++ b/util/TimeLine/timeLineWidget.h @@ -19,7 +19,7 @@ public: void setTimeScaleSize(int); //设置时间刻度大小(像素) void setTimeScaleUnit(TimeUnit); //设置时间刻度单位 - void setDateTime(QDateTime); + void setDateTime(const QDateTime&); void setDisplayState(DateTimeWidgetState); void syncTimeUnit();