Hello,

The following have been discovered in the textedit demo that comes with Qt 
4.5.0 rc1 for Windows.

1.       When creating a list whether bulleted or numeric and typing in a few 
entries it appears correctly. However, after saving off the contents and 
loading them back into the QTextEdit, placing the cursor at the end of the last 
item in the list and pressing enter will display the newly created item farther 
away from the list structure. You can see this in the textedit demo, place the 
cursor after "1. Introduction" and press Enter.
2.       Splitting merged cells does not work after merging them. See the 
example I have posted that demonstrates this problem (1. insert table, 2. 
select two cells 3. merge them 4. split them)
3.       Another issue you can see in the example when I set the height for the 
table frame. As you can see a border is drawn, but if I press enter numerous 
times, the painting of the table overrides the frame border and then things 
look very bad. This appears to only be happening on the vertical side... when 
adding text horizontally, the table and border move as one and no painting 
issue occurs. This is a pre-existing issue that can be seen in 4.3.x

Regards,

Yan Shapochnik
#include <QtCore>
#include <QtGui>

class MyWidget : public QWidget
{
   Q_OBJECT
   
public:
   MyWidget(QWidget *parent = 0) : QWidget(parent) 
   {  
      QVBoxLayout *layout = new QVBoxLayout;
      
      QPushButton *insertTable = new QPushButton("Insert Table", this);
      QPushButton *splitCells = new QPushButton("Split Cells", this);
      QPushButton *mergeCells = new QPushButton("Merge Cells", this);
      m_pTextEdit = new QTextEdit(this);
      
      layout->addWidget(insertTable);
      layout->addWidget(mergeCells);
      layout->addWidget(splitCells);      
      layout->addWidget(m_pTextEdit);
      this->setLayout(layout);          
      
      connect(insertTable, SIGNAL(clicked()), this, SLOT(slotInsertTable()));
      connect(splitCells, SIGNAL(clicked()), this, SLOT(slotSplitCells()));
      connect(mergeCells, SIGNAL(clicked()), this, SLOT(slotMergeCells()));
   }
   
   virtual ~MyWidget() { }
   
protected slots:
    void slotInsertTable()
    {
      if (m_pTextEdit)
      {
         QTextCursor cursor = m_pTextEdit->textCursor();
         if (!cursor.isNull())
         {
            QTextTableFormat fmt;
            fmt.setWidth(300);
            fmt.setHeight(300);
            fmt.setBorder(1);
            cursor.insertTable(3,3, fmt);
         }
         
         m_pTextEdit->setFocus();
      }
    }
        
    void slotMergeCells()
    {
      if (m_pTextEdit)
      {
         QTextCursor cursor = m_pTextEdit->textCursor();
         if (!cursor.isNull())
         {
            QTextTable *table = cursor.currentTable();
            if (table)
               table->mergeCells(cursor);
         }

         m_pTextEdit->setFocus();
      }
    }
    
    void slotSplitCells()
    {
      if (m_pTextEdit)
      {
         QTextCursor cursor = m_pTextEdit->textCursor();
         if (!cursor.isNull())
         {
            QTextTable *table = cursor.currentTable();
            if (table)
            {
               QTextTableCell currentCell = table->cellAt(cursor.position());
               if (currentCell.isValid())
                  table->splitCell(currentCell.row(), currentCell.column(), 1, 
2);
            }
         }

         m_pTextEdit->setFocus();
      }
    }
   
protected:
   QTextEdit *m_pTextEdit;
   
};

#include "main.moc"
int main(int argc, char** argv)
{
   QApplication app(argc, argv);
   
   MyWidget *widget = new MyWidget;
   widget->resize(600,500);
   widget->show();
   
   return app.exec();
}
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to