[Qt-interest] Slow? painting of rows in QTableWidget

Sandro Frenzel Sandro.Frenzel at gmx.de
Thu Mar 26 00:44:58 CET 2009


-------- Original-Nachricht --------
> Datum: Wed, 25 Mar 2009 23:22:03 +0100
> Von: Andreas Pakulat <apaku at gmx.de>
> An: qt-interest at trolltech.com
> Betreff: Re: [Qt-interest] Slow? painting of rows in QTableWidget
> On 25.03.09 22:33:51, Sandro Frenzel wrote:
> > 
> > -------- Original-Nachricht --------
> > > Datum: Wed, 25 Mar 2009 20:42:26 +0100
> > > Von: Andreas Pakulat <apaku at gmx.de>
> > > An: qt-interest at trolltech.com
> > > Betreff: Re: [Qt-interest] Slow? painting of rows in QTableWidget
> > 
> > > On 25.03.09 18:29:36, Sandro Frenzel wrote:

> > Hm, I have implemented following simple loop:
> >  
> > void MainWindow::on_pushButton_clicked() {   
> > 
> > int i = 0;
> > while(i<650) {
> >    ui->tableWidget->insertRow(i);
> >    i++;
> > }
> > 
> > }
> > 
> > The rows are shown at once, when the loop ist completed (5 seconds).
> Height and width are set in the designer.  
> 
> Can't see anything suspicious there, so you probably need to get a
> profiler
> working on your code.
>  

Hmm, maybe I am too tired, but a quick test with gprof shows the following. I have add these lines to my pro-File:

QMAKE_CFLAGS += -pg
QMAKE_CXXFLAGS += -pg
QMAKE_LFLAGS += -pg

Is that the right way? However, a gmon.out file is created.


The (short) output from gprof:

Flat profile:

Each sample counts as 0.01 seconds.
 no time accumulated

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00       14     0.00     0.00  QBasicAtomicInt::deref()
  0.00      0.00     0.00       11     0.00     0.00  QString::~QString()
  0.00      0.00     0.00        3     0.00     0.00  QRect::QRect(int, int, int, int)
  0.00      0.00     0.00        2     0.00     0.00  QFlags<Qt::WindowType>::QFlags(void**)
  0.00      0.00     0.00        1     0.00     0.00  qMain(int, char**)
  0.00      0.00     0.00        1     0.00     0.00  MainWindow::on_pushButton_clicked()
  0.00      0.00     0.00        1     0.00     0.00  MainWindow::MainWindow(QWidget*)
  0.00      0.00     0.00        1     0.00     0.00  MainWindow::~MainWindow()
  0.00      0.00     0.00        1     0.00     0.00  Ui_MainWindowClass::retranslateUi(QMainWindow*)
  0.00      0.00     0.00        1     0.00     0.00  Ui_MainWindowClass::setupUi(QMainWindow*)
  0.00      0.00     0.00        1     0.00     0.00  QSize::QSize(int, int)
  0.00      0.00     0.00        1     0.00     0.00  QWidget::show()
  0.00      0.00     0.00        1     0.00     0.00  QWidget::resize(int, int)


I think, that gprof does not recognize the pushbutton-clicked event, but only the mainwindow.

> Andreas

Sandro

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01



More information about the Qt-interest-old mailing list