Advertisement
PlotnikovPhilipp

Untitled

Mar 26th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. #include <authorization.hpp>
  2.  
  3. Authorization::Authorization(Authorization* parent): QWidget(parent) {
  4.  
  5. /**
  6. * Create the common widget for next objects
  7. */
  8.  
  9. this->setFixedSize(QApplication::desktop()->width(), QApplication::desktop()->height());
  10.  
  11. /**
  12. * Create header label
  13. */
  14.  
  15. QLabel* plbl = new QLabel("MuseumQuest");
  16. plbl->setFixedSize(QApplication::desktop()->width(), QApplication::desktop()->height()/100*10);
  17. QPalette plt;
  18. plt.setColor(plbl->backgroundRole(), gray);
  19. plbl->setPalette(plt);
  20. plbl->setAutoFillBackground(true);
  21. plbl->setStyleSheet("color: black;");
  22. plbl->setAlignment(AlignCenter);
  23.  
  24. /**
  25. * Create label for Authoriztion
  26. */
  27.  
  28. QLabel* plbl2 = new QLabel("Регистрация");
  29. plbl2->setFixedWidth(QApplication::desktop()->width()/100*53);
  30. plbl2->setAlignment(AlignCenter);
  31. plbl2->setStyleSheet("color: black;");
  32.  
  33. /**
  34. * Create input field for name
  35. */
  36.  
  37. QLineEdit* pline1 = new QLineEdit;
  38. pline1->setObjectName("Name");
  39. pline1->setPlaceholderText("Введите ваше имя");
  40. pline1->setStyleSheet("border: none; border-bottom: 1px solid black; background-color: transparent;");
  41. pline1->setFixedWidth(QApplication::desktop()->width()/100*48);
  42.  
  43. /**
  44. * Create input field for password
  45. */
  46.  
  47. QLineEdit* pline2 = new QLineEdit;
  48. pline2->setObjectName("Password");
  49. pline2->setPlaceholderText("Введите пароль");
  50. pline2->setEchoMode(QLineEdit::Password);
  51. pline2->setFixedWidth(QApplication::desktop()->width()/100*48);
  52. pline2->setStyleSheet("border: none; border-bottom: 1px solid black; background-color: transparent;");
  53.  
  54. /**
  55. * Create the button
  56. */
  57.  
  58. QPushButton* pbtn = new QPushButton("Зарегистрироваться");
  59. pbtn->setFixedSize(QApplication::desktop()->width()/100*60, QApplication::desktop()->height()/100*6);
  60. pbtn->setCursor(PointingHandCursor);
  61. pbtn->setObjectName("Signing up");
  62. pbtn->setStyleSheet("background-color: gray; color: black; border-radius: 20px;");
  63.  
  64. /**
  65. * Create the last label
  66. */
  67.  
  68. QLabel* plbl3 = new QLabel("Войти в аккаунт");
  69. plbl3->setFixedWidth(QApplication::desktop()->width());
  70. plbl3->setAlignment(AlignCenter);
  71. plbl3->setCursor(PointingHandCursor);
  72. plbl3->setStyleSheet("color: black;");
  73.  
  74. /**
  75. * Create layout
  76. */
  77.  
  78. QVBoxLayout* pvbox = new QVBoxLayout;
  79. pvbox->setContentsMargins(0, 0, 0, 0);
  80.  
  81. pvbox->addWidget(plbl, 0, AlignCenter);
  82. pvbox->addSpacing(QApplication::desktop()->height()/100*6);
  83. pvbox->addWidget(plbl2, 0, AlignCenter);
  84. pvbox->addSpacing(QApplication::desktop()->height()/100*7);
  85. pvbox->addWidget(pline1, 0, AlignCenter);
  86. pvbox->addSpacing(QApplication::desktop()->height()/100*7);
  87. pvbox->addWidget(pline2, 0, AlignCenter);
  88. pvbox->addSpacing(QApplication::desktop()->height()/100*13);
  89. pvbox->addWidget(pbtn, 0, AlignCenter);
  90. pvbox->addSpacing(QApplication::desktop()->height()/100*7);
  91. pvbox->addWidget(plbl3, 0, AlignCenter);
  92.  
  93. pvbox->setAlignment(AlignTop | AlignHCenter);
  94.  
  95. this->setLayout(pvbox);
  96.  
  97. /**
  98. * Create connection to the server
  99. */
  100.  
  101. Client client(pline1, pline2);
  102.  
  103. connect(pbtn, SIGNAL(clicked()), &client, SLOT(slotSendToServer()));
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement