-
Notifications
You must be signed in to change notification settings - Fork 6
/
GISLegendView.cpp
executable file
·54 lines (35 loc) · 1.23 KB
/
GISLegendView.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "GISLegendView.h"
#include <QHeaderView>
GISLegendView::GISLegendView(QWidget *parent) : QTreeView(parent)
{
this->setSizeAdjustPolicy(SizeAdjustPolicy::AdjustToContents);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
this->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
this->hide();
this->setEditTriggers(EditTrigger::NoEditTriggers);
this->setSelectionMode(SelectionMode::NoSelection);
this->setStyleSheet("border: 1px solid transparent;"
"border-radius: 10px;"
"background: rgba(255, 255, 255, 150);");
this->setObjectName("legendView");
this->header()->setObjectName("legendView");
}
QSize GISLegendView::sizeHint() const
{
if(model() == nullptr)
return QSize();
if (model()->rowCount() == 0)
return QSize(sizeHintForColumn(0)*1.15, 0);
int nToShow = model()->rowCount()+1;
auto widthLegend = sizeHintForColumn(0)*1.15;
auto heightLegend = nToShow*sizeHintForRow(0)*1.2;
return QSize(widthLegend,heightLegend);
}
void GISLegendView::clear(void)
{
this->hide();
}
QIdentityProxyModel *GISLegendView::getProxyModel() const
{
return nullptr;
}