1

Topic: Brakes QGraphicsView

Actually, a subject. I can not understand in any way in what the reason that practically for no reason there are brakes. The item with. Any of modes setViewportUpdateMode does not rescue.

2

Re: Brakes QGraphicsView

Hello, _hum _, you wrote: __> Actually, a subject. I can not understand in any way in what the reason that practically for no reason there are brakes. __> the item with. Any of modes setViewportUpdateMode does not rescue. I will try : you update boundingRect during time paint? If telepathy did not work, not enough information for the analysis means: What you generally ? How many item. How many drawing primitives on everyone item? Whether it is a lot of intersections item? Item types are intersected "is direct", "arc", or something compound? As it is shown brakes: the first too long works ?  is not in time behind relocation of a node by a mouse? Try to add  in paint to install: In you some times it is successively caused  one and that item?. In you it is caused paint for objects because of limits of visible area? In you it is caused paint for objects which do not enter into the changed area? Expensive a call individual paint?

3

Re: Brakes QGraphicsView

Hello, Chorkov, you wrote: a C> Hello, _hum _, you wrote: __>> Actually, a subject. I can not understand in any way in what the reason that practically for no reason there are brakes. __>> the item with. Any of modes setViewportUpdateMode does not rescue. A C> I Will try : you update boundingRect during time paint? Unless in this case there would be no cycling (updates  that would cause necessity of copying, and, in  queue, update )?> If telepathy did not work a C, not enough information for the analysis means: a C> That you generally ? How many item. How many drawing primitives on everyone item? Whether the C> is a lot of intersections item? Item types are intersected "is direct", "arc", or something compound? Type of such scene (operation graphics  signallings): Everyone "a signal band" is presented by one item, which  in paint as sequence fillRect (number  == to number of seconds in the chart). Duration of the chart - about 1000 seconds. Scrolling brakes look as " a slider behind the mouse" and  scene driving. It is connected, on-voidimomu, with long  for when I change the size of a game ("to tear on all screen") - operation too noticeably is delayed the item with. Delivered in an item of "a signal band" setCacheMode (QGraphicsItem:: DeviceCoordinateCache) - exchanged nothing

4

Re: Brakes QGraphicsView

5

Re: Brakes QGraphicsView

P.S.: similar as-time an occasion to pass from one  to a band, to composite . Compare productivity in two variants: #include <QWidget> #include <QGraphicsWidget> #include <QGraphicsView> #include <QApplication> #include <QDebug> #include <qstyleoption.h> #include <iostream> class Widget: public QGraphicsView {//Q_OBJECT public: Widget (QWidget *parent = 0);} ; const QRectF groupRect (0, 0, 100000, 30); const QRectF lineNodeRect (0, 25, 10, 5); const QRectF textNodeRect (0, 0, 100, 25); const int linesCount=100; template <typename CallBack> void enumRects (QRectF first, QRectF painterClipRect, CallBack callBack) {int i_end = std:: max (int (groupRect.width ()/first.width ()), int ((painterClipRect.right ()-first.left () +1) / first.width ())); int i_begin = std:: max ((int) 0, int ((painterClipRect.left ()-first.left ()-first.width ()-1) / first.width ())); for (int i=i_begin; i <=i_end; ++ i) callBack (i, first.translated (first.width () *i, 0));} #if 0 class Item: public QGraphicsItem {public: typedef QGraphicsItem base; Item (): base () {} QRectF boundingRect () const {return groupRect;} void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) {QBrush black (Qt:: black); QBrush red (Qt:: red); enumRects (lineNodeRect, groupRect, [AND] (int i, QRectF rect) {painter-> fillRect (rect, i%2 == 0? black: red);}); enumRects (textNodeRect, groupRect, [AND] (int i, QRectF rect) {painter-> drawText (rect, QString ("[%1 %]").arg (i));});}}; #else class Item: public QGraphicsItemGroup {public: typedef QGraphicsItemGroup base; Item (): base () {QBrush black (Qt:: black); QBrush red (Qt:: red); enumRects (lineNodeRect, groupRect, [AND] (int i, QRectF rect) {auto* n=new QGraphicsRectItem (rect, this); n-> setBrush (i%2 == 0? black: red); addToGroup (n);} ); enumRects (textNodeRect, groupRect, [AND] (int i, QRectF rect) {auto* n=new QGraphicsTextItem (QString ("[%1 %]").arg (i), this); n-> setPos (rect.topLeft ()); addToGroup (n);});} void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) {base:: paint (painter, option, widget);}}; #endif Widget:: Widget (QWidget *parent): QGraphicsView (parent) {setScene (new QGraphicsScene (this)); for (int i=0; i <linesCount; ++ i) {Item* n=new Item (); n-> setPos (0, i*30); scene ()-> addItem (n);}} int main (int argc, char *argv []) {QApplication a (argc, argv); Widget w; w.show (); return a.exec ();}

6

Re: Brakes QGraphicsView

Hello, Chorkov, you wrote: a C> it is possible, matter is not in , and colors are selected from extraction of the data on which base? A C> Try to check up it .   - it is too much all (and the model too is heavy on productivity and gui to it) - it is necessary to dig long. It would be desirable this heavy artillery to avoid

7

Re: Brakes QGraphicsView

Hello, Chorkov, you wrote: a C> P.S.: a C> it is similar as-time an occasion to pass from one  to a band, to composite . Yes, too of it thought, but that all not to shovel, arrived a little in another way - used QStyleOptionGraphicsItem:: exposedRect, that  only that part which is visible in . Like, helped

8

Re: Brakes QGraphicsView

Hello, Iks, you wrote: > Hello, _hum _, you wrote: > a lot of text Can? Try without inscriptions. Generally for problem search it is useful to disconnect sequentially code locations and to look who it is guilty. > Can QGraphicsView:: scale () it is used, whether truth I do not know strongly it influences yes, there is too such version, but, nevertheless the main brakes in the schedule (noticeable falling of productivity at amount growth "signal bands"). While comprehensible speed managed to achieve by means of the restriction mechanism  on the basis of QStyleOptionGraphicsItem:: exposedRect