• Qtday1


    1. #include "mywidget.h"
    2. MyWidget::MyWidget(QWidget *parent)
    3. : QWidget(parent)
    4. {
    5. //设置窗口
    6. this->resize(530, 416);
    7. this->setWindowFlag(Qt::FramelessWindowHint);
    8. this->setWindowIcon(QIcon("D:\\c++qt\\picture\\genshin.png"));
    9. this->setStyleSheet("background-color:rgb(250,250,250)");
    10. //设置标签
    11. QLabel *lab1 = new QLabel(this);
    12. lab1->resize(530,168);
    13. QMovie *mv = new QMovie("D:\\c++qt\\picture\\leishen.gif");
    14. lab1->setMovie(mv);
    15. mv->start();
    16. lab1->setScaledContents(true);
    17. QLabel *lab2 = new QLabel(this);
    18. lab2->setPixmap(QPixmap("D:\\c++qt\\picture\\genshin.png"));
    19. lab2->resize(25, 25);
    20. lab2->setScaledContents(true);
    21. lab2->move(20,20);
    22. QLabel *lab3 = new QLabel("原神", this);
    23. lab3->resize(30,25);
    24. lab3->setScaledContents(true);
    25. lab3->move(55, 20);
    26. lab3->setStyleSheet("background:transparent");
    27. //设置行编辑器
    28. QLineEdit *ed1 = new QLineEdit(this);
    29. ed1->resize(280, 30);
    30. ed1->move(144, 218);
    31. ed1->setPlaceholderText("账号\\手机号");
    32. QLineEdit *ed2 = new QLineEdit(this);
    33. ed2->resize(280, 30);
    34. ed2->move(144, 248);
    35. ed2->setPlaceholderText("密码");
    36. ed2->setEchoMode(QLineEdit::Password);
    37. //设置行编辑器前面的标签
    38. QLabel *lab4 = new QLabel(this);
    39. lab4->resize(25, 25);
    40. lab4->setPixmap(QPixmap("D:\\c++qt\\picture\\OIP-C.jpg"));
    41. lab4->move(115, 220);
    42. lab4->setScaledContents(true);
    43. QLabel *lab5 = new QLabel(this);
    44. lab5->resize(25, 25);
    45. lab5->setPixmap(QPixmap("D:\\c++qt\\picture\\suo.jpg"));
    46. lab5->move(115, 250);
    47. lab5->setScaledContents(true);
    48. QLabel *lab6 = new QLabel("自动登录", this);
    49. lab6->resize(70, 25);
    50. lab6->move(140, 290);
    51. lab6->setScaledContents(true);
    52. QLabel *lab7 = new QLabel("记住密码", this);
    53. lab7->resize(70, 25);
    54. lab7->move(250, 290);
    55. lab7->setScaledContents(true);
    56. QLabel *lab8 = new QLabel("找回密码", this);
    57. lab8->resize(70, 25);
    58. lab8->move(365, 290);
    59. lab8->setScaledContents(true);
    60. QLabel *lab9 = new QLabel(this);
    61. lab9->setPixmap(QPixmap("D:\\c++qt\\picture\\QQerweima.png"));
    62. lab9->resize(35, 35);
    63. lab9->move(480, 365);
    64. lab9->setScaledContents(true);
    65. //头像
    66. QLabel *lab10 = new QLabel(this);
    67. lab10->setPixmap(QPixmap("D:\\c++qt\\picture\\xiao.jpg"));
    68. lab10->resize(100, 100);
    69. lab10->move(220, 110);
    70. lab10->setScaledContents(true);
    71. QLabel *lab11 = new QLabel("注册账号", this);
    72. lab11->resize(60, 30);
    73. lab11->move(15, 380);
    74. lab11->setScaledContents(true);
    75. lab11->setStyleSheet("background:transparent");
    76. //创建按钮
    77. QPushButton *btn1 = new QPushButton("登录", this);
    78. btn1->resize(300, 40);
    79. btn1->move(120, 330);
    80. btn1->setStyleSheet("background-color:rgb(32, 212, 255); border-radius:5");
    81. }
    82. MyWidget::~MyWidget()
    83. {
    84. }

  • 相关阅读:
    HCIP实验(09)
    TCP/IP_第八章_静态路由_实验案例二
    Ruby语言建立Web服务器
    跨境电商影响搜索排名的因素有哪些
    【PAT(甲级)】1056 Mice and Rice
    Step 1 搭建一个简单的渲染框架
    spring cloud 快速上手系列 -> 03-消息队列 Stream -> 032-使用spring cloud bus实现配置中心热刷新-Server
    appium用例参数化
    DataFrame与DataSet的互操作_大数据培训
    DAY06_瑞吉外卖——用户地址簿功能&菜品展示&购物车&下单
  • 原文地址:https://blog.csdn.net/darkestdying/article/details/133866733