demos/embedded/anomaly/src/ControlStrip.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 29 b72c6db6890b
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    73         event->accept();
    73         event->accept();
    74         return;
    74         return;
    75     }
    75     }
    76 
    76 
    77     if (x > width() - h) {
    77     if (x > width() - h) {
    78     		emit closeClicked();    		
    78         emit closeClicked();
    79     		event->accept();
    79         event->accept();
    80     		return;
    80         return;
    81             
    81     }
    82         }
       
    83 
    82 
    84     if ((x < width() - 2 * h) && (x > width() - 3 * h)) {
    83     if ((x < width() - 2 * h) && (x > width() - 3 * h)) {
    85     		emit forwardClicked();
    84         emit forwardClicked();
    86     		event->accept();
    85         event->accept();
    87     		return;
    86         return;
    88         }
    87     }
    89 
    88 
    90     if ((x < width() - 3 * h) && (x > width() - 5 * h)) {
    89     if ((x < width() - 3 * h) && (x > width() - 5 * h)) {
    91     		emit backClicked();
    90         emit backClicked();
    92     		event->accept();
    91         event->accept();
    93     		return;
    92         return;
    94         }
    93     }
    95 }
    94 }
    96 
    95 
    97 void ControlStrip::paintEvent(QPaintEvent *event)
    96 void ControlStrip::paintEvent(QPaintEvent *event)
    98 {
    97 {
    99     int h = height();
    98     int h = height();
   100     int s = (h - menuPixmap.height()) / 2;
    99     int s = (h - menuPixmap.height()) / 2;
   101 
   100 
       
   101     QPainter p(this);
       
   102     p.fillRect(event->rect(), QColor(32, 32, 32, 192));
       
   103     p.setCompositionMode(QPainter::CompositionMode_SourceOver);
       
   104     p.drawPixmap(s, s, menuPixmap);
       
   105     p.drawPixmap(width() - h + s, s, closePixmap);
       
   106     p.drawPixmap(width() - 3 * h + s, s, forwardPixmap);
       
   107     p.drawPixmap(width() - 5 * h + s, s, backPixmap);
   102 
   108 
   103 	QPainter p(this);
   109     p.end();
   104 	p.fillRect(event->rect(), QColor(32, 32, 32, 192));
       
   105 	p.setCompositionMode(QPainter::CompositionMode_SourceOver);
       
   106 	p.drawPixmap(s, s, menuPixmap);
       
   107 	p.drawPixmap(width() - h + s, s, closePixmap);	    
       
   108 	p.drawPixmap(width() - 3 * h + s, s, forwardPixmap);
       
   109 	p.drawPixmap(width() - 5 * h + s, s, backPixmap);
       
   110 	    
       
   111 	p.end();
       
   112 }
   110 }