- Announcing the release of QGIS 1.5 'Tethys'
- 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'
- Announcing the releases of QGIS 1.0.2 (stable) and QGIS 1.1.0 'Pan' (unstable).
- Summer of Code project: Label placement
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 or register to post comments
- 4876 reads

Recent comments
45 weeks 3 days ago
51 weeks 5 days ago
1 year 3 days ago
1 year 1 week ago
1 year 2 weeks ago
1 year 8 weeks ago
1 year 8 weeks ago
1 year 9 weeks ago
1 year 9 weeks ago
1 year 9 weeks ago