diff options
-rw-r--r-- | src/iconview/ntqiconview.h | 1 | ||||
-rw-r--r-- | src/iconview/qiconview.cpp | 47 | ||||
-rw-r--r-- | src/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/kernel/qprocess_unix.cpp | 2 |
4 files changed, 49 insertions, 3 deletions
diff --git a/src/iconview/ntqiconview.h b/src/iconview/ntqiconview.h index bda8273f4..e45cfca65 100644 --- a/src/iconview/ntqiconview.h +++ b/src/iconview/ntqiconview.h @@ -452,6 +452,7 @@ protected: void contentsDropEvent( TQDropEvent *e ); #endif + void bufferedPaintEvent( TQPaintEvent* ); void resizeEvent( TQResizeEvent* e ); void keyPressEvent( TQKeyEvent *e ); void focusInEvent( TQFocusEvent *e ); diff --git a/src/iconview/qiconview.cpp b/src/iconview/qiconview.cpp index ee4a0fe36..dbf764a0f 100644 --- a/src/iconview/qiconview.cpp +++ b/src/iconview/qiconview.cpp @@ -214,6 +214,7 @@ public: TQIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor, *renamingItem; TQRect *rubber; + TQPixmap *backBuffer; TQTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer, *fullRedrawTimer; int rastX, rastY, spacing; @@ -2800,6 +2801,7 @@ TQIconView::TQIconView( TQWidget *parent, const char *name, WFlags f ) d->currentItem = 0; d->highlightedItem = 0; d->rubber = 0; + d->backBuffer = 0; d->scrollTimer = 0; d->startDragItem = 0; d->tmpCurrentItem = 0; @@ -2953,6 +2955,8 @@ TQIconView::~TQIconView() delete item; item = tmp; } + delete d->backBuffer; + d->backBuffer = 0; delete d->fm; d->fm = 0; #ifndef QT_NO_TOOLTIP @@ -4973,6 +4977,47 @@ void TQIconView::contentsDropEvent( TQDropEvent *e ) #endif /*! + This function grabs all paintevents that otherwise would have been + processed by the TQScrollView::viewportPaintEvent(). Here we use a + doublebuffer to reduce 'on-paint' flickering on TQIconView + (and of course its children). + + \sa TQScrollView::viewportPaintEvent(), TQIconView::drawContents() +*/ + +void TQIconView::bufferedPaintEvent( TQPaintEvent* pe ) +{ + TQWidget* vp = viewport(); + TQRect r = pe->rect() & vp->rect(); + int ex = r.x() + contentsX(); + int ey = r.y() + contentsY(); + int ew = r.width(); + int eh = r.height(); + + if ( !d->backBuffer ) + d->backBuffer = new TQPixmap(vp->size()); + if ( d->backBuffer->size() != vp->size() ) { + // Resize function (with hysteresis). Uses a good compromise between memory + // consumption and speed (number) of resizes. + float newWidth = (float)vp->width(); + float newHeight = (float)vp->height(); + if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() ) + { + newWidth *= 1.1892; + newHeight *= 1.1892; + d->backBuffer->resize( (int)newWidth, (int)newHeight ); + } else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() ) + d->backBuffer->resize( (int)newWidth, (int)newHeight ); + } + + TQPainter p; + p.begin(d->backBuffer, vp); + drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); + p.end(); + bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh); +} + +/*! \reimp */ @@ -5756,7 +5801,7 @@ bool TQIconView::eventFilter( TQObject * o, TQEvent * e ) if ( !d->rubber ) drawDragShapes( d->oldDragPos ); } - viewportPaintEvent( (TQPaintEvent*)e ); + bufferedPaintEvent( (TQPaintEvent*)e ); if ( d->dragging ) { if ( !d->rubber ) drawDragShapes( d->oldDragPos ); diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 7aefd35b8..76b265926 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -545,7 +545,7 @@ public: TQThreadInstance::setCurrentThread(this); // thread should be running and not finished for the lifetime - // of the application (even if QCoreApplication goes away) + // of the application (even if TQCoreApplication goes away) d->running = true; d->finished = false; d->eventLoop = NULL; diff --git a/src/kernel/qprocess_unix.cpp b/src/kernel/qprocess_unix.cpp index a18672473..39027459d 100644 --- a/src/kernel/qprocess_unix.cpp +++ b/src/kernel/qprocess_unix.cpp @@ -1135,7 +1135,7 @@ bool TQProcess::canReadLineStderr() const This function always returns immediately. The data you pass to writeToStdin() is copied into an internal memory buffer in TQProcess, and when control goes back to the event loop, TQProcess will - starting transferring data from this buffer to the running process. � + starting transferring data from this buffer to the running process. Sometimes the data will be transferred in several payloads, depending on how much data is read at a time by the process itself. When TQProcess has transferred all the data from its memory buffer to the running process, it |