widget.cpp 633 B

12345678910111213141516171819202122232425262728
  1. #include "widget.h"
  2. #include "ui_widget.h"
  3. #include <QHBoxLayout>
  4. Widget::Widget(QWidget *parent)
  5. : QWidget(parent)
  6. , ui(new Ui::Widget)
  7. {
  8. ui->setupUi(this);
  9. setAttribute(Qt::WA_TranslucentBackground);
  10. setStyleSheet("QWidget { background: transparent; }");
  11. QHBoxLayout *layout = new QHBoxLayout(this);
  12. layout->setContentsMargins(50, 50, 50, 50);
  13. layout->setSpacing(0);
  14. priBtn = new QAntPrimaryButton(this);
  15. priBtn->setText("Hello world");
  16. priBtn->setFixedSize(200, 100);
  17. layout->addWidget(priBtn, 0, Qt::AlignCenter);
  18. setLayout(layout);
  19. }
  20. Widget::~Widget()
  21. {
  22. delete ui;
  23. }