-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialoglist.cpp
64 lines (55 loc) · 1.9 KB
/
dialoglist.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
#include "dialoglist.h"
#include "ui_dialoglist.h"
#include <QToolButton>
#include <widget.h>
#include <QMessageBox>
DialogList::DialogList(QWidget *parent) :
QWidget(parent),
ui(new Ui::DialogList)
{
ui->setupUi(this);
this->setWindowTitle("深度QQ v1.0");
this->setWindowIcon(QPixmap(":/images/QQ_Penguin.png"));
QList<QString>nameList;
nameList << "水票奇缘" << "忆梦如澜" <<"北京出版人"<<"Cherry"<<"淡然"
<<"娇娇girl"<<"落水无痕"<<"青墨暖暖";
QStringList iconNameList; //图标资源列表
iconNameList << "spqy"<< "ymrl" <<"qq" <<"Cherry"<< "dr"
<<"jj"<<"lswh"<<"qmnn";
QVector<QToolButton*> vToolBtn;
for (int i=0;i<8;++i)
{
QToolButton* btn = new QToolButton;
btn->setText(nameList.at(i));
QString str = QString(":/images/%1.png").arg(iconNameList.at(i));
btn->setIcon(QPixmap(str));
btn->setIconSize(QPixmap(str).size());
btn->setAutoRaise(true);
btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
vToolBtn.push_back(btn);
isShow.push_back(false);
ui->verticalLayout->addWidget(btn);
}
for (int i=0; i<vToolBtn.size();++i)
{
connect(vToolBtn[i],&QToolButton::clicked, this, [=](){
if(isShow[i])
{
QMessageBox::warning(this, "警告", "窗口已经打开");
return;
}
isShow[i] = true;
Widget* chatWidget = new Widget(0, vToolBtn[i]->text());
chatWidget->setWindowTitle(vToolBtn[i]->text());
chatWidget->setWindowIcon(vToolBtn[i]->icon());
chatWidget->show();
connect(chatWidget, &Widget::widgetClose, this,[=](){
isShow[i]=false;
});
});
}
}
DialogList::~DialogList()
{
delete ui;
}