Re: [Interest] QObject.destroyed() not working?!

2017-03-27 Thread Alexandru Croitor
Hi,

I'm going to assume this is with PyQt.

Aside from what Thiago already mentioned, you could try to connect a method 
declared outside of the class scope.
So something like:

def myDestructor(obj):
  pass

class MyClass(object):
  def __init__(self):
  self.destroyed.connect(myDestructor)

Also do take into account that a Python object's destructor aka __del__ method 
might not be executed if the object is part of a cycle, due to the garbage 
collector not knowing the order in which destructors should be called.
I believe starting with Python 3.4, finalizers are always called.


> On 27 Mar 2017, at 03:52, Frank Rueter | OHUfx  wrote:
> 
> Hi,
> 
> I'm pretty sure I'm misinterpreting how this should work so maybe you guys 
> can help:
> 
> I have a QObject which I would like to run a simple clean up job just before 
> it's destroyed.
> I thought I could simply do this in it's constructor:
>self.destroyed.connect(self.__cleanUp)
> 
> Then have self.__cleanUp() to the work.
> However, a simple print statement inside self.__cleanUp() shows that it's 
> never run.
> 
> What am I missing?
> 
> Thanks,
> frank
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Model/Views and Drag&Drop actions

2017-03-27 Thread Etienne Sandré-Chardonnal
Dear all,

I have two custom models associated with views and I would like to drag
from model A and drop into model B.

Model B has overloaded supportedDropActions and returns Qt::LinkAction

Model A has overloaded supportedDragActions and returns Qt::MoveAction |
Qt::LinkAction

This does not work as the cursor turns to a forbidden sign when dragging
over B.

If model A supportedDragActions returns Qt::LinkAction only, then this
works.



If I look to the source code of QAbstractItemViewPrivate, i find in
canDecode(QDropEvent * e):

if (mime->hasFormat(modelTypes.at(i))
   && (e->dropAction() & model->supportedDropActions()))
return true;

Which explains the issue, the event handler does not check the event's
possible drop actions and does not call setDropAction if the proposed
action is not supported.

Is this a bug or a feature?

Thanks
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt3D - Bounds of visible entities

2017-03-27 Thread Andy
On Sun, Mar 26, 2017 at 5:12 AM, Mike Krus  wrote:

> Hi Andy
>
> > On 26 Mar 2017, at 00:51, Andy  wrote:
> > Are there plans to add an interface to get the bounds of visible
> entities (ones with geometry that is rendered)?
> >
> > Seems like something a lot of developers would need for moving the
> camera around - centering scenes, handling standard camera views (top,
> left, right, etc.), zooming in to a specific object, etc..
> support for some of these basic operations is in the works for 5.10. Due
> to frontend/backend split and heavy multithreading in Qt3D, it’s not
> trivial to expose such data structures directly as they are maintained by
> the backend. See https://codereview.qt-project.org/#/c/183705/ and
> previous few patches.
>

Thanks for the response Mike.

That change set looks like it would cover a lot of use-cases w.r.t. the
camera. Unfortunately 5.10 looks to be a little less than a year away
(given the current 5.9 timeline). Is there any chance something like this
could land earlier - 5.9.1?


>
> Access to bounding volume data structures will come in some form but how
> exactly is unclear yet.
>
> Also bounding volumes in the backend are computed as spheres which may or
> may not fit for your purpose (for example, they are not very useful as a
> basis for displaying a box around selected objects).
>

Right - displaying selection of objects is likely another common, obvious
use-case. Are there plans to calculate/store bounding boxes at some point?


>
> > If we do have to do it outside the framework, what would be the general
> approach? I haven't quite figured out how to do it with the current public
> API.
> >
> > I have a QEntity-derived class, and I wanted to look for
> QGeometryRenderer/QTransform components being added to it, hook in to their
> signals, and calculate & store the info on the entity. But as far as I can
> tell there's no way for an entity to receive notification that components
> are added/removed. The addComponent() and removeComponent() methods aren't
> virtual so I can't override them either.
> frontend and backend nodes don’t rely on signals and slots to communicate
> change notifications, but use change messages. There is a
> QComponentAddedChange message, but I don’t think a frontend node can listen
> to it’s own change messages.
>
> > Is there an easier approach that I'm missing?
> I think currently you would have to maintain all the necessary information
> in your application, making sure it’s updated when the scene graph changes,
> etc.
>

