[PyQt] Textedit font changes

2011-04-19 Thread ad3d

Hi guys,

   i want to use the font size,type of font,font
color,underline,bold,italic..functions for QTextEdit using pyqt..
can someone plz help me on this..

Regards,
ad3d
-- 
View this message in context: 
http://old.nabble.com/Textedit-font-changes-tp31438562p31438562.html
Sent from the PyQt mailing list archive at Nabble.com.

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Question on QTreeView, interactive expanding/collapsing

2011-04-19 Thread Knacktus

Am 19.04.2011 23:29, schrieb Zoltan Szalai:

The "*" key expands all children but you can easily implement your own
expand / collapse subtree functionality.



Wow, I didn't know about that! But Qt needs a method to expand all 
subchildren recursively. Why is this method not available? Or is it?


Background story:

I've needed an expand_all_below action. I've implemented this similiar 
to what Paul suggested (a bit more rookie-like with recursion), but 
wasn't so happy with the performance on very large trees. So my hope is 
that the method used by Qt internaly must be a faster.


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Kudos

2011-04-19 Thread Eric Frederich
Hey Phil,

I recently built some Python bindings (using Cython) for a 3rd party
library that had to be built using Visual Studio 2005.
Its great having these bindings and being able to use Python.
Unfortunately, to install any other Python modules I have to build
them myself as nobody offers versions using Visual Studio.

When I wanted to start using Qt from Python I initially chose PySide
for its more liberal license and because as of their 1.0 release they
had Windows support.
Building it was an absolute pain.  I had to fix some scripts here and
there.  The resulting install didn't even have uic and I was
instructed to copy it from the official binary release of the PySide
Windows installer.  After doing this it wouldn't compile my .ui files
and just error out.
I compiled the .ui files using the PyQt pyuic4 and got PySide to work okay.

Because of all those problems I decided to give PyQt a go on Windows.
Sip installed no problem.
PyQt gave me some trouble using "configure.py" because I had a space
the path of the source directory that I was running configure from.
After moving it to a more boring "C:\PyQt-win-gpl-4.8.3" it installed just fine.
I wound up having a problem with pyuic4 also just like I did with PySide.
I dug into it a bit and it was a case of me not having built the
pyexpat module.  After building it and putting pyexpat.pyd in the DLLs
folder pyuic4 worked just fine.
Makes me wonder if thats what PySide was missing as well.

In any case, for now I'll be using PyQt.
One thing that PySide did nice that PyQt didn't do was get the Qt dll
files copied into the the Python installation so that everything was
self contained.
It would be nice not to have to have end user's of my programs have to
do a full Qt install when they'll only be using it from PyQt.

Anyway, just wanted to say kudos to having a relatively pain free
installation experience on Windows (with Visual Studio 2005 anyway)
compared to the "competition".

Thanks,
~Eric
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Question on QTreeView, interactive expanding/collapsing

2011-04-19 Thread James Polk


That's Cool!...Thanks Paul!



--- On Tue, 4/19/11, Paul Du Bois  wrote:

From: Paul Du Bois 
Subject: RE: [PyQt] Question on QTreeView, interactive expanding/collapsing
To: "James Polk" , pyqt@riverbankcomputing.com
Date: Tuesday, April 19, 2011, 3:25 PM

If you need hotkey+click then this is the best way I've found to do it  # 
Implement shift-click to expand/contract  @pyqtSlot(QModelIndex)    def 
_on_expanded(self, index):    if self._in_shift_press:    
self._in_shift_press = False    _recursive_set_expanded(self, index, 
True)  @pyqtSlot(QModelIndex)    def _on_collapsed(self, index):    if 
self._in_shift_press:    self._in_shift_press = False    
_recursive_set_expanded(self, index, False)  def mousePressEvent(self, 
evt):    # Make shift-click expand/collapse all    if 
int(evt.modifiers() & Qt.ShiftModifier) != 0:    self._in_shift_press = 
True    try:    QTreeView.mousePressEvent(self, evt)    
finally:    self._in_shift_press = False  def 
_recursive_set_expanded(view,
 root, desired):    from collections import deque    root = 
