I need to write a QDialog that shows some QGraphicsItems so I thought I'd just add a QGraphicsView widget to the dialog box;

here is the code:

Qt Code:
  1. #include "answerdialog.h"
  2. #include "ui_answerdialog.h"
  3.  
  4. AnswerDialog::AnswerDialog(QWidget *parent) :
  5. QDialog(parent),
  6. m_ui(new Ui::AnswerDialog)
  7. {
  8. m_ui->setupUi(this);
  9. scene = new QGraphicsScene(0,0,this->width(),this->height());
  10. scene->setBackgroundBrush(QBrush(QColor(23,23,23)));
  11. m_ui->gvDraw->setScene(scene);
  12. m_ui->gvDraw->setFixedSize(450,220);
  13. }
  14.  
  15. void AnswerDialog::Render(){
  16. QFont font("DejaVu Sans",18,QFont::Normal,false);
  17. scene->addText(Message,font);
  18. }
  19.  
  20. void AnswerDialog::resizeEvent(QResizeEvent *event){
  21. m_ui->gvDraw->fitInView(scene->sceneRect(),Qt::KeepAspectRatioByExpanding);
  22. }
  23.  
  24. AnswerDialog::~AnswerDialog()
  25. {
  26. delete m_ui;
  27. }
  28.  
  29. void AnswerDialog::changeEvent(QEvent *e)
  30. {
  31. QDialog::changeEvent(e);
  32. switch (e->type()) {
  33. case QEvent::LanguageChange:
  34. m_ui->retranslateUi(this);
  35. break;
  36. default:
  37. break;
  38. }
To copy to clipboard, switch view to plain text mode 

This is the code that I use to code this class:
Qt Code:
  1. AnswerDialog ans;
  2. ans.setMessage("Hello World");
  3. ans.Render();
  4. ans.exec();
To copy to clipboard, switch view to plain text mode 

The problem that I have is that when the dialog first appears the text look really really small then as soon as I resize the window, it's then that words take their real size. The size remains the same after that. I've tried using this line:
m_ui->gvDraw->fitInView(scene->sceneRect(),Qt::KeepAspectRatioByExpanding);
in the render function as well but the result is the same.

It seems like unless the command is called with dialog allready shown (and by shown I mean visible on the screen) then the command is inefective.

All I want is to show a message and a couple of QGraphicsItems. Is there anyways for the items to be shown in regular size just as soon as the dialog pops up?

Thanks for any help.