i tried that. i have my own label classes. and im drawing graphs on that labels.
when mouse enter and leave events happens on those labels, paint event still being called. but i want the paint event to be called only with my signal.
in constructor:
emi_label->installEventFilter(this);
gpr_label->installEventFilter(this);
{
if(event
->type
() == QEvent::Enter || event
->type
() == QEvent::Leave){ if(obj == this){
qDebug("warning: main event");
}
if(obj == emi_label){
qDebug("warning: emi event");
}
if(obj == gpr_label){
qDebug("warning: gpr event");
}
}
return false;
}
bool mainWidget::eventFilter(QObject *obj, QEvent *event)
{
if(event->type() == QEvent::Enter || event->type() == QEvent::Leave){
if(obj == this){
qDebug("warning: main event");
}
if(obj == emi_label){
qDebug("warning: emi event");
}
if(obj == gpr_label){
qDebug("warning: gpr event");
}
}
return false;
}
To copy to clipboard, switch view to plain text mode
event catches are right as far as i can see. i see expected warnings on terminal
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void gprLabel::update_gui(){
if(is_gpr_data_ready){
for(int i=101;i<=228;i++){
gpr_matrix[gpr_matrix_index][i-101] = rand()%256;
}
gpr_matrix_index++;
is_gpr_data_ready = 0;
}
if(gpr_matrix_index == vWIDTH ){
gpr_matrix_index = 0;
is_ready_to_draw = 1;
update();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void gprLabel::update_gui(){
if(is_gpr_data_ready){
for(int i=101;i<=228;i++){
gpr_matrix[gpr_matrix_index][i-101] = rand()%256;
}
gpr_matrix_index++;
is_gpr_data_ready = 0;
}
if(gpr_matrix_index == vWIDTH ){
gpr_matrix_index = 0;
is_ready_to_draw = 1;
update();
}
}
To copy to clipboard, switch view to plain text mode
as u see i want gpr_label to be updated only with my call. how can do that
Bookmarks