root.sibling(root.row(), 0)    q = deque([root])    model = view.model()    
while q:    idx = q.popleft()    view.setExpanded(idx, desired)    
for i in range(model.rowCount(idx)):    q.append(model.index(i,0, idx)) 
 From: pyqt-boun...@riverbankcomputing.com 
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of James Polk
Sent: Tuesday, April 19, 2011 2:28 PM
To: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] Question on QTreeView, interactive expanding/collapsing  
Whoops,...just found the *-hotkey,nevermind, lol...



--- On Tue, 4/19/11, James Polk  wrote:
From: James Polk 
Subject: Question on QTreeView, interactive expanding/collapsing
To: pyqt@riverbankcomputing.com
Date: Tuesday, April 19, 2011, 2:09 PM
Greetings All,

In a typical QTreeView,...the default behaviour of clicking on a "plus box",
i.e. the branch boxes of the tree, yields a "single box open", or in the case
of collapsing, a "single box closed" event.

Is there any way to use a keyboard modifier, like SHIFT, CTRL, and/or ALT,
to expand or collapse the *whole* tree?

Many other similiar tree structures in other software have this feature.
For example, holding down CTRL and ALT and clicking on any box will
unfold/expand (or collapse) all nodes/branches from that node and all below.
Is there something I'm overlooking? Is this (re-)implementable ?

Many Thanks,
-Jim  ___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Question on QTreeView, interactive expanding/collapsing

2011-04-19 Thread Paul Du Bois
If you need hotkey+click then this is the best way I've found to do it

 

# Implement shift-click to expand/contract

 

@pyqtSlot(QModelIndex)

def _on_expanded(self, index):

if self._in_shift_press:

self._in_shift_press = False

_recursive_set_expanded(self, index, True)

 

@pyqtSlot(QModelIndex)

def _on_collapsed(self, index):

if self._in_shift_press:

self._in_shift_press = False

_recursive_set_expanded(self, index, False)

 

def mousePressEvent(self, evt):

# Make shift-click expand/collapse all

if int(evt.modifiers() & Qt.ShiftModifier) != 0:

self._in_shift_press = True

try:

QTreeView.mousePressEvent(self, evt)

finally:

self._in_shift_press = False

 

def _recursive_set_expanded(view, root, desired):

from collections import deque

root = root.sibling(root.row(), 0)

q = deque([root])

model = view.model()

while q:

idx = q.popleft()

view.setExpanded(idx, desired)

for i in range(model.rowCount(idx)):

q.append(model.index(i,0, idx))

 

From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of James Polk
Sent: Tuesday, April 19, 2011 2:28 PM
To: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] Question on QTreeView, interactive
expanding/collapsing

 


Whoops,...just found the *-hotkey,nevermind, lol...



--- On Tue, 4/19/11, James Polk  wrote:


From: James Polk 
Subject: Question on QTreeView, interactive expanding/collapsing
To: pyqt@riverbankcomputing.com
Date: Tuesday, April 19, 2011, 2:09 PM


Greetings All,

In a typical QTreeView,...the default behaviour of clicking on a "plus
box",
i.e. the branch boxes of the tree, yields a "single box open", or in the
case
of collapsing, a "single box closed" event.

Is there any way to use a keyboard modifier, like SHIFT, CTRL, and/or
ALT,
to expand or collapse the *whole* tree?

Many other similiar tree structures in other software have this feature.
For example, holding down CTRL and ALT and clicking on any box will
unfold/expand (or collapse) all nodes/branches from that node and all
below.
Is there something I'm overlooking? Is this (re-)implementable ?

Many Thanks,
-Jim

 

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Disable context menu of a plugin in QWebview

2011-04-19 Thread Gelonida G
Hi Hans-Peter,

Thanks for your answer.

