meaningdialog.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "meaningdialog.h"
  2. #include <QLabel>
  3. #include <QVBoxLayout>
  4. #include <QMenu>
  5. #include <QAction>
  6. //#include <QApplication>
  7. #include <QScrollArea>
  8. MeaningDialog::MeaningDialog(QWidget *parent) :
  9. QDialog(parent)
  10. {
  11. label = new QLabel();
  12. label->setTextFormat(Qt::RichText);
  13. label->setAlignment(Qt::AlignTop);
  14. label->setWordWrap(true);
  15. QScrollArea *sa = new QScrollArea(); //(this);
  16. sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  17. // sa->setBackgroundRole(QPalette::Dark); // for testing purposes
  18. sa->setWidget(label);
  19. sa->setWidgetResizable(true);
  20. // Create Exit CBA
  21. QAction *backButton = new QAction(tr("Back"), this);
  22. backButton->setSoftKeyRole(QAction::NegativeSoftKey);
  23. connect(backButton, SIGNAL(triggered()), this, SLOT(close()));
  24. addAction(backButton);
  25. QVBoxLayout *vl = new QVBoxLayout(this);
  26. vl->setContentsMargins(0, 0, 0, 0);
  27. // vl->addSpacing(10);
  28. vl->addWidget(sa);
  29. setLayout(vl);
  30. setWindowState(Qt::WindowMaximized);
  31. setStyleSheet("QLabel { padding: 5px }");
  32. }
  33. void MeaningDialog::setText(QString text)
  34. {
  35. label->setText(text);
  36. }