- 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
- 1633 reads

Recent comments
3 days 13 hours ago
1 week 23 hours ago
1 week 1 day ago
5 weeks 21 hours ago
5 weeks 2 days ago
5 weeks 5 days ago
6 weeks 17 hours ago
8 weeks 3 days ago
10 weeks 1 day ago
11 weeks 1 day ago