On 04/19/2011 03:00 PM, Hans-Peter Jansen wrote:
> On Monday 18 April 2011, 11:16:17 Gelonida N wrote:
>> Hi,
>>
>> Now I am able to activate a flash plugin in my QWebview browser and
>> things work as they should.
>>
>> There is just one minor problem
>>
>>
>> The browser should always display a given context menu when the user
>> clicks on the riht mouse button.
>>
>>
>> The flash plugin however grabs the right mouse click and displays the
>> plugin's menu.
>>
>> Is there any way to just display the default browser context menu.
>>
>> If really desired, then I could perhaps allow a second path (sub menu of
>> my context menu) to access the plugins context menu.
> 
> I don't believe, that this is possible without getting very, very dirty, but 
> if you found a solution, let us know. (ld preloading comes to my mind).

Not sure, whether ld-preloading works under Windows.
I know this technique only from Linux.

> 
> Good luck,
> Pete

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Disable context menu of a plugin in QWebview

2011-04-19 Thread Gelonida N
Hi Hans-Peter,

Thanks for your answer.

On 04/19/2011 03:00 PM, Hans-Peter Jansen wrote:
> On Monday 18 April 2011, 11:16:17 Gelonida N wrote:
>> Hi,
>>
>> Now I am able to activate a flash plugin in my QWebview browser and
>> things work as they should.
>>
>> There is just one minor problem
>>
>>
>> The browser should always display a given context menu when the user
>> clicks on the riht mouse button.
>>
>>
>> The flash plugin however grabs the right mouse click and displays the
>> plugin's menu.
>>
>> Is there any way to just display the default browser context menu.
>>
>> If really desired, then I could perhaps allow a second path (sub menu of
>> my context menu) to access the plugins context menu.
> 
> I don't believe, that this is possible without getting very, very dirty, but 
> if you found a solution, let us know. (ld preloading comes to my mind).

Not sure, whether ld-preloading works under Windows.
I know this technique only from Linux.

> 
> Good luck,
> Pete


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Question on QTreeView, interactive expanding/collapsing

2011-04-19 Thread Zoltan Szalai
The "*" key expands all children but you can easily implement your own 
expand / collapse subtree functionality.


bests
Zoli


On 2011.04.19. 23:09, James Polk wrote:


Greetings All,

In a typical QTreeView,...the default behaviour of clicking on a "plus 
box",
i.e. the branch boxes of the tree, yields a "single box open", or in 
the case

of collapsing, a "single box closed" event.

Is there any way to use a keyboard modifier, like SHIFT, CTRL, and/or ALT,
to expand or collapse the *whole* tree?

Many other similiar tree structures in other software have this feature.
For example, holding down CTRL and ALT and clicking on any box will
unfold/expand (or collapse) all nodes/branches from that node and all 
below.

Is there something I'm overlooking? Is this (re-)implementable ?

Many Thanks,
-Jim

http://www.riverbankcomputing.com/mailman/listinfo/pyqt


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Question on QTreeView, interactive expanding/collapsing

2011-04-19 Thread James Polk

Whoops,...just found the *-hotkey,nevermind, lol...



--- On Tue, 4/19/11, James Polk  wrote:

From: James Polk 
Subject: Question on QTreeView, interactive expanding/collapsing
To: pyqt@riverbankcomputing.com
Date: Tuesday, April 19, 2011, 2:09 PM


Greetings All,

In a typical QTreeView,...the default behaviour of clicking on a "plus box",
i.e. the branch boxes of the tree, yields a "single box open", or in the case
of collapsing, a "single box closed" event.

Is there any way to use a keyboard modifier, like SHIFT, CTRL, and/or ALT,
to expand or collapse the *whole* tree?

Many other similiar tree structures in other software have this feature.
For example, holding down CTRL and ALT and clicking on any box will
unfold/expand (or collapse) all nodes/branches from that node and all below.
Is there something I'm overlooking? Is this (re-)implementable ?

Many Thanks,
-Jim

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] Question on QTreeView, interactive expanding/collapsing

2011-04-19 Thread James Polk

Greetings All,

In a typical QTreeView,...the default behaviour of clicking on a "plus box",
i.e. the branch boxes of the tree, yields a "single box open", or in the case
of collapsing, a "single box closed" event.

Is there any way to use a keyboard modifier, like SHIFT, CTRL, and/or ALT,
to expand or collapse the *whole* tree?

Many other similiar tree structures in other software have this feature.
For example, holding down CTRL and ALT and clicking on any box will
unfold/expand (or collapse) all nodes/branches from that node and all below.
Is there something I'm overlooking? Is this (re-)implementable ?

Many Thanks,
-Jim

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Help with Design of Dialog interface

2011-04-19 Thread alsaf
Thanks for that David, much appreciated. I've tried the two examples and 
it is exactly what I'm looking for.

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Error while installing PyQtMobility 1.0 on Ubuntu 10.10

2011-04-19 Thread Phil Thompson
On Tue, 19 Apr 2011 16:46:47 +0100, David Boddie 
wrote:
> On Tue Apr 19 08:06:05 BST 2011, Phil Thompson wrote:
> 
>> Can you try with the current SIP snapshot.
> 
> OK, the code generation appears to work with the latest SIP snapshot and
> PyQtMobility 1.0, building against Qt Mobility 1.1.1. However, I
encounter
> the following error when building the QtLocation module:
> 
> make[1]: Entering directory 
> `/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
> g++ -c -pipe -fPIC -O2 -Wall -W -D_REENTRANT -DNDEBUG
> -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_CORE_LIB
> -DQT_GUI_LIB -I. -I/usr/local/Trolltech/Qt-4.7.2/include/QtMobility
> -I/usr/local/Trolltech/Qt-4.7.2/include/QtLocation
> -I/usr/local/Trolltech/Qt-4.7.2/include/python2.7
> -I/usr/local/Trolltech/Qt-4.7.2/mkspecs/default
> -I/usr/local/Trolltech/Qt-4.7.2/include/QtCore
> -I/usr/local/Trolltech/Qt-4.7.2/include/QtGui
> -I/usr/local/Trolltech/Qt-4.7.2/include -I/usr/X11R6/include -o 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.o 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp
> In file included 
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:45,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
>  from sipAPIQtLocation.h:27,
>  from 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h: In instantiation

> of ‘QTypeInfo’:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:417:   instantiated

> from ‘void QList::node_destruct(QList::Node*, QList::Node*)
[with
> T 
> = QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated

> from ‘void QList::free(QListData::Data*) [with T = 
> QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated

> from ‘QList::~QList() [with T = QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:
 
> instantiated from here
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h:1986: error:
> invalid 
> application of ‘sizeof’ to incomplete type ‘QtMobility::QGeoCoordinate’ 
> In file included 
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobject.h:50,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qiodevice.h:46,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qdatastream.h:46,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:49,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
>  from sipAPIQtLocation.h:27,
>  from 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h: In member function
> ‘void 
> QList::node_destruct(QList::Node*, QList::Node*) [with T = 
> QtMobility::QGeoCoordinate]’:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated

> from ‘void QList::free(QListData::Data*) [with T = 
> QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated

> from ‘QList::~QList() [with T = QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:
 
> instantiated from here
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning:
> possible 
> problem detected in invocation of delete operator:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning:
invalid
> use 
> of incomplete type ‘struct QtMobility::QGeoCoordinate’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55: 
> warning: forward declaration of ‘struct QtMobility::QGeoCoordinate’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: note: neither
> the 
> destructor nor the class-specific operator delete will be called, even
if 
> they are declared when the class is defined.
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:420: error: invalid
> use 
> of incomplete type ‘struct QtMobility::QGeoCoordinate’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55:
> error: 
> forward declaration of ‘struct QtMobility::QGeoCoordinate’
> make[1]: *** [sipQtLocationQList0100QGeoRouteRequestFeatureType.o] Error
1
> make[1]: Leaving directory 
> `/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
> make: *** [all] Error 2
> 
> Previously, I've worked around this by "fixing" the qgeorouterequest.h
> header file, but one of the Qt Mobility developers suggested that the
> failure
> wasn't a Qt Mobility issue.

Should now be fixed in the current snapshot, but you'll also need
tonight's PyQt snapshot.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Error while installing PyQtMobility 1.0 on Ubuntu 10.10

2011-04-19 Thread Phil Thompson
On Tue, 19 Apr 2011 16:46:47 +0100, David Boddie 
wrote:
> On Tue Apr 19 08:06:05 BST 2011, Phil Thompson wrote:
> 
>> Can you try with the current SIP snapshot.
> 
> OK, the code generation appears to work with the latest SIP snapshot and
> PyQtMobility 1.0, building against Qt Mobility 1.1.1. However, I
encounter
> the following error when building the QtLocation module:
> 
> make[1]: Entering directory 
> `/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
> g++ -c -pipe -fPIC -O2 -Wall -W -D_REENTRANT -DNDEBUG
> -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_CORE_LIB
> -DQT_GUI_LIB -I. -I/usr/local/Trolltech/Qt-4.7.2/include/QtMobility
> -I/usr/local/Trolltech/Qt-4.7.2/include/QtLocation
> -I/usr/local/Trolltech/Qt-4.7.2/include/python2.7
> -I/usr/local/Trolltech/Qt-4.7.2/mkspecs/default
> -I/usr/local/Trolltech/Qt-4.7.2/include/QtCore
> -I/usr/local/Trolltech/Qt-4.7.2/include/QtGui
> -I/usr/local/Trolltech/Qt-4.7.2/include -I/usr/X11R6/include -o 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.o 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp
> In file included 
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:45,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
>  from sipAPIQtLocation.h:27,
>  from 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h: In instantiation

> of ‘QTypeInfo’:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:417:   instantiated

> from ‘void QList::node_destruct(QList::Node*, QList::Node*)
[with
> T 
> = QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated

> from ‘void QList::free(QListData::Data*) [with T = 
> QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated

> from ‘QList::~QList() [with T = QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:
 
> instantiated from here
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h:1986: error:
> invalid 
> application of ‘sizeof’ to incomplete type ‘QtMobility::QGeoCoordinate’ 
> In file included 
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobject.h:50,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qiodevice.h:46,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qdatastream.h:46,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:49,
>  
> from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
>  from sipAPIQtLocation.h:27,
>  from 
> sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h: In member function
> ‘void 
> QList::node_destruct(QList::Node*, QList::Node*) [with T = 
> QtMobility::QGeoCoordinate]’:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated

> from ‘void QList::free(QListData::Data*) [with T = 
> QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated

> from ‘QList::~QList() [with T = QtMobility::QGeoCoordinate]’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:
 
> instantiated from here
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning:
> possible 
> problem detected in invocation of delete operator:
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning:
invalid
> use 
> of incomplete type ‘struct QtMobility::QGeoCoordinate’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55: 
> warning: forward declaration of ‘struct QtMobility::QGeoCoordinate’
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: note: neither
> the 
> destructor nor the class-specific operator delete will be called, even
if 
> they are declared when the class is defined.
> /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:420: error: invalid
> use 
> of incomplete type ‘struct QtMobility::QGeoCoordinate’
> /usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55:
> error: 
> forward declaration of ‘struct QtMobility::QGeoCoordinate’
> make[1]: *** [sipQtLocationQList0100QGeoRouteRequestFeatureType.o] Error
1
> make[1]: Leaving directory 
> `/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
> make: *** [all] Error 2
> 
> Previously, I've worked around this by "fixing" the qgeorouterequest.h
> header file, but one of the Qt Mobility developers suggested that the
> failure
> wasn't a Qt Mobility issue.

I've had to "fix" 5 different .h files with v1.1.1. The problem is that
these files aren't self contained, i.e. they don't #include other files
they depend on. At the very least these are documentation bugs that don't
specify all the files you have to #include to use a particular class - but
they are really bugs in the 

Re: [PyQt] Error while installing PyQtMobility 1.0 on Ubuntu 10.10

2011-04-19 Thread David Boddie
On Tue Apr 19 08:06:05 BST 2011, Phil Thompson wrote:

> Can you try with the current SIP snapshot.

OK, the code generation appears to work with the latest SIP snapshot and
PyQtMobility 1.0, building against Qt Mobility 1.1.1. However, I encounter
the following error when building the QtLocation module:

make[1]: Entering directory 
`/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
g++ -c -pipe -fPIC -O2 -Wall -W -D_REENTRANT -DNDEBUG -DSIP_PROTECTED_IS_PUBLIC 
-Dprotected=public -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -I. 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtMobility 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtLocation 
-I/usr/local/Trolltech/Qt-4.7.2/include/python2.7 
-I/usr/local/Trolltech/Qt-4.7.2/mkspecs/default 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtCore 
-I/usr/local/Trolltech/Qt-4.7.2/include/QtGui 
-I/usr/local/Trolltech/Qt-4.7.2/include -I/usr/X11R6/include -o 
sipQtLocationQList0100QGeoRouteRequestFeatureType.o 
sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp
In file included 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:45,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
 from sipAPIQtLocation.h:27,
 from 
sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h: In instantiation 
of ‘QTypeInfo’:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:417:   instantiated 
from ‘void QList::node_destruct(QList::Node*, QList::Node*) [with T 
= QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated 
from ‘void QList::free(QListData::Data*) [with T = 
QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated 
from ‘QList::~QList() [with T = QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:   
instantiated from here
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qglobal.h:1986: error: invalid 
application of ‘sizeof’ to incomplete type ‘QtMobility::QGeoCoordinate’ 
In file included 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobject.h:50,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qiodevice.h:46,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qdatastream.h:46,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qmetatype.h:49,
 
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QMetaType:1,
 from sipAPIQtLocation.h:27,
 from 
sipQtLocationQList0100QGeoRouteRequestFeatureType.cpp:21:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h: In member function ‘void 
QList::node_destruct(QList::Node*, QList::Node*) [with T = 
QtMobility::QGeoCoordinate]’:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:742:   instantiated 
from ‘void QList::free(QListData::Data*) [with T = 
QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:717:   instantiated 
from ‘QList::~QList() [with T = QtMobility::QGeoCoordinate]’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:113:   
instantiated from here
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning: possible 
problem detected in invocation of delete operator:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: warning: invalid use 
of incomplete type ‘struct QtMobility::QGeoCoordinate’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55: 
warning: forward declaration of ‘struct QtMobility::QGeoCoordinate’
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:418: note: neither the 
destructor nor the class-specific operator delete will be called, even if 
they are declared when the class is defined.
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qlist.h:420: error: invalid use 
of incomplete type ‘struct QtMobility::QGeoCoordinate’
/usr/local/Trolltech/Qt-4.7.2/include/QtLocation/qgeorouterequest.h:55: error: 
forward declaration of ‘struct QtMobility::QGeoCoordinate’
make[1]: *** [sipQtLocationQList0100QGeoRouteRequestFeatureType.o] Error 1
make[1]: Leaving directory 
`/home/dboddie/Software/PyQtMobility-gpl-1.0/QtLocation'
make: *** [all] Error 2

Previously, I've worked around this by "fixing" the qgeorouterequest.h
header file, but one of the Qt Mobility developers suggested that the failure
wasn't a Qt Mobility issue.

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Disable context menu of a plugin in QWebview

2011-04-19 Thread Hans-Peter Jansen
On Monday 18 April 2011, 11:16:17 Gelonida N wrote:
> Hi,
>
> Now I am able to activate a flash plugin in my QWebview browser and
> things work as they should.
>
> There is just one minor problem
>
>
> The browser should always display a given context menu when the user
> clicks on the riht mouse button.
>
>
> The flash plugin however grabs the right mouse click and displays the
> plugin's menu.
>
> Is there any way to just display the default browser context menu.
>
> If really desired, then I could perhaps allow a second path (sub menu of
> my context menu) to access the plugins context menu.

I don't believe, that this is possible without getting very, very dirty, but 
if you found a solution, let us know. (ld preloading comes to my mind).

Good luck,
Pete
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Reopening QT Window - Segfault

2011-04-19 Thread Michka Popoff
Hello

I need some help to implement a QT Window to draw some OpenGL in an
python-GTK2 application.
In the GTK application, I have a push button which will launch an OpenGL
scenery (In a QT window). I should be able to close the OpenGL Window and to
reopen it as many times as I want, without exiting the GTK application.

I used the code found here : http://www.siafoo.net/snippet/316 , but
rewritten for my app (as I call main() from the GTK part) :

def main():
app = QtGui.QApplication(['Spiral Widget Demo'])
window = SpiralWidgetDemo()
window.show()
app.exec_()


My code works perfectly under Mac OS X with python 2.7 and the pyQT port
from macports. But under Ubuntu 10.10 with python 2.6.6 I get a segmentation
fault if I try to reopen the window.

What I do :

- Open OpenGL Window (QT)
- Close it with the X
- Reopen it
- SegFault here

Why is there a difference between the OS X and ubuntu packages ? I have a
backtrace (made with dgb) of the segfault. It seems that the memory is not
cleared when I close the window. I don't want to use sys.exit because it
will also close my GTK app.


#0  0x00497d72 in ?? ()
#1  0x00499642 in PyErr_WarnEx ()
#2  0x7536d274 in ?? ()
   from /usr/lib/pymodules/python2.6/gtk-2.0/gobject/_gobject.so
#3  0x75a0bb89 in g_logv () from /lib/libglib-2.0.so.0
#4  0x75a0bfa3 in g_log () from /lib/libglib-2.0.so.0
#5  0x7fffe1cde39e in ?? () from /usr/lib/libQtGui.so.4
#6  0x7fffe1cdf06e in ?? () from /usr/lib/libQtGui.so.4
#7  0x7fffe1ce4036 in ?? () from /usr/lib/libQtGui.so.4
#8  0x7fffe1cc78ee in QGtkStyle::QGtkStyle() () from
/usr/lib/libQtGui.so.4
#9  0x7fffe1c4dda3 in QStyleFactory::create(QString const&) ()
   from /usr/lib/libQtGui.so.4
#10 0x7fffe193cfa7 in QApplication::style() () from
/usr/lib/libQtGui.so.4
#11 0x7fffe1945be5 in QApplicationPrivate::initialize() ()
   from /usr/lib/libQtGui.so.4
#12 0x7fffe1945d01 in QApplicationPrivate::construct(_XDisplay*,
unsigned long, unsigned long) () from /usr/lib/libQtGui.so.4
#13 0x7fffe1946d91 in QApplication::QApplication(int&, char**, int) ()
   from /usr/lib/libQtGui.so.4
#14 0x7fffe291f654 in ?? ()
   from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so
#15 0x7fffe291f73d in ?? ()
   from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so

Thank you in advance if somebody has any explanation why this happens and
how to close the window properly and free up memory/threads which are
perhaps still open.


Michka
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Python property in QObject masks AttributeErrors

2011-04-19 Thread Benjamin Kloster
On Tue, 2011-04-19 at 08:08 +0100, Phil Thompson wrote:
> On Tue, 19 Apr 2011 08:46:13 +0200, Benjamin Kloster
>  wrote:
> > On Mon, 2011-04-18 at 22:18 +0100, Phil Thompson wrote:
> >> On Mon, 18 Apr 2011 14:07:13 +0200, Benjamin Kloster
> >>  wrote:
> >> > Hi everyone,
> >> > twice now I've stumbled over a subtle bug when subclassing QObject.
> >> > When
> >> > the getter of a python property raises an AttributeError for any
> >> > attribute or object, PyQt seems to reraise this error improperly,
> >> > clearing the traceback and often reporting a false object type and
> >> > attribute name. See the attached script for a minimal example.
> >> > 
> >> > Regards,
> >> > Ben
> >> 
> >> It's working as it should.
> >> 
> >> If the getter raises an AttributeError Python then calls any
> __getattr__
> >> method. If there is no method then the exception raised by the getter
> is
> >> propagated. If there is a __getattr__ then the getter exception is
> >> discarded and the exception raised by __getattr__ is propagated.
> >> 
> >> QObject implements __getattr__ so the exception raised by the failure
> of
> >> QtCore.iDontExist is discarded. The exception that QObject.__getattr__
> >> raises is what you are seeing.
> >> 
> >> Phil
> >> 
> > 
> > The normal behavior of a Python object is to report the first
> > AttributeError ("'module' object has no attribute 'iDontExist'). At
> > least in Python 2.6, 2.7 and 3.2 it is. Just replace "QtCore.QObject"
> > with "object" in the example to reproduce this.
> > 
> > Especially if a getter is rather involved and maybe even calls third
> > party libraries that produce the original AttributeError, debugging
> > becomes confusing at best with PyQt's behavior.
> > 
> > If it's not feasible to implement the correct (i.e. standard Python)
> > error reporting, I can live with that. However, I couldn't find any note
> > of this caveat in PyQt's documentation. So if it's really not there, it
> > should probably be added.
> 
> The behaviour *is* the standard Python behaviour - it's not a PyQt thing.
> 
> Change "QtCore.QObject" with "object" and add a __getattr__ method that
> raises an exception and you'll see.
> 
> Phil
> 

Right. Sorry, my bad for not reading your first response correctly.
Anyway, I hope some poor souls will find this thread via Google when
they run into the same surprise.

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Python property in QObject masks AttributeErrors

2011-04-19 Thread Phil Thompson
On Tue, 19 Apr 2011 08:46:13 +0200, Benjamin Kloster
 wrote:
> On Mon, 2011-04-18 at 22:18 +0100, Phil Thompson wrote:
>> On Mon, 18 Apr 2011 14:07:13 +0200, Benjamin Kloster
>>  wrote:
>> > Hi everyone,
>> > twice now I've stumbled over a subtle bug when subclassing QObject.
>> > When
>> > the getter of a python property raises an AttributeError for any
>> > attribute or object, PyQt seems to reraise this error improperly,
>> > clearing the traceback and often reporting a false object type and
>> > attribute name. See the attached script for a minimal example.
>> > 
>> > Regards,
>> > Ben
>> 
>> It's working as it should.
>> 
>> If the getter raises an AttributeError Python then calls any
__getattr__
>> method. If there is no method then the exception raised by the getter
is
>> propagated. If there is a __getattr__ then the getter exception is
>> discarded and the exception raised by __getattr__ is propagated.
>> 
>> QObject implements __getattr__ so the exception raised by the failure
of
>> QtCore.iDontExist is discarded. The exception that QObject.__getattr__
>> raises is what you are seeing.
>> 
>> Phil
>> 
> 
> The normal behavior of a Python object is to report the first
> AttributeError ("'module' object has no attribute 'iDontExist'). At
> least in Python 2.6, 2.7 and 3.2 it is. Just replace "QtCore.QObject"
> with "object" in the example to reproduce this.
> 
> Especially if a getter is rather involved and maybe even calls third
> party libraries that produce the original AttributeError, debugging
> becomes confusing at best with PyQt's behavior.
> 
> If it's not feasible to implement the correct (i.e. standard Python)
> error reporting, I can live with that. However, I couldn't find any note
> of this caveat in PyQt's documentation. So if it's really not there, it
> should probably be added.

The behaviour *is* the standard Python behaviour - it's not a PyQt thing.

Change "QtCore.QObject" with "object" and add a __getattr__ method that
raises an exception and you'll see.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Error while installing PyQtMobility 1.0 on Ubuntu 10.10

2011-04-19 Thread Phil Thompson
On Tue, 19 Apr 2011 00:22:30 +0200, David Boddie 
wrote:
> On Mon, 18 Apr 2011 11:24:13 +0100, Phil Thompson wrote:
>> On Mon, 18 Apr 2011 18:13:17 +0800, chinakr  wrote:
> 
> [...]
> 
>> > Generating the C++ source for the QtContacts module...
>> > sip:
>>
>>
/home/chinakr/src/PyQtMobility-gpl-1.0/sip/QtContacts/qcontactaddress.sip:37:
>> > Cannot mix %AccessCode and %GetCode or %SetCode
>> > Error: Unable to create the C++ code.
>> >
>> > I tried to google with 'Error: Unable to create the C++ code', but
>> > found nothing.
>> > What should I do now? Any suggestion?
>>
>> I can't reproduce this. Can you try with the current SIP snapshot?
> 
> I encountered this on two, possibly three different systems, so I'll try
to
> reproduce the problem and post more details.
> 
> Since I was building everything from source, my workaround was to build
> PyQt
> then hack SIP to get PyQtMobility to build.
> 
> David

Can you try with the current SIP snapshot.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt