summaryrefslogtreecommitdiffstats
path: root/src/iconview
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-02-18 20:37:37 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-02-18 20:37:37 -0600
commitcff522f98666e1bf24c36a3a0a2abe3fb2e1abe8 (patch)
tree4bb4f9e031f6b953fdd161960348ae1a1460a065 /src/iconview
parent63d62f785ad636cb65f14aa52ce4dd9c177a6be8 (diff)
downloadtqt3-cff522f98666e1bf24c36a3a0a2abe3fb2e1abe8.tar.gz
tqt3-cff522f98666e1bf24c36a3a0a2abe3fb2e1abe8.zip
Automated update from Qt3
Diffstat (limited to 'src/iconview')
-rw-r--r--src/iconview/ntqiconview.h1
-rw-r--r--src/iconview/qiconview.cpp47
2 files changed, 47 insertions, 1 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 );