[Qt-interest] differenting between mouseevents from different widgets in the mainwindow

Mic J michael.cognacc at gmail.com
Mon Apr 25 12:08:37 CEST 2011


Hi

Application description
==================

Im making in application to manipulate/explore graphs, as in graph theory.

I made an application, where i have split the mainwindow  (it is
actually a qwidget)
into four spaces.

An "action" area filled with buttons for choosing different
actions/manipulations of the display.

The "display" area which is a graphics widget, with items i want to
manipulate in different ways.

A "legend" area, which is unused for now but should be filled with
information in context to
the operation i want done. that will explain the different markings i
set on the display.

"Information" area, where statistics and information about the
displayed/marked items in the display is shown.

Problem
===========

Now the problem is, i want to have different action from the mouse
depending on which widget i'm over.

Programmed like this.

class GraphInterface : public qwidget
{
..
  QGridLayout   *topLayout;

  QVBoxLayout *actionLayout;
  QVBoxLayout *legendLayout;
  QVBoxLayout *infoLayout;
  QVBoxLayout *displayLayout;

  QPushButton *actionRemove;
  QPushButton *actionAdd

  QGraphicsView *graphView;
  QGraphicsScene *graphScene;

  QWidget *infoPanel;
  QLabel *infoLabel1;
  ..
  QLabel *infoLabel1n;

..
};


But then i can only extend mouseevents for my mainwindow (?)

Or i could maybe use eventFilters?

Question
========

Should i create my own extended classes for the Graphicsview and infoView  etc.
To have that control, or could eventfilters be enough for that?

regards mic



More information about the Qt-interest-old mailing list