-
Notifications
You must be signed in to change notification settings - Fork 5
/
mainWindow.cpp
97 lines (91 loc) · 3.51 KB
/
mainWindow.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "mainWindow.h"
mainWindow::mainWindow(QWidget *parent)
: QWidget(parent)
{
//qMsgbox_info();
ui_mainWindow.setupUi(this);
connect(ui_mainWindow.btn_mainMenu_load, &QPushButton::clicked, this, &mainWindow::mainMenuChanged);
connect(ui_mainWindow.btn_mainMenu_list, &QPushButton::clicked, this, &mainWindow::mainMenuChanged);
connect(ui_mainWindow.btn_mainMenu_workList, &QPushButton::clicked, this, &mainWindow::mainMenuChanged);
connect(ui_mainWindow.btn_mainMenu_settings, &QPushButton::clicked, this, &mainWindow::mainMenuChanged);
//p_tag_list = new QLabel(ui_mainWindow.btn_mainMenu_list);
mainWindow::reUi();
//test();
//test();
}
void mainWindow::reUi(void)
{
ui_mainWindow.btn_mainMenu_load->setChecked(true);//设置默认菜单
mainWindow::mainMenuChanged();//加载工作区
}
void mainWindow::mainMenuChanged(void)
{
workWidget_load* loadWidget = ui_mainWindow.widget_workWidget->findChild<workWidget_load*>();
workWidget_list* listWidget = ui_mainWindow.widget_workWidget->findChild<workWidget_list*>();
workWidget_workList* workListWidget = ui_mainWindow.widget_workWidget->findChild<workWidget_workList*>();
workWidget_settings* settingsWidget = ui_mainWindow.widget_workWidget->findChild<workWidget_settings*>();
if (loadWidget != NULL)
loadWidget->hide();
if (listWidget != NULL)
listWidget->hide();
if (workListWidget != NULL)
workListWidget->hide();
if (settingsWidget != NULL)
settingsWidget->hide();
if (ui_mainWindow.widget_workWidget->children().count() > 4)
QMessageBox::critical(this,"LUD-意外错误",
"一个意外的错误发生在mainWindow->mainMenuChanged()中, 子对象值不可能大于4\n建议您重启程序, 如果仍无法解决, 请反馈给开发者");
if (ui_mainWindow.btn_mainMenu_load->isChecked() == true)
{
if (loadWidget == NULL)
{
loadWidget = new workWidget_load;
}
loadWidget->setParent(ui_mainWindow.widget_workWidget);
loadWidget->show();
return;
}
if (ui_mainWindow.btn_mainMenu_list->isChecked() == true)
{
if (listWidget == NULL)
{
listWidget = new workWidget_list;
}
listWidget->setParent(ui_mainWindow.widget_workWidget);
listWidget->show();
return;
}
if (ui_mainWindow.btn_mainMenu_workList->isChecked() == true)
{
if (workListWidget == NULL)
{
workListWidget = new workWidget_workList;
}
workListWidget->setParent(ui_mainWindow.widget_workWidget);
workListWidget->show();
return;
}
if (ui_mainWindow.btn_mainMenu_settings->isChecked() == true)
{
if (settingsWidget == NULL)
{
settingsWidget = new workWidget_settings;
}
settingsWidget->setParent(ui_mainWindow.widget_workWidget);
settingsWidget->show();
return;
}
}
void mainWindow::test(void)
{
QByteArray data;
data = qNetwork_getHttpData("GET", "https://p1.music.126.net/Mw7z4vn0EMrWlitsiYgzPQ==/109951163606870393.jpg", false);
QFile file("E:/Programming/Workspace/repos/LUD/LUD/test.png");
file.open(QIODevice::WriteOnly);
file.write(data);
file.close();
QPixmap pixmap;
pixmap.loadFromData(data);
pixmap = pixmap.scaled(QSize(256, 256), Qt::KeepAspectRatio);
//ui.testLable->setPixmap(pixmap);
}