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

Method T_ListView

ElaWidgetToolsExample/ExamplePage/T_ListView.cpp:10–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "ElaText.h"
9#include "T_ListViewModel.h"
10T_ListView::T_ListView(QWidget* parent)
11 : T_BasePage(parent)
12{
13 // 预览窗口标题
14 setWindowTitle("ElaListView");
15
16 // 顶部元素
17 createCustomWidget("列表视图被放置于此,可在此界面体验其效果并按需添加进项目中");
18
19 //ElaListView
20 ElaText* listText = new ElaText("ElaListView", this);
21 listText->setTextPixelSize(18);
22 _listView = new ElaListView(this);
23 _listView->setFixedHeight(450);
24 // _listView->setAlternatingRowColors(true);
25 _listView->setModel(new T_ListViewModel(this));
26 ElaScrollBar* listViewFloatScrollBar = new ElaScrollBar(_listView->verticalScrollBar(), _listView);
27 listViewFloatScrollBar->setIsAnimation(true);
28 QHBoxLayout* listViewLayout = new QHBoxLayout();
29 listViewLayout->setContentsMargins(0, 0, 10, 0);
30 listViewLayout->addWidget(_listView);
31
32 QWidget* centralWidget = new QWidget(this);
33 centralWidget->setWindowTitle("ElaView");
34 QVBoxLayout* centerVLayout = new QVBoxLayout(centralWidget);
35 centerVLayout->setContentsMargins(0, 0, 0, 0);
36 centerVLayout->addWidget(listText);
37 centerVLayout->addSpacing(10);
38 centerVLayout->addLayout(listViewLayout);
39 centerVLayout->addStretch();
40 addCentralWidget(centralWidget, true, false, 0);
41}
42
43T_ListView::~T_ListView()
44{

Callers

nothing calls this directly

Calls 4

setFixedHeightMethod · 0.80
addWidgetMethod · 0.80
setTextPixelSizeMethod · 0.45
setIsAnimationMethod · 0.45

Tested by

no test coverage detected