PlotnikovPhilipp

Untitled

Mar 31st, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #include "widgetOfSecondScreen.hpp"
  2.  
  3. WidgetOfSecondScreen::WidgetOfSecondScreen(QScrollArea* psa, WidgetOfSecondScreen* pointer) :QWidget(pointer) {
  4.  
  5. /**
  6. * Install the fixed size for one of details of second screen
  7. */
  8.  
  9. this->setFixedSize(QApplication::desktop()->availableGeometry(psa).width(), QApplication::desktop()->availableGeometry(psa).height()/5);
  10. QPalette plt;
  11. plt.setColor(this->backgroundRole(), gray);
  12. this->setPalette(plt);
  13. this->setAutoFillBackground(true);
  14.  
  15. QSvgWidget* pSvg = new QSvgWidget(":/resources/Icons/money.svg", this);
  16. pSvg->setFixedSize(this->height()/10*55/10/10*55/10, this->height()/10*55/10/10*34/10);
  17. pSvg->setStyleSheet("background: transparent; position: absolute; margin: 41% 0% 0% 13%;");
  18.  
  19. connect(pSvg->renderer(), SIGNAL(repaintNeeded()), pSvg, SLOT(repaint()));
  20. }
  21.  
  22. /**
  23. * Create the event of press of mouse
  24. */
  25.  
  26. void WidgetOfSecondScreen::mousePressEvent(QMouseEvent *pe) {
  27. Q_UNUSED(pe);
  28.  
  29. }
  30.  
  31. /**
  32. * Create the event of paint event
  33. */
  34.  
  35. void WidgetOfSecondScreen::paintEvent(QPaintEvent *pp) {
  36. Q_UNUSED(pp);
  37. QPainter painter(this);
  38. painter.setRenderHint(QPainter::Antialiasing, true);
  39. painter.setPen(QPen(black, 4, SolidLine));
  40. painter.setBrush(QBrush(red, SolidPattern));
  41. painter.drawEllipse(this->width()/10*9/10, this->height()/10*23/10, this->height()/10*55/10, this->height()/10*55/10);
  42. }
  43.  
  44. /*
  45. * Create the deconstructor
  46. */
  47.  
  48. WidgetOfSecondScreen::~WidgetOfSecondScreen() {
  49. delete this;
  50. }
Add Comment
Please, Sign In to add comment