iconhint.cpp 893 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "iconhint.h"
  2. #include <QDebug>
  3. IconHint::IconHint(QWidget *parent) :
  4. QLabel(parent)
  5. {
  6. setObjectName("hint");
  7. setStyleSheet("border-image: url(:/assets/common/window/frame.png);\nbackground-color: rgb(0, 0, 0);\ncolor: rgb(255, 255, 255);\nfont: 8pt \"D-determination (RUS BY LYAJKA)\";");
  8. setIndent(10);
  9. setWordWrap(true);
  10. setAlignment(Qt::AlignCenter);
  11. //setScaledContents(true);
  12. show();
  13. raise();
  14. title_ = "Title";
  15. text_ = "Text";
  16. }
  17. void IconHint::setHintTitle(const QString &title)
  18. {
  19. title_ = title;
  20. updateText();
  21. }
  22. void IconHint::setHintText(const QString &text)
  23. {
  24. text_ = text;
  25. updateText();
  26. }
  27. IconHint::~IconHint()
  28. {
  29. }
  30. void IconHint::updateText()
  31. {
  32. setText("<p style=\"font-size:12pt\">" + title_ + "</p><p>" + text_ + "</p>");
  33. adjustSize();
  34. resize(width() + 30, height() + 30);
  35. setIndent(15);
  36. }