Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Telemetry
KUserFeedback
Commits
c4d0d33d
Commit
c4d0d33d
authored
Feb 12, 2017
by
Volker Krause
Browse files
Add UI infrastructure for singluar charts
parent
34a0761f
Changes
5
Hide whitespace changes
Inline
Side-by-side
analyzer/analytics/analyticsview.cpp
View file @
c4d0d33d
...
...
@@ -53,6 +53,7 @@ AnalyticsView::AnalyticsView(QWidget* parent) :
ui
->
aggregatedDataView
->
setModel
(
m_aggregatedDataModel
);
m_timeAggregationModel
->
setSourceModel
(
m_dataModel
);
connect
(
m_timeAggregationModel
,
&
QAbstractItemModel
::
modelReset
,
this
,
&
AnalyticsView
::
updateTimeSliderRange
);
ui
->
actionAggregateYear
->
setData
(
TimeAggregationModel
::
AggregateYear
);
ui
->
actionAggregateMonth
->
setData
(
TimeAggregationModel
::
AggregateMonth
);
...
...
@@ -108,7 +109,10 @@ AnalyticsView::AnalyticsView(QWidget* parent) :
AnalyticsView
::~
AnalyticsView
()
{
disconnect
(
ui
->
chartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
if
(
ui
->
singularChartView
->
chart
())
disconnect
(
ui
->
singularChartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
if
(
ui
->
timelineChartView
->
chart
())
disconnect
(
ui
->
timelineChartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
QSettings
settings
;
settings
.
beginGroup
(
QStringLiteral
(
"Analytics"
));
...
...
@@ -173,17 +177,27 @@ void AnalyticsView::updateChart()
if
(
!
aggr
)
return
;
if
(
ui
->
chartView
->
chart
())
disconnect
(
ui
->
chartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
if
(
ui
->
singularChartView
->
chart
())
disconnect
(
ui
->
singularChartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
if
(
ui
->
timelineChartView
->
chart
())
disconnect
(
ui
->
timelineChartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
if
(
ui
->
actionTimelineChart
->
isChecked
())
{
ui
->
chartView
->
setChart
(
aggr
->
timelineChart
());
ui
->
timelineChartView
->
setChart
(
aggr
->
timelineChart
());
connect
(
ui
->
timelineChartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
ui
->
chartStack
->
setCurrentWidget
(
ui
->
timelinePage
);
}
else
if
(
ui
->
actionSingularChart
->
isChecked
())
{
ui
->
chartView
->
setChart
(
aggr
->
singlularChart
());
ui
->
singularChartView
->
setChart
(
aggr
->
singlularChart
());
connect
(
ui
->
singularChartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
ui
->
chartStack
->
setCurrentWidget
(
ui
->
singularPage
);
}
}
if
(
ui
->
chartView
->
chart
())
connect
(
ui
->
chartView
->
chart
(),
&
QObject
::
destroyed
,
this
,
&
AnalyticsView
::
updateChart
);
void
AnalyticsView
::
updateTimeSliderRange
()
{
qDebug
()
<<
m_timeAggregationModel
->
rowCount
()
<<
ui
->
timeSlider
->
maximum
()
<<
ui
->
timeSlider
->
minimum
();
if
(
m_timeAggregationModel
->
rowCount
()
>
0
)
ui
->
timeSlider
->
setRange
(
0
,
m_timeAggregationModel
->
rowCount
()
-
1
);
}
Aggregator
*
AnalyticsView
::
createAggregator
(
const
Aggregation
&
aggr
)
const
...
...
analyzer/analytics/analyticsview.h
View file @
c4d0d33d
...
...
@@ -57,6 +57,7 @@ signals:
private:
void
chartSelected
();
void
updateChart
();
void
updateTimeSliderRange
();
Aggregator
*
createAggregator
(
const
Aggregation
&
aggr
)
const
;
...
...
analyzer/analytics/analyticsview.ui
View file @
c4d0d33d
...
...
@@ -51,10 +51,59 @@
</layout>
</item>
<item>
<widget
class=
"Q
tCharts::QChartView
"
name=
"chart
View
"
>
<property
name=
"
renderHints
"
>
<
set>
QPainter::Antialiasing|QPainter::TextAntialiasing
</set
>
<widget
class=
"Q
StackedWidget
"
name=
"chart
Stack
"
>
<property
name=
"
currentIndex
"
>
<
number>
0
</number
>
</property>
<widget
class=
"QWidget"
name=
"timelinePage"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<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=
"QtCharts::QChartView"
name=
"timelineChartView"
>
<property
name=
"renderHints"
>
<set>
QPainter::Antialiasing|QPainter::TextAntialiasing
</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"singularPage"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<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=
"QtCharts::QChartView"
name=
"singularChartView"
/>
</item>
<item>
<widget
class=
"QSlider"
name=
"timeSlider"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
...
...
analyzer/analytics/categoryaggregator.cpp
View file @
c4d0d33d
...
...
@@ -38,7 +38,7 @@ Aggregator::ChartModes CategoryAggregator::chartModes() const
{
Aggregator
::
ChartModes
modes
=
None
;
if
(
aggregation
().
elements
().
size
()
==
1
)
modes
|=
Timeline
;
modes
|=
Timeline
|
Singular
;
return
modes
;
}
...
...
@@ -103,3 +103,16 @@ QtCharts::QChart* CategoryAggregator::timelineChart()
return
m_timelineChart
.
get
();
}
QtCharts
::
QChart
*
CategoryAggregator
::
singlularChart
()
{
if
(
m_singlularChart
)
return
m_singlularChart
.
get
();
m_singlularChart
.
reset
(
new
QChart
);
m_singlularChart
->
setTheme
(
qApp
->
palette
().
color
(
QPalette
::
Window
).
lightnessF
()
<
0.25
?
QChart
::
ChartThemeDark
:
QChart
::
ChartThemeLight
);
// TODO
return
m_singlularChart
.
get
();
}
analyzer/analytics/categoryaggregator.h
View file @
c4d0d33d
...
...
@@ -37,10 +37,12 @@ public:
QString
displayName
()
const
override
;
QAbstractItemModel
*
timeAggregationModel
()
override
;
QtCharts
::
QChart
*
timelineChart
()
override
;
QtCharts
::
QChart
*
singlularChart
()
override
;
private:
std
::
unique_ptr
<
CategoryAggregationModel
>
m_model
;
std
::
unique_ptr
<
QtCharts
::
QChart
>
m_timelineChart
;
std
::
unique_ptr
<
QtCharts
::
QChart
>
m_singlularChart
;
};
}}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment