[PyKDE] QPoint arithmetric operator problems

Torsten Marek shlomme at gmx.net
Thu Feb 3 19:28:39 GMT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bdw schrieb:
| On Thu, 3 Feb 2005 17:02 Hans-Peter Jansen <hpj at urpla.net> wrote:
|
|>Hi,
|>
|>next problem: while substraction or addition of two QPoints should
|>work, it won't, at least not with
|>sip version: 4.1.1
|>Qt version: 3.2.1
|>PyQt version: 3.13
|>
|>Any ideas?
|>
|>Cheers,
|>Pete
|>
|>>#!/usr/bin/env python
|>
|># -*- coding: utf-8 -*-
|>
|>import sys
|>from qt import *
|>
|>class eventTest(QPushButton):
|>    def __init__(self, *args):
|>        QPushButton.__init__(self, "Drag me!", *args)
|>        self.pressPos = None
|>
|>    def mousePressEvent(self, e):
|>        self.pressPos = p = e.pos()
|
|
| Hello Peter
|
| I think a copy of the QPoint needs to be cached here, otherwise the
| mousemove handler will always be adding the same QPoint to itself.
|
| Replacing the line above with the following seems to work okay for me.
|
| 	self.pressPos = p = QPoint(e.pos())
|

Well, references. Sometimes they save your life without you noticing it,
sometimes they stab you in the back when you least expect it.

greetings

Torsten "When Jim is funny, I can be philosophical" Marek
- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCAntnfMVFHqJEyFgRAjJrAJ43WtXysMQVT6an36QP/OGjhMXqwgCgkhZA
nNNpxtpuVhg9GaEz3kc39sc=
=Q1td
-----END PGP SIGNATURE-----




More information about the PyQt mailing list