- RFP: Agriculture Inventory & Land Use Mapping Plugin for QGIS
- Announcing the release of QGIS 1.6 'Copiapó'
- Announcing the release of QGIS 1.5
- Quantum GIS on steroids
- Annotation tools
- Announcing the release of QGIS 1.4.0 'Enceladus'
- Carson Farmer's report back on the Vienna Hackfest
- Vienna Hackfest 2009 Report Back
- Introducing the QGIS Hackfest (Vienna 2009) crew
- Announcing the release of QGIS 1.3.0 'Mimas'
Accessing QT constants in PyQt...
Submitted by aaronr on Mon, 2008-01-07 22:32.

So you get an event and you want to be able to check something like whether a button press was done with the right mouse... fear not, you can access all the same constants that you are accustom to in C++ QT:
void MyClass::mousePressEvent(QMouseEvent * e)
{
if (e->button() == Qt::RightButton)
{
printf("Something...")
}
}
In Python you can do the same:
def mousePressEvent(self, event):
if event.button() == Qt.RightButton:
print "Something..."
Just remember that you need to have the PyQt import to have access to the constants:
from PyQt4.QtCore import *
»
- aaronr's blog
- Login to post comments
- 7206 reads

Recent comments
2 years 1 week ago
2 years 7 weeks ago
2 years 8 weeks ago
2 years 9 weeks ago
2 years 10 weeks ago
2 years 16 weeks ago
2 years 16 weeks ago
2 years 17 weeks ago
2 years 17 weeks ago
2 years 17 weeks ago