Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
FAQ for if you want to use QWidget to display clickable images.
The trick is to override 'mousePressEvent' and use the QWidget's geometry() member function:
void Dialog::mousePressEvent(QMouseEvent * event) |
The full code can be viewed and downloaded below.
The sprites used in this example are from a game of mine, called Maziak.
Operating system: Ubuntu 10.04 LTS Lucid Lynx
IDE: Qt Creator 2.0.0
Project type: Qt4 GUI Application
Libraries used:
#------------------------------------------------- |
#ifndef DIALOG_H |
#include <QMouseEvent> |
#include <QtGui/QApplication> |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.