> Hope this helps,
>
> Mike
>
> --
> Mike Krus | mike.k...@kdab.com | Senior Software Engineer
> KDAB (UK) Ltd., a KDAB Group company
> Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
> KDAB - The Qt Experts
>
>

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Model/Views and Drag&Drop actions

2017-03-27 Thread Jason H

With the &, it looks like it's using a bitmask. Make sure that the dropAction() and supportedDropActions() values are arranged correctly, as a bitmask.

 

 

00100 * 00111  = 00100, return true. Therefore the only other thing is it is a mime issue?

 


Sent: Monday, March 27, 2017 at 9:28 AM
From: "Etienne Sandré-Chardonnal" 
To: "interest@qt-project.org" 
Subject: [Interest] Model/Views and Drag&Drop actions












Dear all,
 
I have two custom models associated with views and I would like to drag from model A and drop into model B.
 
Model B has overloaded supportedDropActions and returns Qt::LinkAction
 
Model A has overloaded supportedDragActions and returns Qt::MoveAction | Qt::LinkAction
 
This does not work as the cursor turns to a forbidden sign when dragging over B.
 
If model A supportedDragActions returns Qt::LinkAction only, then this works.
 

 
If I look to the source code of QAbstractItemViewPrivate, i find in canDecode(QDropEvent * e):

    if (mime->hasFormat(modelTypes.at(i))
   && (e->dropAction() & model->supportedDropActions()))
    return true;
 
Which explains the issue, the event handler does not check the event's possible drop actions and does not call setDropAction if the proposed action is not supported.
 
Is this a bug or a feature?




___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] How to make a 2D scrollable GridView

2017-03-27 Thread Lynetta Rajkovich
Hi!


I need to make a Grid that is, lets say, 15 x 15 where only a 4 x 4 subset is 
shown in the application window at a time.  Scrolling is done using the mouse 
scroll wheel or arrow keyboard keys. The grid size and subset size will be 
fixed and known.


Can you please suggest an approach for this using Qt Quick / Qml framework or 
point me to an example?


Regards,

Lynetta
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QObject.destroyed() not working?!

2017-03-27 Thread Frank Rueter | OHUfx

Thanks Thiago,

that makes sense.

Cheers,
frank

On 27/03/17 7:48 PM, Thiago Macieira wrote:

On domingo, 26 de março de 2017 18:52:48 PDT Frank Rueter | OHUfx wrote:

Hi,

I'm pretty sure I'm misinterpreting how this should work so maybe you
guys can help:

I have a QObject which I would like to run a simple clean up job just
before it's destroyed.
I thought I could simply do this in it's constructor:
  self.destroyed.connect(self.__cleanUp)

Then have self.__cleanUp() to the work.
However, a simple print statement inside self.__cleanUp() shows that
it's never run.

I don't speak Python, so I am answering in terms of C++:

QObject::destroyed() is emitted from QObject's own destructor. That means the
object, at the time, *IS* a QObject and not your class. There is no slot
called "__cleanUp" at that time anymore.

destroyed() is useful for another QObject to perform some actions, not for the
same object. If you need some actions to be performed at the time of
destruction, just put them in your class's destructor.



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QObject.destroyed() not working?!

2017-03-27 Thread Frank Rueter | OHUfx

Thanks Alexandru,

I will try it the way you suggest.

Cheers,
frank

On 27/03/17 9:59 PM, Alexandru Croitor wrote:

Hi,

I'm going to assume this is with PyQt.

Aside from what Thiago already mentioned, you could try to connect a method 
declared outside of the class scope.
So something like:

def myDestructor(obj):
   pass

class MyClass(object):
   def __init__(self):
   self.destroyed.connect(myDestructor)

Also do take into account that a Python object's destructor aka __del__ method 
might not be executed if the object is part of a cycle, due to the garbage 
collector not knowing the order in which destructors should be called.
I believe starting with Python 3.4, finalizers are always called.



On 27 Mar 2017, at 03:52, Frank Rueter | OHUfx  wrote:

Hi,

I'm pretty sure I'm misinterpreting how this should work so maybe you guys can 
help:

I have a QObject which I would like to run a simple clean up job just before 
it's destroyed.
I thought I could simply do this in it's constructor:
self.destroyed.connect(self.__cleanUp)

Then have self.__cleanUp() to the work.
However, a simple print statement inside self.__cleanUp() shows that it's never 
run.

What am I missing?

Thanks,
frank

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] How to make a 2D scrollable GridView

2017-03-27 Thread Majid Kamali
See Example Usage http://doc.qt.io/qt-5/qml-qtquick-flickable.html
Nesting a GridLayout inside the Flickable may be useful

On Mon, Mar 27, 2017 at 10:13 PM, Lynetta Rajkovich <
lynetta.rajkov...@esterline.com> wrote:

> Hi!
>
>
> I need to make a Grid that is, lets say, 15 x 15 where only a 4 x
> 4 subset is shown in the application window at a time.  Scrolling is done
> using the mouse scroll wheel or arrow keyboard keys. The grid size and
> subset size will be fixed and known.
>
>
> Can you please suggest an approach for this using Qt Quick / Qml framework
> or point me to an example?
>
>
> Regards,
> Lynetta
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] QOpenGLWidget inside QDockWidget

2017-03-27 Thread Alexandre Ribeiro
Hi,

I've placed a QOpenGLWidget inside a QDockWidget and everything works as
expected.

However when I drag the dockwidget from the main window there's a blue
flicker in the QOpenGLWidget. This blue flicker has nothing to do with my
OpenGL code (right now it's merely clearing the background with red).

Any idea on what might be happening?

Best regards,
Alex
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Is there a way to simulate serial port data?

2017-03-27 Thread Murphy, Sean
I've got a class that inherits from QSerialPort. The bulk of the code in the 
class is parsing that I'm doing in a slot that is connected to QSerialPort's 
readyRead() signal. I want to inject known data  into this class as if it's 
actually coming across the serial port to validate my parsing code, is there 
any way to do that? Ideally I'd be able to write data in and have it trigger 
the readyRead() signal, but I'm not seeing any way to do that.

I know I could write a separate application that writes out one serial port, 
and then I could cable that back to my other serial port, but I was just 
looking for a way to do it all in code.

Sean

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is there a way to simulate serial port data?

2017-03-27 Thread Henry Skoglund
Hi, I faced a simular situation last summer, and I used this: 
http://com0com.sourceforge.net/


Rgrds Henry
P.S. I think it only works on Windows, though.

On 2017-03-28 00:48, Murphy, Sean wrote:

I've got a class that inherits from QSerialPort. The bulk of the code in the 
class is parsing that I'm doing in a slot that is connected to QSerialPort's 
readyRead() signal. I want to inject known data  into this class as if it's 
actually coming across the serial port to validate my parsing code, is there 
any way to do that? Ideally I'd be able to write data in and have it trigger 
the readyRead() signal, but I'm not seeing any way to do that.

I know I could write a separate application that writes out one serial port, 
and then I could cable that back to my other serial port, but I was just 
looking for a way to do it all in code.

Sean

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest




___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [EXTERNAL] Re: How to make a 2D scrollable GridView

2017-03-27 Thread Lynetta Rajkovich
I can't seem to create a GridLayout that has elements off the screen.  The 
whole notion of a GridLayout is the ability to resize.  In my case the window 
and elements will be a fixed size like a grid of similar buttons. How do I 
create elements that are a fixed size such that some rows and columns are not 
inside the window?


Regards,

Lynetta

From: Interest 
 on behalf of 
Majid Kamali 
Sent: Monday, March 27, 2017 2:18 PM
Cc: interest@qt-project.org
Subject: [EXTERNAL] Re: [Interest] How to make a 2D scrollable GridView

See Example Usage 
http://doc.qt.io/qt-5/qml-qtquick-flickable.html
Nesting a GridLayout inside the Flickable may be useful

On Mon, Mar 27, 2017 at 10:13 PM, Lynetta Rajkovich 
mailto:lynetta.rajkov...@esterline.com>> wrote:

Hi!


I need to make a Grid that is, lets say, 15 x 15 where only a 4 x 4 subset is 
shown in the application window at a time.  Scrolling is done using the mouse 
scroll wheel or arrow keyboard keys. The grid size and subset size will be 
fixed and known.


Can you please suggest an approach for this using Qt Quick / Qml framework or 
point me to an example?


Regards,

Lynetta

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Model/Views and Drag&Drop actions

2017-03-27 Thread Etienne Sandré-Chardonnal
Qt::DropActions is a bitmask. The issue I suspect is that instead of:

e->dropAction() & model->supportedDropActions()

we should have:

e->possibleActions() & model->supportedDropActions()

So that any action common to both the source model dragActions() and the
destination model dropActions() can be used.

Etienne

2017-03-27 19:20 GMT+02:00 Jason H :

> With the &, it looks like it's using a bitmask. Make sure that the
> dropAction() and supportedDropActions() values are arranged correctly, as a
> bitmask.
>
>
> 00100 * 00111  = 00100, return true. Therefore the only other thing is it
> is a mime issue?
>
> *Sent:* Monday, March 27, 2017 at 9:28 AM
> *From:* "Etienne Sandré-Chardonnal" 
> *To:* "interest@qt-project.org" 
> *Subject:* [Interest] Model/Views and Drag&Drop actions
> Dear all,
>
> I have two custom models associated with views and I would like to drag
> from model A and drop into model B.
>
> Model B has overloaded supportedDropActions and returns Qt::LinkAction
>
> Model A has overloaded supportedDragActions and returns Qt::MoveAction |
> Qt::LinkAction
>
> This does not work as the cursor turns to a forbidden sign when dragging
> over B.
>
> If model A supportedDragActions returns Qt::LinkAction only, then this
> works.
>
>
>
> If I look to the source code of QAbstractItemViewPrivate, i find in
> canDecode(QDropEvent * e):
>
> if (mime->hasFormat(modelTypes.at(i))
>&& (e->dropAction() & model->supportedDropActions()))
> return true;
>
> Which explains the issue, the event handler does not check the event's
> possible drop actions and does not call setDropAction if the proposed
> action is not supported.
>
> Is this a bug or a feature?
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is there a way to simulate serial port data?

2017-03-27 Thread Samuel Gaist

> On 28 Mar 2017, at 00:48, Murphy, Sean  wrote:
> 
> I've got a class that inherits from QSerialPort. The bulk of the code in the 
> class is parsing that I'm doing in a slot that is connected to QSerialPort's 
> readyRead() signal. I want to inject known data  into this class as if it's 
> actually coming across the serial port to validate my parsing code, is there 
> any way to do that? Ideally I'd be able to write data in and have it trigger 
> the readyRead() signal, but I'm not seeing any way to do that.
> 
> I know I could write a separate application that writes out one serial port, 
> and then I could cable that back to my other serial port, but I was just 
> looking for a way to do it all in code.
> 
> Sean
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

Hi,

What about writing a “virtual serial port” ?

QSerialPort is a QIODevice, so one thing you can do is to replace it with a 
custom QIODevice where you can write what you from e.g. a “console widget” to 
evaluate what you want from your application.

Cheers
Samuel


signature.asc
Description: Message signed with OpenPGP
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is there a way to simulate serial port data?

2017-03-27 Thread Murphy, Sean
> What about writing a “virtual serial port” ?
> 
> QSerialPort is a QIODevice, so one thing you can do is to replace it with a
> custom QIODevice where you can write what you from e.g. a “console
> widget” to evaluate what you want from your application.

So you're suggesting when I want to debug my class I change this:
  class mySerialPort : public QSerialPort {};
to
  class mySerialPort : public virtualSerialPort {};
and recompile (where virtualSerialPort inherits from a QIODevice that I 
customize to do what I need to do)?

Basically the features I need are:
1. I need to be able to inject a QByteArray into the class and have that emit 
the readyRead() signal
2. The readyRead() signal is connected to my parse() slot
3. in parse(), I need myClass::readAll() to come back with that same QByteArray 
that I injected in step #1

It looks like maybe QBuffer (which I didn’t know existed) might be close to 
what I need... Ideally I was hoping to do it in a way that I didn't have to 
change any of the code of my serial port class, just to make sure I'm not 
introducing an error during this process...

Sean
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is there a way to simulate serial port data?

2017-03-27 Thread Ch'Gans
On 28 March 2017 at 12:58, Murphy, Sean  wrote:
>> What about writing a “virtual serial port” ?
>>
>> QSerialPort is a QIODevice, so one thing you can do is to replace it with a
>> custom QIODevice where you can write what you from e.g. a “console
>> widget” to evaluate what you want from your application.
>
> So you're suggesting when I want to debug my class I change this:
>   class mySerialPort : public QSerialPort {};
> to
>   class mySerialPort : public virtualSerialPort {};
> and recompile (where virtualSerialPort inherits from a QIODevice that I 
> customize to do what I need to do)?
>
> Basically the features I need are:
> 1. I need to be able to inject a QByteArray into the class and have that emit 
> the readyRead() signal
> 2. The readyRead() signal is connected to my parse() slot
> 3. in parse(), I need myClass::readAll() to come back with that same 
> QByteArray that I injected in step #1
>
> It looks like maybe QBuffer (which I didn’t know existed) might be close to 
> what I need... Ideally I was hoping to do it in a way that I didn't have to 
> change any of the code of my serial port class, just to make sure I'm not 
> introducing an error during this process...

First of all your parsing class should only do the parsing, so it
shouldn't derive from QSerialPort.
instead it should take a QSerialPort pointer as a parameter, eg:
QSerialPort port(...);
port.open(...)
Parser parser(&serialPort);
Result result = parser.parse();
or
Parser parser;
parser.setSerialPort(&port);

This way, you could then derive QSerialPort into a VirtualSerialPort,
and use it this way:
VirtualSerialPort port(...);
port.setData(byteArray);
port.SetSomeConfigurationParameter(...);
parser parser(&port);
Result result = parser.parse();

A parser is not a serial port (do not use derivation), a parser uses a
serial port (use data member).

Look for example at QXmlStreamReader, it can be used with any
QIODevice, including  QBuffer:
http://doc.qt.io/qt-5/qxmlstreamreader.html#setDevice


My 2 cents;

>
> Sean
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Cross-platform screen capture

2017-03-27 Thread Igor Mironchik

Hello,

Doesn anybody know and cross-platform solution that allows to capture 
given rectangle but without active window (or any given window).


Thank you.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Ignore SSL errors on Android 6.0+

2017-03-27 Thread Jan 'Koviš' Struhár

Hi,

my mobile app using QNetworkAccessManager to access https://www.webnotes.cz

stopped working with Android 6.0+ (there were general problems with SSL 
solved by bundling OpenSSL libs, that is OK).


Other sites that have SSL certificates well set do work well.

On Linux desktop also the problematic site works well, but on Android 
the system is too unhappy about untrusted certificate and it does not 
return a reply.


What did not help so far:

* QSslSocket::VerifyNone in QSslConfiguration::setPeerVerifyMode

* QNetworkReply::ignoreSslErrors() as reaction to 
QNetworkAccessManager::sslErrors signal


* QSslSocket::addDefaultCaCertificate with all involved certificates

It seems to me that native C++ is unable to set SSL errors ignorance or 
I am not getting something important.



With native Android Java the correct response is coming as soon as I 
force ignoring SSL errors.


Any idea how to ignore the SSL errors on newer Androids?

Thank you in advance

Jan Struhar

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest