dialogboxestab.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #include "dialogboxestab.h"
  2. dialogBoxesTab::dialogBoxesTab()
  3. {
  4. }
  5. void dialogBoxesTab::updateLabels(QString jsonData)
  6. {
  7. //Convert the jsonData var to QJsonObject
  8. QJsonDocument jsonDataDocument = QJsonDocument::fromJson(jsonData.toUtf8());
  9. QJsonObject jsonDataDocumentObject = jsonDataDocument.object();
  10. //Convert the colors in the JSON to QColor
  11. QColor labelBoxColor, labelBoxOutlineColor, labelDialogBackground, labelDialogButton, labelDialogButtonText;
  12. labelBoxColor.setNamedColor("#" + jsonDataDocumentObject.value("boxColor").toString());
  13. labelBoxOutlineColor.setNamedColor("#" + jsonDataDocumentObject.value("boxOutlineColor").toString());
  14. labelDialogBackground.setNamedColor("#" + jsonDataDocumentObject.value("dialogBackground").toString());
  15. labelDialogButton.setNamedColor("#" + jsonDataDocumentObject.value("dialogButton").toString());
  16. labelDialogButtonText.setNamedColor("#" + jsonDataDocumentObject.value("dialogButtonText").toString());
  17. //Update labels color
  18. emit setLabelsColor(labelBoxColor, labelBoxOutlineColor, labelDialogBackground, labelDialogButton, labelDialogButtonText);
  19. }
  20. QColor dialogBoxesTab::getColorFromUser()
  21. {
  22. //Open the Color Selector dialog
  23. return QColorDialog::getColor();
  24. }