#include "serverwidget.h" ServerWidget::ServerWidget(const QString &domain, int port, QWidget *parent) : QWidget(parent) { deleted = 0; domainLineEdit = new QLineEdit(domain, this); portLineEdit = new QLineEdit(QString::number(port), this); removeButton = new QPushButton(QIcon(":/png/res/png/delete.png"), "", this); domainLineEdit->setFixedSize(360, 35); domainLineEdit->setStyleSheet(R"( border: 2px solid #DCD174; font-family: Inter; font-size: 15px; font-weight: 400; line-height: 31.47px; text-align: left; background: #00000000; color: #13385F; )"); portLineEdit->setFixedSize(150, 35); portLineEdit->setStyleSheet(R"( border: 2px solid #DCD174; font-family: Inter; font-size: 15px; font-weight: 400; line-height: 31.47px; text-align: left; background: #00000000; color: #13385F; )"); removeButton->setFixedSize(35, 35); removeButton->setStyleSheet(R"( border: none; background: #00000000; )"); QHBoxLayout *layout = new QHBoxLayout(this); layout->setSpacing(10); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(domainLineEdit); layout->addWidget(portLineEdit); layout->addWidget(removeButton); connect(removeButton, &QPushButton::clicked, this, [this]() { deleted = 1; emit removeWidget(this); }); setLayout(layout); } QString ServerWidget::getDomain() const { return domainLineEdit->text(); } QString ServerWidget::getPort() const { return portLineEdit->text(); } ServerWidget::~ServerWidget() { }