MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / ElaNavigationBar

Method ElaNavigationBar

ElaWidgetTools/ElaNavigationBar.cpp:27–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25ELA_PROPERTY_Q_CPP(ElaNavigationBar, bool, IsAllowPageOpenInNewWindow)
26ElaNavigationBar::ElaNavigationBar(QWidget* parent)
27 : QWidget{parent}
28{
29 d_ptr.reset(new ElaNavigationBarPrivate());
30 Q_D(ElaNavigationBar);
31 d->q_ptr = this;
32 d->_pIsAllowPageOpenInNewWindow = true;
33 d->_pNavigationBarWidth = 300;
34 setFixedWidth(300);
35 d->_pIsTransparent = true;
36
37 //用户卡片
38 d->_userCard = new ElaInteractiveCard(this);
39 d->_userCard->setMinimumWidth(0);
40 d->_userCard->setCardPixmap(QPixmap(":/include/Image/Cirno.jpg"));
41 d->_userCard->setTitle("Ela 工具");
42 d->_userCard->setSubTitle("Liniyous@gmail.com");
43 connect(d->_userCard, &ElaInteractiveCard::clicked, this, &ElaNavigationBar::userInfoCardClicked);
44 d->_userButton = new ElaIconButton(QPixmap(":/include/Image/Cirno.jpg"), this);
45 d->_userButton->setFixedSize(36, 36);
46 d->_userButton->setVisible(false);
47 d->_userButton->setBorderRadius(8);
48 connect(d->_userButton, &ElaIconButton::clicked, this, &ElaNavigationBar::userInfoCardClicked);
49 d->_userCardLayout = new QVBoxLayout();
50 d->_userCardLayout->setContentsMargins(3, 10, 0, 5);
51 d->_userCardLayout->addWidget(d->_userButton, 0, Qt::AlignLeft);
52 d->_userCardLayout->addWidget(d->_userCard);
53
54 // 导航模型
55 d->_navigationModel = new ElaNavigationModel(this);
56 d->_navigationView = new ElaNavigationView(this);
57 d->_navigationView->setNavigationBarPrivate(d);
58 d->_navigationView->setModel(d->_navigationModel);
59 connect(d->_navigationView, &ElaNavigationView::navigationClicked, this, [=](const QModelIndex& index) {
60 d->onTreeViewClicked(index);
61 });
62 connect(d->_navigationView, &ElaNavigationView::navigationOpenNewWindow, d, &ElaNavigationBarPrivate::onNavigationOpenNewWindow);
63
64 // 页脚
65 d->_footerView = new ElaBaseListView(this);
66 d->_footerView->setFixedHeight(0);
67 d->_footerModel = new ElaFooterModel(this);
68 d->_footerView->setModel(d->_footerModel);
69 d->_footerDelegate = new ElaFooterDelegate(d->_footerView, this);
70 d->_footerView->setItemDelegate(d->_footerDelegate);
71 connect(d->_footerView, &ElaBaseListView::mousePress, this, [=](const QModelIndex& index) {
72 d->_footerDelegate->setPressIndex(index);
73 d->_footerView->viewport()->update();
74 });
75 connect(d->_footerView, &ElaBaseListView::mouseDoubleClick, this, [=](const QModelIndex& index) {
76 d->_footerDelegate->setPressIndex(index);
77 d->_footerView->viewport()->update();
78 });
79 connect(d->_footerView, &ElaBaseListView::mouseRelease, this, [=](const QModelIndex& index) {
80 d->_footerDelegate->setPressIndex(QModelIndex());
81 d->_footerView->viewport()->update();
82 });
83 connect(d->_footerView, &ElaBaseListView::clicked, this, [=](const QModelIndex& index) {
84 d->onFooterViewClicked(index);

Callers

nothing calls this directly

Calls 7

setFixedSizeMethod · 0.80
addWidgetMethod · 0.80
onTreeViewClickedMethod · 0.80
setFixedHeightMethod · 0.80
onFooterViewClickedMethod · 0.80
getThemeModeMethod · 0.80
setBorderRadiusMethod · 0.45

Tested by

no test coverage detected