41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#include "hpromptwidget.h"
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
|
|
HPromptWidget::HPromptWidget(QString info,QWidget *parent) : promptMessage(info),QWidget(parent)
|
|
{
|
|
initWidget();
|
|
}
|
|
|
|
void HPromptWidget::initWidget()
|
|
{
|
|
setFixedSize(350, 200);
|
|
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::MSWindowsFixedSizeDialogHint);
|
|
setStyleSheet("QWidget{background-color: rgb(30, 30, 30);}"
|
|
"QTextEdit{border-style: none;color:white; font-size:20px;}"
|
|
"QPushButton{color:white; font-size:20px;}");
|
|
|
|
okButton = new QPushButton("OK");
|
|
okButton->setFixedSize(80, 40);
|
|
|
|
infoLabel = new QTextEdit();
|
|
infoLabel->adjustSize();
|
|
infoLabel->setText(promptMessage);
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout();
|
|
layout->addWidget(infoLabel);
|
|
|
|
QHBoxLayout* layout1 = new QHBoxLayout();
|
|
layout1->addWidget(okButton,Qt::AlignCenter);
|
|
|
|
layout->addLayout(layout1);
|
|
setLayout(layout);
|
|
|
|
connect(okButton, &QPushButton::clicked, this, &HPromptWidget::closeWidget);
|
|
}
|
|
|
|
void HPromptWidget::closeWidget()
|
|
{
|
|
close();
|
|
}
|