- Release plans recap for the road to QGIS 1.0
- New version of eVis
- Contour Lines in Qgis
- QGIS and Google Summer of Code
- Quantum GIS Graduates OSGeo Incubation
- Paolo Cavallini Named to QGIS Project Steering Committee
- Nominations for QGIS PSC Open
- Capturing map coordinates in a stand alone app...
- Tutorial 7 - Creating spatial datasets with the QGIS API
- Html Image Plugin 0.2
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
- Add new comment
- 1407 reads

Recent comments
1 day 11 hours ago
1 day 13 hours ago
1 day 16 hours ago
1 day 17 hours ago
3 days 9 hours ago
2 weeks 1 day ago
3 weeks 1 day ago
3 weeks 1 day ago
4 weeks 5 days ago
4 weeks 6 days ago