title: How do I print QStringListModel content?
body: <p>I need to print the content of a QStringListModel to a printer, in 'void MainWindow::on_pbImprime_clicked()' It's printing any Qstring with no problems, but I don't know how to put the data of QStringListModel to my QString text, anyone have an idea?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
      model = new QStringListModel(this);
  
      ui-&gt;lbItens-&gt;setModel(model);
  
      ui-&gt;lbItens-&gt;setEditTriggers(QAbstractItemView::AnyKeyPressed |
                                 QAbstractItemView::DoubleClicked);
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_pbAdd_clicked()
  {
      int row = model-&gt;rowCount();
  
      model-&gt;insertRows(row,1);
  
      QModelIndex index = model-&gt;index(row);
  
      ui-&gt;lbItens-&gt;setCurrentIndex(index);
      ui-&gt;lbItens-&gt;edit(index);
  }
  
  void MainWindow::on_pbRemove_clicked()
  {
      model-&gt;removeRows(ui-&gt;lbItens-&gt;currentIndex().row(),1);
  }
  
  void MainWindow::on_pbImprime_clicked()
  {
          QPrinter printer;
  
          QPainter p(&amp;printer);
          int x_pos = 20;
          int y_pos = 20;
  
          int row = model-&gt;rowCount();
          int i;
  
          for(i=0; i&lt;row; i++){
              QString text = ;
              p.drawText(x_pos, y_pos, text);
              y_pos += p.fontMetrics().height();
          }
  }
  </code></pre>
  
  <p>Sorry for my bad english and thanks for the help.</p>