comparison panner.cpp @ 250:be483734bde5

* Make it possible for changeset items to take two or three lines of description, depending on how much there is * Some other small improvements to how changeset items are drawn (e.g. give them opaque white backgrounds)
author Chris Cannam
date Tue, 11 Jan 2011 17:58:14 +0000
parents 8fd71f570884
children
comparison
equal deleted inserted replaced
249:123e06d5d9af 250:be483734bde5
108 } 108 }
109 109
110 void 110 void
111 Panner::resizeEvent(QResizeEvent *) 111 Panner::resizeEvent(QResizeEvent *)
112 { 112 {
113 DEBUG << "Panner::resizeEvent" << endl;
113 if (scene()) fit(sceneRect()); 114 if (scene()) fit(sceneRect());
114 m_cache = QPixmap(); 115 m_cache = QPixmap();
115 } 116 }
116 117
117 void 118 void
118 Panner::slotSceneRectChanged(const QRectF &newRect) 119 Panner::slotSceneRectChanged(const QRectF &newRect)
119 { 120 {
121 DEBUG << "Panner::slotSceneRectChanged" << endl;
120 if (!scene()) return; // spurious 122 if (!scene()) return; // spurious
121 fit(newRect); 123 fit(newRect);
122 m_cache = QPixmap(); 124 m_cache = QPixmap();
123 viewport()->update(); 125 viewport()->update();
124 } 126 }
125 127
126 void 128 void
127 Panner::slotSceneChanged(const QList<QRectF> &) 129 Panner::slotSceneChanged(const QList<QRectF> &)
128 { 130 {
131 DEBUG << "Panner::slotSceneChanged" << endl;
129 if (!scene()) return; // spurious 132 if (!scene()) return; // spurious
130 m_cache = QPixmap(); 133 m_cache = QPixmap();
131 viewport()->update(); 134 viewport()->update();
132 } 135 }
133 136
161 } 164 }
162 165
163 void 166 void
164 Panner::updateScene(const QList<QRectF> &rects) 167 Panner::updateScene(const QList<QRectF> &rects)
165 { 168 {
166 if (!m_cache.isNull()) m_cache = QPixmap(); 169 DEBUG << "Panner::updateScene" << endl;
170 // if (!m_cache.isNull()) m_cache = QPixmap();
167 QGraphicsView::updateScene(rects); 171 QGraphicsView::updateScene(rects);
168 } 172 }
169 173
170 void 174 void
171 Panner::drawItems(QPainter *painter, int numItems, 175 Panner::drawItems(QPainter *painter, int numItems,
185 QPainter cachePainter; 189 QPainter cachePainter;
186 cachePainter.begin(&m_cache); 190 cachePainter.begin(&m_cache);
187 cachePainter.setTransform(viewportTransform()); 191 cachePainter.setTransform(viewportTransform());
188 ps->drawItems(&cachePainter, numItems, items, options); 192 ps->drawItems(&cachePainter, numItems, items, options);
189 cachePainter.end(); 193 cachePainter.end();
194
195 DEBUG << "done" << endl;
190 } 196 }
191 197
192 painter->save(); 198 painter->save();
193 painter->setTransform(QTransform()); 199 painter->setTransform(QTransform());
194 painter->drawPixmap(0, 0, m_cache); 200 painter->drawPixmap(0, 0, m_cache);