forked from bnufree/Hq
-
Notifications
You must be signed in to change notification settings - Fork 1
/
northbundwidget.cpp
61 lines (51 loc) · 2.09 KB
/
northbundwidget.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
54
55
56
57
58
59
60
#include "northbundwidget.h"
#include "real/qnorthflowinfodisplaywidget.h"
#include <QHeaderView>
#include <QApplication>
#include <QDesktopWidget>
#include "data_structure/hqutils.h"
#include "table/northboundtop10displaywidget.h"
#include "qandroidbutton.h"
#include "qandroidlistwidget.h"
#include <QVBoxLayout>
#include <QTimer>
#include "table/qshareforeignvoltablewidget.h"
NorthBundWidget::NorthBundWidget(QWidget *parent) : QWidget(parent)
{
QVBoxLayout* vlay = new QVBoxLayout(this);
this->setLayout(vlay);
int frameHeight = HqUtils::convertMM2Pixel(10.0);
mCtrlBtn = new QAndroidButton(this);
mCtrlBtn->setAlignment(Qt::AlignCenter);
mCtrlBtn->setFixedHeight(frameHeight);
vlay->addWidget(mCtrlBtn);
connect(mCtrlBtn, &QAndroidButton::clicked, this, &NorthBundWidget::slotMarketBtnClicked);
mWidgetList = new QStackedWidget(this);
vlay->addWidget(mWidgetList);
int index = mWidgetList->addWidget(new QNorthFlowInfoDisplayWidget(this));
mWidgetList->widget(index)->setFixedHeight(QApplication::desktop()->availableGeometry().height() *0.50);
index = mWidgetList->addWidget(new NorthBoundTop10DisplayWidget(this));
index = mWidgetList->addWidget(new LGTVolDisplayWidget(this));
mTypeList = new QAndroidListWidget(0, 0, this);
mTypeList->addItem(QStringLiteral("北向实时"), North_RealTime);
mTypeList->addItem(QStringLiteral("北向成交"), North_Top10);
mTypeList->addItem(QStringLiteral("北向持股"), North_Vol);
connect(mTypeList, SIGNAL(signalItemClicked(QString,int)), this, SLOT(slotMarketTypeChanged(QString, int)));
mTypeList->hide();
QTimer::singleShot(100, mTypeList, SLOT(slotFirstBtnClicked()));
}
void NorthBundWidget::slotMarketBtnClicked()
{
if(mTypeList)
{
mTypeList->setFixedWidth(this->width());
mTypeList->move(mCtrlBtn->geometry().bottomLeft());
mTypeList->setVisible(true);
}
}
void NorthBundWidget::slotMarketTypeChanged(const QString& text, int type)
{
if(mTypeList) mTypeList->setVisible(false);
mCtrlBtn->setText(text);
mWidgetList->setCurrentIndex(type);
}