Re: [Interest] how to restart QProcess after it fails?

2019-06-01 Thread Frank Rueter | OHUfx

Thanks Thiago,

that seems to have solved it, i.e. having the slot call a single shot 
timer which triggers the re-run.


Cheers,
frank

On 2/06/19 4:09 AM, Thiago Macieira wrote:

On Saturday, 1 June 2019 00:26:49 PDT Frank Rueter | OHUfx wrote:

I also connect QProcess.stateChanged to another slot which looks like this:

  def __retry_process(self, process_state):

Don't do it from inside that slot. The problem is that the state is still
changing.

Do it at any point after. I recommend using a timer with a non-zero amount of
time, to ensure you're backing off.



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


[Interest] how to restart QProcess after it fails?

2019-06-01 Thread Frank Rueter | OHUfx

Hi all,

I am using QProcess to launch an external application. The main part 
work without trouble, but I need to check for license errors and if one 
occurred, I need would like to restart the existing process with all 
it's environment settings and signal connections a certain number of times.


I connect QProcess.readyReadStandardError to a slot that toggles an 
attribute called self.in_error to True.

I also connect QProcess.stateChanged to another slot which looks like this:

    def __retry_process(self, process_state):
    max_retries = 5
    if (process_state == QtCore.QProcess.NotRunning) and self.in_error:
            # process has finished in an error state, so try to run it 
again

    self.current_try += 1
    print 'retrying {}/{}'.format(self.current_try, max_retries)
    self.process.start(self.process.program(), 
self.process.arguments())


This prints the line "retrying 1/5" but after that nothing happens. I 
can't see any log output from self.process so if seems to simply not be 
running the second time around.
I thought this would recursively call self.process 5 times after failing 
the first time, since self.process.stateChanged is still connected to 
self__retry_process(), and the current_try attribute is on class level 
where it gets incremented on every unsuccessful try.


I am obviously wrong about that. Could someboy help me out please?

Cheers,
frank
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] PySide2 installer for windows?

2019-05-22 Thread Frank Rueter | OHUfx
I do understand, but a few months ago we were able to run this to 
install a PySide2 version that works just fine:


pip install --index-url=http://download.qt.io/snapshots/ci/pyside/5.6/latest/  
pyside2 --trusted-host download.qt.io

We only need this for a single inhouse app we use every day and it has 
worked perfectly on the three machines it was installed on.


Now we need it on more machines and the above no longer works.
I didn't want to get into any more complicated issues.

I understand for serious development this is very important, but for us 
it's a single, simple but important tool we can't use easily (except on 
three machines) and I would love to rectify this until I get time to 
adapt the code for python3.


So if anybody has an idea where to find the installer that would have 
been pulled via the above earlier this year I would very much appreciate it.


Cheers,
frank


On 22/05/19 2:53 AM, Cristián Maureira-Fredes wrote:

Hello,

Just wanted to point out that when you go to:

https://pyside.org

you see a colorful table with the
compatibility on the different platform and the reason
behind them being not supported.

I was under the impression that it was the best
way possible to communicate these release of the
details, but I think I was mistaken.

Since I don't want this to be a RTFM email,
I'm honestly asking:

Does anyone has any other more direct way to communicate this?

Maybe people were confused while visiting:

https://www.qt.io/qt-for-python

Should we mention the support there too?

I really would like to know how to communicate this,
since it's possible that in an unknown period of time
we will drop support for Python2 (months? years?)
and then we will need to communicate that with the whole
community.

Cheers


On 5/18/19 8:06 PM, Croitor Alexandru wrote:

Hi,

Point 1: At the official first release of Qt For Python / PySide2 which
was bundled with Qt 5.11, we never provided py27 windows packages. So
officially, we haven't dropped any packages, because they weren't there
in the first place.

Point 2: Packages for py2.7 for PySide2 do not exist not because of py2
EoL, but rather because the official py27 interpreter is built with MSVC
2008, whereas Qt is built with MSVC2015, and we deemed that with the
current PySide2 codebase, it is not safe to mix MSVC runtimes.

This was communicated multiple times, and is mentioned on the wiki as
well. Yet people still insist on bringing it up, disregarding that such
packages are not safe to use.

People are free to try and build Py2.7 + Qt + PySide2 with the same MSVC
version, and use that.

On Sat, May 18, 2019 at 7:03 PM Thiago Macieira
mailto:thiago.macie...@intel.com>> wrote:

 On Friday, 17 May 2019 18:26:11 PDT Bob Hood wrote:
  > On 5/17/2019 2:58 PM, Thiago Macieira wrote:
  > > On Friday, 17 May 2019 10:16:04 PDT Bob Hood wrote:
  > >> They have (prematurely, imo) abandoned the combination of
 Windows +
  > >> Python
  > >> v2.7.  You will only be able to install PySide2 under Windows
 with Python
  > >> v3.x now.
  > >
  > > Less than 7 and a half months of support for Python 2 left,
 until it EOLs,
  > > after a 5 year extension. Everyone has migrated their business
 critical
  > > applications to Python 3 by now, right?
  >
  > Well, to me "7 and a half months...left" is not EOL, and I don't know
  > precisely when Python v2/Windows support was jettisoned, but you
 can add
  > that difference to the duration as well.That's how I personally
 define
  > "prematurely."

 Python2 support was deprecated by the Python community and the
 Python Software
 Foundation many years ago. Its EOL was pushed from Jan 1, 2015 to
 Jan 1, 2020.

 The point is not about Pyside, it's about *Python*. People have had
 over 10
 years to switch from 2.x to 3. With less than 7½ months left, I'm sure
 everyone with critical applications have already switch, right?

 https://pythonclock.org/

  > But the decision is made; I'm not instigating a brush war over
 it.  I'm not
  > invested in PySide2, and neither are my customers. It was just
 going to be a
  > convenience for them as long as we continued to support Python
 v2.  Now it
  > won't.

 I think the point is that it's not worth the resources required to
 build and
 test the Python2 bulld when so few are (supposed to be) still using it.

 --
 Thiago Macieira - thiago.macieira (AT) intel.com 
    Software Architect - Intel System Software Products



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


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




Re: [Interest] [PySide] PySide2 installer for windows?

2019-05-21 Thread Frank Rueter | OHUfx

So one follow up question:
I already have a few machines that have PySide2 installed (I did this 
before the wheel in question disappeared on me).
Is there a sane way to rip an existing install from one machine to put 
it on another?



On 05/21/2019 02:28 PM, Bob Hood wrote:

On 5/20/2019 4:49 PM, Frank Rueter | OHUfx wrote:
I know that, the problem is I work in an industry that has been 
clinging onto Python 2.7 with al their major softwares for way too 
long, it has not been my choice.


As do I, and as do many others.  Python 2.7.x is not simply going to 
disappear with a *POOF* on 1 January.  I personally never get any 
reports from customers regarding bugs in Python 2.7.x; I update to the 
latest patch release simply out of reflex and courtesy.


Since the Python team is planning the last patch release (2.7.18) /on/ 
1 January, this version will be around for some time to come, at least 
a year from now, if not more.  Yes, we should be herding our customers 
into the Python 3 corral, however, due to the massive number of assets 
customers have that represents thousands of man-hours of work, there 
is a need to support Python v2.7.x through the remainder of its life, 
and start conditioning those customers to the finality of it in the 
(somewhat near) future.


Now, as for PySide2, somebody may have already pointed this out, but 
they are not supporting Windows/Python 2.7.x because that version of 
Python is being built (the interpreter build distributed by 
Python.org, that is) using Visual Studio 2008. This is incompatible 
with Qt v5.12.x.  However, Python 2.7.x can be built using VS2017--I 
do it myself with each patch update I provided to my customers--which 
means, if you /really/ want to use PySide2 with Python 2.7.x under 
Windows, you can go to the effort of building all of them yourself 
with the same toolchain, and it will work.  It's just that the 
Python.org team won't update from Visual Studio 2008 so close to EOL, 
and the Qt Company won't (and probably can't in the first place) patch 
Qt 5.12.x to work with Visual Studio 2008. The two will never meet.


--
ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation 
and consulting <http://ohufx.com/index.php/vfx-customising>* *


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


Re: [Interest] [PySide] PySide2 installer for windows?

2019-05-20 Thread Frank Rueter | OHUfx

thanks for the links though!!

On 20/05/19 6:26 PM, Florian Bruhin wrote:

Hi,

On Mon, May 20, 2019 at 12:07:42PM +1200, Frank Rueter | OHUfx wrote:

So the only way out of this is update my code to Python3?

You might want to consider doing that anyways, if you haven't yet.

Python 2 is EOL (including security fixes) in about half a year:
https://pythonclock.org/

Many projects have pledged to drop support for it by then:
https://python3statement.org/

There are various good porting guides available:
https://docs.python.org/3/howto/pyporting.html
http://python3porting.com/
https://portingguide.readthedocs.io/

Florian



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


Re: [Interest] [PySide] PySide2 installer for windows?

2019-05-20 Thread Frank Rueter | OHUfx
I know that, the problem is I work in an industry that has been clinging 
onto Python 2.7 with al their major softwares for way too long, it has 
not been my choice.


On 20/05/19 6:26 PM, Florian Bruhin wrote:

Hi,

On Mon, May 20, 2019 at 12:07:42PM +1200, Frank Rueter | OHUfx wrote:

So the only way out of this is update my code to Python3?

You might want to consider doing that anyways, if you haven't yet.

Python 2 is EOL (including security fixes) in about half a year:
https://pythonclock.org/

Many projects have pledged to drop support for it by then:
https://python3statement.org/

There are various good porting guides available:
https://docs.python.org/3/howto/pyporting.html
http://python3porting.com/
https://portingguide.readthedocs.io/

Florian



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


Re: [Interest] [PySide] PySide2 installer for windows?

2019-05-19 Thread Frank Rueter | OHUfx

Yes, that is exactly what I'm trying to do.
So the only way out of this is update my code to Python3?


On 05/17/2019 05:35 PM, Jordan Hueckstaedt wrote:
I had a similar error a few weeks ago. Are you by any chance trying to 
install PySide2 on python 2.7 on Windows? I found out the hard way 
that that particular combo is no no longer supported.


On Thu, May 16, 2019 at 10:21 PM Fredrik Averpil > wrote:


How about just running

|pip install pyside2|

?
___
PySide mailing list
pys...@qt-project.org 
https://lists.qt-project.org/listinfo/pyside



--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


[Interest] PySide2 installer for windows?

2019-05-16 Thread Frank Rueter | OHUfx

Hi all,

we are trying to install PySide2 on Windows 10.
We tried installers from here
http://download.qt.io/snapshots/ci/pyside/5.9/latest/pyside2/
and here
http://download.qt.io/snapshots/ci/pyside/5.12/latest/pyside2/

But neither seem to work.
I remember just running a pip install last December:
pip install -v 
--index-url=http://download.qt.io/snapshots/ci/pyside/5.9/latest/ 
pyside2 --trusted-host download.qt.io


But that does not find any installer anymore either.
So I tried this:
pip install -v 
--index-url=http://download.qt.io/snapshots/ci/pyside/5.12/latest/ 
pyside2 --trusted-host download.qt.io


and just got an error:

ERROR: Could not find a version that satisfies the requirement pyside2 
(from versions: none)

Cleaning up...
Removed build tracker 
'c:\\users\\render\\appdata\\local\\temp\\pip-req-tracker-mjz7ju'

ERROR: No matching distribution found for pyside2


What am I missing?

Cheers,
frank

--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] QWizard - can't register a field with a custom property

2019-03-20 Thread Frank Rueter | OHUfx
I now have the same issue with trying to register a QTextEdit widget's 
content:


|self.registerField('message', self.notes_widget.messageWidget, 
'toPlainText', 'notes_widget.messageWidget.textChanged') |


Once again my sanity check with manual signal/slot connections works fine:

|self.notes_widget.messageWidget.textChanged.connect(self.test) def 
test(self): print self.notes_widget.messageWidget.toPlainText() |


What am I missing?

Cheers,
frank

On 20/03/19 10:08 AM, Frank Rueter | OHUfx wrote:


Hi all,

In a QWizard page I am trying to register a field with a widget’s 
custom property to supply the desired field value but I can’t get it 
to work.
This is the line I am using to register the field and to link it to 
the signal that informs the field to update it’s value:


|self.registerField('to_list', self.notes_widget.to_list_widget, 
'get_all_data', 'notes_widget.to_list_widget.current_data_changed') |


When I query the field later via self.field(;to_list’) I just get None.

As a sanity check I hooked up the signal to a test slot like this:

|self.notes_widget.to_list_widget.current_data_changed.connect(self.test) 
test(self): print 'to test:', 
self.notes_widget.to_list_widget.get_all_data() |


The latter works just fine.
Can anybody spot what I’m doing wrong?

Cheers,
frank

​
--

ohufxLogo 50x50 <http://www.ohufx.com>
	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
customisation and consulting <http://ohufx.com/customising.html>* *

*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke 
<http://www.nukepedia.com/nubridge>



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


​
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [PySide] QListView - make tab key behave like enter key

2019-03-19 Thread Frank Rueter | OHUfx

well, for those who run into the same issue:
The key was to override the view's closeEditor event, check for the 
incoming hint (QAbstractItemDelegate.NoHint when the tab key is pressed) 
and fire off QListView.closeEditor(self, editor, 
QtWidgets.QAbstractItemDelegate.SubmitModelCache) manually.


On 19/03/19 6:35 PM, Frank Rueter | OHUfx wrote:


Hi all,

I have a simple QListView in which I would like to edit items by 
clicking into empty space, typing, then hitting either enter or tab.
I’d like the tab Key_Tab event to behave exactly like Key_Enter event, 
but it’s a bit stubborn.
When I hit tab while editing an item (i.e. editor is open), the first 
item in the list is selected.


I noticed that when hitting the tab key in an open editor only a 
QtCore.QEvent.ShortcutOverride is triggered.
It looks like I can simply react to that in my situation though I’m 
not sure if that is wise?!
If I do, how would I manually emit an event that looks like a 
Key_Enter event?


Otherwise, how can I avoid above behaviour for the tab key and make it 
behave like a regular key (I assume it’s trying to change focus in the 
focus chain but don’t know how to make it stop)?


Here is some example code to show my problem.

Cheers,
frank

|class AddresseeDelegate(QtWidgets.QItemDelegate): is_valid = 
QtCore.Signal() is_not_valid = QtCore.Signal(QtCore.QModelIndex) def 
__init__(self, users=[], groups=[], parent=None): 
super(AddresseeDelegate, self).__init__(parent) self.valid_item_texts 
= [u['name'] for u in users] + [g['code'] for g in groups] def 
createEditor(self, parent, option, index): self.editor = 
QtWidgets.QLineEdit(parent) self.editor.setMinimumWidth(100) completer 
= QtWidgets.QCompleter(self.valid_item_texts) 
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) 
completer.setCompletionMode(QtWidgets.QCompleter.InlineCompletion) 
self.editor.setCompleter(completer) 
self.editor.editingFinished.connect(lambda: self.validate_text(index)) 
return self.editor def setModelData(self, editor, model, index): 
model.setData(index, editor.text()) def validate_text(self, 
index=None): if self.editor.text() in self.valid_item_texts: # valid 
input self.commitData.emit(self.editor) 
self.closeEditor.emit(self.editor) self.is_valid.emit() else: # 
invalid input self.closeEditor.emit(self.editor) 
self.is_not_valid.emit(index) class 
AddresseeListView(QtWidgets.QListView): def __init__(self, users=[], 
groups=[], parent=None): '''Simple addressee widget.''' 
super(AddresseeListView, self).__init__(parent) 
self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 
self.setFlow(QtWidgets.QListView.LeftToRight) 
self.setResizeMode(QtWidgets.QListView.ResizeMode.Adjust) 
self.setSpacing(10) self.setViewMode(QtWidgets.QListView.IconMode) 
#self.setWrapping(True) # delegate delegate = AddresseeDelegate(users, 
groups) self.setItemDelegate(delegate) 
delegate.is_not_valid.connect(self.delete_invalid_index) # model model 
= QtGui.QStandardItemModel() #model = Model() self.setModel(model) def 
event(self, event): if event.type() == QtCore.QEvent.ShortcutOverride: 
# need to emit a Key_Enter event here event.accept() return 
super(AddresseeListView, self).event(event) def mousePressEvent(self, 
event): self.add_and_edit() def add_and_edit(self): '''Add a new row 
and open editor''' print 'adding row' new_item = 
QtGui.QStandardItem('') self.model().appendRow(new_item) 
self.edit(self.model().indexFromItem(new_item)) def 
delete_invalid_index(self, index): '''Remove invalid entry''' 
self.model().removeRow(index.row()) if __name__ == '__main__': app = 
QtWidgets.QApplication(sys.argv) users = [{'name':'aa'}, 
{'name':'bb'}] groups = [{'code':'cc'}, {'code':'dd'}] w = 
AddresseeListView(users, groups) w.show() w.raise_() app.exec_() |

​
--

ohufxLogo 50x50 <http://www.ohufx.com>
	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
customisation and consulting <http://ohufx.com/customising.html>* *

*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke 
<http://www.nukepedia.com/nubridge>



___
PySide mailing list
pys...@qt-project.org
https://lists.qt-project.org/listinfo/pyside


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


[Interest] QWizard - can't register a field with a custom property

2019-03-19 Thread Frank Rueter | OHUfx

Hi all,

In a QWizard page I am trying to register a field with a widget’s custom 
property to supply the desired field value but I can’t get it to work.
This is the line I am using to register the field and to link it to the 
signal that informs the field to update it’s value:


|self.registerField('to_list', self.notes_widget.to_list_widget, 
'get_all_data', 'notes_widget.to_list_widget.current_data_changed') |


When I query the field later via self.field(;to_list’) I just get None.

As a sanity check I hooked up the signal to a test slot like this:

|self.notes_widget.to_list_widget.current_data_changed.connect(self.test) 
test(self): print 'to test:', 
self.notes_widget.to_list_widget.get_all_data() |


The latter works just fine.
Can anybody spot what I’m doing wrong?

Cheers,
frank

​
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


[Interest] QListView - make tab key behave like enter key

2019-03-18 Thread Frank Rueter | OHUfx

Hi all,

I have a simple QListView in which I would like to edit items by 
clicking into empty space, typing, then hitting either enter or tab.
I’d like the tab Key_Tab event to behave exactly like Key_Enter event, 
but it’s a bit stubborn.
When I hit tab while editing an item (i.e. editor is open), the first 
item in the list is selected.


I noticed that when hitting the tab key in an open editor only a 
QtCore.QEvent.ShortcutOverride is triggered.
It looks like I can simply react to that in my situation though I’m not 
sure if that is wise?!
If I do, how would I manually emit an event that looks like a Key_Enter 
event?


Otherwise, how can I avoid above behaviour for the tab key and make it 
behave like a regular key (I assume it’s trying to change focus in the 
focus chain but don’t know how to make it stop)?


Here is some example code to show my problem.

Cheers,
frank

|class AddresseeDelegate(QtWidgets.QItemDelegate): is_valid = 
QtCore.Signal() is_not_valid = QtCore.Signal(QtCore.QModelIndex) def 
__init__(self, users=[], groups=[], parent=None): 
super(AddresseeDelegate, self).__init__(parent) self.valid_item_texts = 
[u['name'] for u in users] + [g['code'] for g in groups] def 
createEditor(self, parent, option, index): self.editor = 
QtWidgets.QLineEdit(parent) self.editor.setMinimumWidth(100) completer = 
QtWidgets.QCompleter(self.valid_item_texts) 
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) 
completer.setCompletionMode(QtWidgets.QCompleter.InlineCompletion) 
self.editor.setCompleter(completer) 
self.editor.editingFinished.connect(lambda: self.validate_text(index)) 
return self.editor def setModelData(self, editor, model, index): 
model.setData(index, editor.text()) def validate_text(self, index=None): 
if self.editor.text() in self.valid_item_texts: # valid input 
self.commitData.emit(self.editor) self.closeEditor.emit(self.editor) 
self.is_valid.emit() else: # invalid input 
self.closeEditor.emit(self.editor) self.is_not_valid.emit(index) class 
AddresseeListView(QtWidgets.QListView): def __init__(self, users=[], 
groups=[], parent=None): '''Simple addressee widget.''' 
super(AddresseeListView, self).__init__(parent) 
self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 
self.setFlow(QtWidgets.QListView.LeftToRight) 
self.setResizeMode(QtWidgets.QListView.ResizeMode.Adjust) 
self.setSpacing(10) self.setViewMode(QtWidgets.QListView.IconMode) 
#self.setWrapping(True) # delegate delegate = AddresseeDelegate(users, 
groups) self.setItemDelegate(delegate) 
delegate.is_not_valid.connect(self.delete_invalid_index) # model model = 
QtGui.QStandardItemModel() #model = Model() self.setModel(model) def 
event(self, event): if event.type() == QtCore.QEvent.ShortcutOverride: # 
need to emit a Key_Enter event here event.accept() return 
super(AddresseeListView, self).event(event) def mousePressEvent(self, 
event): self.add_and_edit() def add_and_edit(self): '''Add a new row and 
open editor''' print 'adding row' new_item = QtGui.QStandardItem('') 
self.model().appendRow(new_item) 
self.edit(self.model().indexFromItem(new_item)) def 
delete_invalid_index(self, index): '''Remove invalid entry''' 
self.model().removeRow(index.row()) if __name__ == '__main__': app = 
QtWidgets.QApplication(sys.argv) users = [{'name':'aa'}, {'name':'bb'}] 
groups = [{'code':'cc'}, {'code':'dd'}] w = AddresseeListView(users, 
groups) w.show() w.raise_() app.exec_() |


​
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] QComboBox - rect of actual menu vs widget area

2019-01-17 Thread Frank Rueter | OHUfx

but back to the original question:
How would I get the correct height for the dark grey box below to only 
be visible inside the menu area?

Maybe I can simply mask it through the menu area somehow?


On 9/01/19 1:22 AM, Roland Hughes wrote:


On 1/8/2019 4:00 AM, Matthew Woehlke wrote:

On 29/12/2018 07.54, Roland Hughes wrote:

Method 1: show/hide interesting widget

Place a label with the animated GIF at the exact same spot as the combo
box.
An*animated GIF*? Ugh. No anti-aliasing, won't follow the color 
scheme...


A better option would be to use a "busy indicator" widget. For example,
https://github.com/Kitware/qtextensions/blob/master/widgets/qtThrobber.cpp. 


(Too bad there isn't one in Qt proper :'(.)
It was the short answer based on the assumption only one field was 
"busy".  Yes, I've created a custom widget with a timer and set number 
of images for a spinning bar and used that as well for a single field 
"busy".




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


Re: [Interest] QComboBox - rect of actual menu vs widget area

2019-01-07 Thread Frank Rueter | OHUfx

Thanks, will check it out and try to transfer to PySide2

On 8/01/19 9:43 AM, Matthew Woehlke wrote:

On 29/12/2018 07.54, Roland Hughes wrote:

Method 1: show/hide interesting widget

Place a label with the animated GIF at the exact same spot as the combo
box.

An *animated GIF*? Ugh. No anti-aliasing, won't follow the color scheme...

A better option would be to use a "busy indicator" widget. For example,
https://github.com/Kitware/qtextensions/blob/master/widgets/qtThrobber.cpp.
(Too bad there isn't one in Qt proper :'(.)



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


Re: [Interest] QComboBox - rect of actual menu vs widget area

2019-01-07 Thread Frank Rueter | OHUfx

Thanks.
I am not sure I agree with your dislike of overriding the paint method.
I have actually had to do this a lot for custom UIs an in some cases 
even did it to make widgets more efficient.


I do agree that I prefer not to in cases like this though, so thanks for 
your suggestions.


Cheers,
frank

On 30/12/18 1:54 AM, Roland Hughes wrote:


On 12/29/2018 4:00 AM, Frank Rueter wrote:

I am trying to draw a simple busy indicator into a QCombobox while it's
being populated with items.


Here are two thoughts which aren't direct answers but also don't 
involve the ugliness of overriding a paint method. We really shouldn't 
override paint methods. Both methods involve an animated GIF inside of 
a label. You can look at some code for this here: 
http://www.logikalsolutions.com/wordpress/information-technology/qt-and-usb-pt-2-2/


Method 1: show/hide interesting widget

Place a label with the animated GIF at the exact same spot as the 
combo box.


Hide the comboBox and show the label during your load then reverse the 
process when load is complete.


Method 2: show/hide busy indicator only

Place a label with the animated GIF in the exact spot you want the GIF 
to appear. Label will need to be without border or background unless 
perfectly sized for GIF.


Show the label and disable mouse events for ComboBox then hide the 
label when complete and re-enable mouse events on the comboBox



Toggling visible for mouse events can be a pain. It is easy to forget 
to turn them back on so I tend to use method 1. A cheat for method 2 
is to add a label without border or background in the same size and 
location as the comboBox. Slap it over the comboBox before the label 
with the animated GIF appears. This has the effect of "hiding" the 
comboBox from the mouse when it has nothing in it.


A purist will demand using a separate UI file, creating a custom 
widget which contains the comboBox and label with animated GIF. This 
hides all of the logic for loading the comboBox and displaying the 
busy indicator. You just place the widget on some other UI file and 
have your program call loadData().


The widget then becomes responsible for loading the data and 
displaying of the busy indicator. For a very tiny application this is 
overkill. For something large this is well and good. The decision gets 
a bit iffier when the data is coming from a database because the 
main/parent application is the one keeping track of the connection 
name as well as the actual file name (for SQLite and other 
non-database databases). Custom widgets needing such things have to 
have methods which pass such things in. Done poorly this can really 
complicate construction.


Rule of thumb:

When one finds themselves saying "override the paint method" it is 
time to step back and contemplate where their design failed. As soon 
as we override the paint method we steal from ourselves any 
optimizations and enhancements the existing widget paint method 
provided under the hood. Microsoft conditioned a generation or so of 
developers to override the paint method for everything on their failed 
Windows platform. Now there should be little mystery as to why their 
license agreement includes the phrase:


"not for use in medical devices"




--
Roland Hughes, President
Logikal Solutions
(630)-205-1593  (cell)
http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com

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


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


[Interest] QComboBox - rect of actual menu vs widget area

2018-12-28 Thread Frank Rueter | OHUfx

Hi,

I am trying to draw a simple busy indicator into a QCombobox while it's 
being populated with items.
I thought I'd use with a custom paint event that checks is a certain 
condition is true, and if so it will draw custom stuff in to the menu, 
otherwise it just does it's default thing and draw the items as usual.
Here is the basic functional code (to have a QComboBox with integrated 
buy bar):


class TaskWidget(QtWidgets.QComboBox):
    """combo box with simple bar animation to indicate that the items 
are not ready yet"""


    def __init__(self, parent=None):
    super(TaskWidget, self).__init__(parent)
    self.counter = 0
    self.position = 0
    self.indicator_width = 20
    self.finished = False
    self.start_anim()

    def start_anim(self):
    self.timer_id = self.startTimer(50)

    def stop_anim(self):
    self.finished = not self.finished
    self.killTimer(self.timer_id)

    def timerEvent(self, event):
    if not self.finished:
    self.counter += .2
    self.position = ((math.sin(self.counter) + 1) * .5) * 
(self.width() - self.indicator_width)

    self.update()

    def paintEvent(self, event):
    super(TaskWidget, self).paintEvent(event)
    painter = QtGui.QPainter()
    painter.begin(self)
    indicator = QtCore.QRect(self.position,0,self.indicator_width, 
event.rect().height())

    painter.fillRect(indicator, QtCore.Qt.gray)
    painter.end()

which yields this:

How do I get the (rounded) rectangle of the menu itself though? I.e. I 
only want to draw the red bar inside the menu area that will show the items.


I guess I should try to query the item view's rect via it's item 
delegate or something, but I can't get it right.

Any help would be appreciated.


Cheers,
frank
___
PySide mailing list
pys...@qt-project.org
https://lists.qt-project.org/listinfo/pyside
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] efficient natural sorting

2018-11-15 Thread Frank Rueter | OHUfx
I never have a' Original number" as the strings come from file names and 
another app.

QCollator is the ticket.

Cheers,
frank

On 15/11/18 4:14 AM, Shawn Rutledge wrote:

On 14 Nov 2018, at 03:28, Frank Rueter | OHUfx  wrote:

Hi,

I need to use the QSortFilterProxyModel to sort strings with numbers in them, 
i.e. perform natural sorting.

Another idea is to add a different role to your model, have data() return the 
original number (int or qreal or whatever) in the variant for that role, and 
call setSortRole() to tell QSFPM which role to use.

___
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] efficient natural sorting

2018-11-15 Thread Frank Rueter | OHUfx

Ha, QCollator is the perfect solution, thank you!
I was not aware of that one.

Cheers,
frank

On 15/11/18 3:57 AM, Giuseppe D'Angelo via Interest wrote:

Hi,

Il 14/11/18 03:28, Frank Rueter | OHUfx ha scritto:
This works nicely but I’m wondering if it’s reliable and efficient to 
implement it like this in the QSortFilterProxyModel.lessThan() method?!


|def lessThan(self, source_left, source_right): 
natural_keys(source_left) < natural_keys(source_right) |


Any thoughts on this?


You can use QCollator to implement natural sorting (by enabling the 
numeric mode). Or doesn't it work for your use case?


My 2 c,


___
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] efficient natural sorting

2018-11-13 Thread Frank Rueter | OHUfx

Hi,

I need to use the QSortFilterProxyModel to sort strings with numbers in 
them, i.e. perform natural sorting.

I found this snippet online:

|import re def atoi(text): return int(text) if text.isdigit() else text 
def natural_keys(text): return [atoi(c) for c in re.split('(\d+)', 
text)] l = ['Item1', 'Item2', 'Item3', 'Item10', 'Item20'] 
l.sort(key=natural_keys) print l |


This works nicely but I’m wondering if it’s reliable and efficient to 
implement it like this in the QSortFilterProxyModel.lessThan() method?!


|def lessThan(self, source_left, source_right): natural_keys(source_left) 
< natural_keys(source_right) |


Any thoughts on this?

Note: I need to avoid 3rd party libraries.

Cheers,
frank

​
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] error when trying to emit custom object via QObject.Signal

2018-08-27 Thread Frank Rueter | OHUfx

Thanks Jerome,

it looks like simply declaring "object" as the signal type makes it work.
Not sure if this is one of those things that PySide just makes easier, 
which might be the reason why I haven't found any info or examples on 
how to "register on meta type" with it.

I'm curious about this but need to press on with a delivery.

Thanks for your answer, I will try and get into the docs for QMetaObject 
some more later to see if there is a better way to handle my case.


Cheers,
frank

On 28/08/18 1:06 AM, Jérôme Godbout wrote:
You will probably need to have the object declared to the meta type 
(sorry I don't known the call, but there must be one into PySide 2, 
you might want to dig into the doc near this 
https://doc.qt.io/qtforpython/PySide2/QtCore/QMetaObject.html ) and 
ideally be copiable since you will send the signal from another thread 
(from your QRunnable). So the signal will probably be queued adn 
therefore will need to copy the arguments to the signals.


On Mon, 27 Aug 2018 at 05:14, Frank Rueter | OHUfx <mailto:fr...@ohufx.com>> wrote:


Hi all,

I am trying to emit a custom object via QObject.Signal from inside
a QRunnable.
The object I am trying to emit throws this error:

TypeError: Value types used on meta functions (including
signals) need to be registered on meta type:
/NameSpace:://NameSpace/::Clip

I tried to trick it by creating a wrapper class like so

|class NodeItem(QtCore.QObject): def __init__(self, node, clip):
QtCore.QObject.__init__(self) self.node = node self.clip = clip |

But that crashes the app when I try to emit it from a QRunnable,
even though it works i the main thread.

I have tried to find information on how to register meta types but
cn only find C++ info about Q_DECLARE_METATYPE.
This does not seem to exist in Python land though?!

Does anybody have any ideas? I’m kinda stuck with this one.

Cheers,
frank

​
-- 


ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>

___
Interest mailing list
Interest@qt-project.org <mailto: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] error when trying to emit custom object via QObject.Signal

2018-08-27 Thread Frank Rueter | OHUfx

Hi all,

I am trying to emit a custom object via QObject.Signal from inside a 
QRunnable.

The object I am trying to emit throws this error:

   TypeError: Value types used on meta functions (including signals)
   need to be registered on meta type: /NameSpace:://NameSpace/::Clip

I tried to trick it by creating a wrapper class like so

|class NodeItem(QtCore.QObject): def __init__(self, node, clip): 
QtCore.QObject.__init__(self) self.node = node self.clip = clip |


But that crashes the app when I try to emit it from a QRunnable, even 
though it works i the main thread.


I have tried to find information on how to register meta types but cn 
only find C++ info about Q_DECLARE_METATYPE.

This does not seem to exist in Python land though?!

Does anybody have any ideas? I’m kinda stuck with this one.

Cheers,
frank

​
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] crash when using multiple setSectionResizeMode() calls in QTableView

2018-08-15 Thread Frank Rueter | OHUfx

Ha, you are a star! I will try that first thing in the morning!

Thanks!
frank

On 15/08/18 9:30 PM, Marian Beermann wrote:

Hi Frank,

I didn't spot it earlier, but now I saw it. You're manipulating
QHeaderView's sections before setting the model on the view. Most things
you can do with a QHeaderView require a model to be present.

If you move these calls to after a model has been set, everything works.

https://gist.github.com/enkore/727e3f912c8f9380017fb78591f2a05e

-Marian

On 8/15/18 2:34 AM, Frank Rueter | OHUfx wrote:

Hi,

I isolated the problem into a small snippet:
https://gitlab.com/snippets/1744780

This still crashes for me.

I do get the result I’m after by only setting one resize mode, i.e.:

|header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed) |

However, what I’m really after is the behaviour of

|header.setStretchLastSection(True) |

but I need the second last section to stretch while the last one remains
a fixes size.
Is there a way to do this or do I have to write my own header view for that?

Cheers,
frank

On 14/08/18 12:17 PM, Frank Rueter | OHUfx wrote:


Thanks for testing Marian, much appreciated!
Interesting it won't crash for you. I will try it in a different IDE
(using WingIDE normally) and a different machine in case there is
something wrong with my install.

Cheers,
frank

On 13/08/18 10:10 PM, Marian Beermann wrote:

I tried your setSectionResizeMode snippet on a table model
whose headerData() is the same as yours and it doesn't cause a crash for
me. I don't think the other roles are required (at least to not have a
crash).

On 13.08.2018 11:30, Frank Rueter | OHUfx wrote:

Thanks. My header data simply looks like this:

|def headerData(self, section, orientation, role): if orientation ==
QtCore.Qt.Horizontal: if role == QtCore.Qt.DisplayRole: return
self.header_labels[section] |

where: self.header_labels just contains a list of strings.

I guess I need to implement size hint roles?! I will try that tomorrow.

Tanks for the tip!

Cheers,
frank



Must be something in your code; I'd start by double-checking
everything
related to the header data in your model.

-Marian

On 13.08.2018 05:17, Frank Rueter | OHUfx wrote:

Hi all,

using PySide2 I am trying to set different resize modes for each
of my
columns in a table view, but as soon as I set more than one I get
a crash.

Here is what I do:

|class MyView(QtWidgets.QTableView): def __init__(self, parent=None):
super(MyView, self).__init__(parent) header = self.horizontalHeader()
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive) |

Is this a bug or am I doing something wrong?

Cheers,
frank

​

--

ohufxLogo 50x50 <http://www.ohufx.com>
 *vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
      *<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>
 


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>



___
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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] crash when using multiple setSectionResizeMode() calls in QTableView

2018-08-14 Thread Frank Rueter | OHUfx

Hi,

I isolated the problem into a small snippet:
https://gitlab.com/snippets/1744780

This still crashes for me.

I do get the result I’m after by only setting one resize mode, i.e.:

|header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed) |

However, what I’m really after is the behaviour of

|header.setStretchLastSection(True) |

but I need the second last section to stretch while the last one remains 
a fixes size.

Is there a way to do this or do I have to write my own header view for that?

Cheers,
frank

On 14/08/18 12:17 PM, Frank Rueter | OHUfx wrote:


Thanks for testing Marian, much appreciated!
Interesting it won't crash for you. I will try it in a different IDE 
(using WingIDE normally) and a different machine in case there is 
something wrong with my install.


Cheers,
frank

On 13/08/18 10:10 PM, Marian Beermann wrote:

I tried your setSectionResizeMode snippet on a table model
whose headerData() is the same as yours and it doesn't cause a crash for
me. I don't think the other roles are required (at least to not have a
crash).

On 13.08.2018 11:30, Frank Rueter | OHUfx wrote:

Thanks. My header data simply looks like this:

|def headerData(self, section, orientation, role): if orientation ==
QtCore.Qt.Horizontal: if role == QtCore.Qt.DisplayRole: return
self.header_labels[section] |

where: self.header_labels just contains a list of strings.

I guess I need to implement size hint roles?! I will try that tomorrow.

Tanks for the tip!

Cheers,
frank


Must be something in your code; I'd start by double-checking 
everything

related to the header data in your model.

-Marian

On 13.08.2018 05:17, Frank Rueter | OHUfx wrote:

Hi all,

using PySide2 I am trying to set different resize modes for each 
of my
columns in a table view, but as soon as I set more than one I get 
a crash.


Here is what I do:

|class MyView(QtWidgets.QTableView): def __init__(self, parent=None):
super(MyView, self).__init__(parent) header = self.horizontalHeader()
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive) |

Is this a bug or am I doing something wrong?

Cheers,
frank

​

--

ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>



___
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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] crash when using multiple setSectionResizeMode() calls in QTableView

2018-08-13 Thread Frank Rueter | OHUfx

Thanks for testing Marian, much appreciated!
Interesting it won't crash for you. I will try it in a different IDE 
(using WingIDE normally) and a different machine in case there is 
something wrong with my install.


Cheers,
frank

On 13/08/18 10:10 PM, Marian Beermann wrote:

I tried your setSectionResizeMode snippet on a table model
whose headerData() is the same as yours and it doesn't cause a crash for
me. I don't think the other roles are required (at least to not have a
crash).

On 13.08.2018 11:30, Frank Rueter | OHUfx wrote:

Thanks. My header data simply looks like this:

|def headerData(self, section, orientation, role): if orientation ==
QtCore.Qt.Horizontal: if role == QtCore.Qt.DisplayRole: return
self.header_labels[section] |

where: self.header_labels just contains a list of strings.

I guess I need to implement size hint roles?! I will try that tomorrow.

Tanks for the tip!

Cheers,
frank



Must be something in your code; I'd start by double-checking everything
related to the header data in your model.

-Marian

On 13.08.2018 05:17, Frank Rueter | OHUfx wrote:

Hi all,

using PySide2 I am trying to set different resize modes for each of my
columns in a table view, but as soon as I set more than one I get a crash.

Here is what I do:

|class MyView(QtWidgets.QTableView): def __init__(self, parent=None):
super(MyView, self).__init__(parent) header = self.horizontalHeader()
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive) |

Is this a bug or am I doing something wrong?

Cheers,
frank

​

--

ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
        *<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>



___
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] crash when using multiple setSectionResizeMode() calls in QTableView

2018-08-13 Thread Frank Rueter | OHUfx

Thanks. My header data simply looks like this:

|def headerData(self, section, orientation, role): if orientation == 
QtCore.Qt.Horizontal: if role == QtCore.Qt.DisplayRole: return 
self.header_labels[section] |


where: self.header_labels just contains a list of strings.

I guess I need to implement size hint roles?! I will try that tomorrow.

Tanks for the tip!

Cheers,
frank



Must be something in your code; I'd start by double-checking everything
related to the header data in your model.

-Marian

On 13.08.2018 05:17, Frank Rueter | OHUfx wrote:

Hi all,

using PySide2 I am trying to set different resize modes for each of my
columns in a table view, but as soon as I set more than one I get a crash.

Here is what I do:

|class MyView(QtWidgets.QTableView): def __init__(self, parent=None):
super(MyView, self).__init__(parent) header = self.horizontalHeader()
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive) |

Is this a bug or am I doing something wrong?

Cheers,
frank

​

--

ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
        *<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>



___
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] crash when using multiple setSectionResizeMode() calls in QTableView

2018-08-12 Thread Frank Rueter | OHUfx

Hi all,

using PySide2 I am trying to set different resize modes for each of my 
columns in a table view, but as soon as I set more than one I get a crash.


Here is what I do:

|class MyView(QtWidgets.QTableView): def __init__(self, parent=None): 
super(MyView, self).__init__(parent) header = self.horizontalHeader() 
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Fixed) 
header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive) |


Is this a bug or am I doing something wrong?

Cheers,
frank

​

--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] get application's resources

2018-08-10 Thread Frank Rueter | OHUfx

Ah, nice one, thanks!
I also just stumbled over this which seems to work as well:

|QtCore.QResource(':qrc/images').children() |

Two arrows in the quiver now, sweet.

Thanks again,
frank


On 10/08/18 3:27 PM, Reinhardt Behm via Interest wrote:


QDir is your friend.

QDir dir(":/", "*");
qDebug() << dir.dirName() << dir.entryList();


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


[Interest] get application's resources

2018-08-09 Thread Frank Rueter | OHUfx

Hi,

in my host application I can use the existing application resources for 
things like icons etc like this:

    QtGui.QIcon(':qrc/images/some_image.png')

Is it possible to get a list of everything in the application resources 
to see what other images are available, i.e. everything under ":qrc/"?


Thanks,
frank


--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] problems with drag event in QListView with delegate in edit mode

2018-08-08 Thread Frank Rueter | OHUfx
Same issue with the context menu. I have to right lick twice before it 
opens.
I have been trying to set focus and various states on the view but still 
can't get it right.

Any help would be very much appreciated.

Cheers,
frank

On 8/08/18 8:58 PM, Frank Rueter | OHUfx wrote:


Hi all,

I have QListView with an item delegate that is animated when the mouse 
overs over it.
This is done via a delegate using a custom widget and popping the 
index under the cursor into edit mode like so:


|def mouseMoveEvent(self, event): if index.isValid(): # start playing 
playing under cursor self.edit(index) |


This works fine and I have a mechanism for closing the editor as well 
to ensure only one item is ever playing as the mouse moves around the 
list view.
The issue now is that the custom drag behaviour has suffered - 
but only under windows and linux, it works fine on OSX.


In order to close the editor when the left mouse button is clicked I 
do this in the QListView’s mousePressEvent():


|def mousePressEvent(self, event): if self.currentEditor: try: # clean 
up open editor self.currentEditor.setFocusPolicy(QtCore.Qt.NoFocus) 
self.closeEditor(self.currentEditor, 
QtGui.QAbstractItemDelegate.NoHint) 
self.commitData(self.currentEditor) self.setFocus() except 
RuntimeError: # no current editor. click happened outside the 
thumbnails pass super(ElementView, self).mousePressEvent(event) |


On OSX, this enables the QListView’s default drag behaviour when 
I click and drag one of the items.
On windows however I need to click twice and only on the second click 
the drag event kicks in.


If I comment out the above self.edit(index), drag works fine on 
all platforms, but of course I’m not getting the animation.

I also tried using persistent editors to no avail (same result).

Does anybody have an idea what I need to do to make this work ion 
windows as well?
I have been trying to figure this out for hours now and am getting 
nowhere.


Cheers,
frank

​
--

ohufxLogo 50x50 <http://www.ohufx.com>
	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
customisation and consulting <http://ohufx.com/customising.html>* *

*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke 
<http://www.nukepedia.com/nubridge>




___
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] problems with drag event in QListView with delegate in edit mode

2018-08-08 Thread Frank Rueter | OHUfx

Hi all,

I have QListView with an item delegate that is animated when the mouse 
overs over it.
This is done via a delegate using a custom widget and popping the index 
under the cursor into edit mode like so:


|def mouseMoveEvent(self, event): if index.isValid(): # start playing 
playing under cursor self.edit(index) |


This works fine and I have a mechanism for closing the editor as well to 
ensure only one item is ever playing as the mouse moves around the list 
view.
The issue now is that the custom drag behaviour has suffered - but 
only under windows and linux, it works fine on OSX.


In order to close the editor when the left mouse button is clicked I do 
this in the QListView’s mousePressEvent():


|def mousePressEvent(self, event): if self.currentEditor: try: # clean up 
open editor self.currentEditor.setFocusPolicy(QtCore.Qt.NoFocus) 
self.closeEditor(self.currentEditor, QtGui.QAbstractItemDelegate.NoHint) 
self.commitData(self.currentEditor) self.setFocus() except RuntimeError: 
# no current editor. click happened outside the thumbnails pass 
super(ElementView, self).mousePressEvent(event) |


On OSX, this enables the QListView’s default drag behaviour when I 
click and drag one of the items.
On windows however I need to click twice and only on the second click 
the drag event kicks in.


If I comment out the above self.edit(index), drag works fine on all 
platforms, but of course I’m not getting the animation.

I also tried using persistent editors to no avail (same result).

Does anybody have an idea what I need to do to make this work ion 
windows as well?

I have been trying to figure this out for hours now and am getting nowhere.

Cheers,
frank

​
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] QListView with delegate: support drag outside of QApplication

2018-08-04 Thread Frank Rueter | OHUfx

For posterity, this is the solution:

|import sys from PySide import QtGui, QtCore class 
MyModel(QtGui.QStandardItemModel): def __init__(self, w, parent=None): 
super(MyModel, self).__init__(parent) def mimeData(self, indexes): 
mimeData = super(MyModel, self).mimeData(indexes) 
mimeData.setText('test') return mimeData class MyList(QtGui.QListView): 
def __init__(self, parent=None): super(MyList, self).__init__(parent) 
self.setDragEnabled(True) self.setAcceptDrops(True) if __name__ == 
'__main__': app = QtGui.QApplication(sys.argv) list1 = MyList() list2 = 
MyList() model1 = MyModel(list1) model2 = MyModel(list1) 
model2.setItemPrototype(QtGui.QStandardItem()) foods = [ 'Cookie dough', 
'Hummus', 'Spaghetti', 'Dal makhani', 'Chocolate whipped cream' ] for 
food in foods: item = QtGui.QStandardItem(food) model1.appendRow(item) 
list1.setModel(model1) list2.setModel(model2) w = QtGui.QSplitter() 
w.addWidget(list1) w.addWidget(list2) w.show() w.raise_() app.exec_() |


On 31/07/18 9:13 PM, Frank Rueter | OHUfx wrote:


Anybody?
Been trying to play with the view's dragMoveEvent to take over the 
default drag event's mime data and create a custom QDrag instance with 
it, but that crashes. I also tried just adding test to the event's 
mime data, but that  has no effect.

Maybe I do need to just re-implement the drag from scratch?

It feels like there should be a more elegant solution, right?!

Cheers,
frank

On 30/07/18 3:24 PM, Frank Rueter | OHUfx wrote:


Hi all,

I have an app that uses two QListViews with delegates.
The user can drag ad drop items from one view into the other to 
create something like a shopping list.

So far so good.
Now I need to enable the user to also drag an item out of the 
application entirely.
Is it possible to access the drag event data that the list view 
produces by default, so I don’t have to re-invent the wheel for the 
already functioning internal drag?


Here is a simplified example that just needs support for dragging an 
item outside of the QApplication.


Any tips would be much appreciated.

Cheers,
frank

|import sys from PySide import QtGui, QtCore app = 
QtGui.QApplication(sys.argv) class MyList(QtGui.QListView): def 
__init__(self, parent=None): super(MyList, self).__init__(parent) 
self.setDragEnabled(True) self.setAcceptDrops(True) list1 = MyList() 
list2 = MyList() model1 = QtGui.QStandardItemModel(list1) model2 = 
QtGui.QStandardItemModel(list1) 
model2.setItemPrototype(QtGui.QStandardItem()) foods = [ 'Cookie 
dough', 'Hummus', 'Spaghetti', 'Dal makhani', 'Chocolate whipped 
cream' ] for food in foods: item = QtGui.QStandardItem(food) 
model1.appendRow(item) list1.setModel(model1) list2.setModel(model2) 
w = QtGui.QSplitter() w.addWidget(list1) w.addWidget(list2) w.show() 
w.raise_() app.exec_() |

​
--

ohufxLogo 50x50 <http://www.ohufx.com>
	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
customisation and consulting <http://ohufx.com/customising.html>* *

*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke 
<http://www.nukepedia.com/nubridge>




___
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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QListView with delegate: support drag outside of QApplication

2018-07-31 Thread Frank Rueter | OHUfx

Anybody?
Been trying to play with the view's dragMoveEvent to take over the 
default drag event's mime data and create a custom QDrag instance with 
it, but that crashes. I also tried just adding test to the event's mime 
data, but that  has no effect.

Maybe I do need to just re-implement the drag from scratch?

It feels like there should be a more elegant solution, right?!

Cheers,
frank

On 30/07/18 3:24 PM, Frank Rueter | OHUfx wrote:


Hi all,

I have an app that uses two QListViews with delegates.
The user can drag ad drop items from one view into the other to create 
something like a shopping list.

So far so good.
Now I need to enable the user to also drag an item out of the 
application entirely.
Is it possible to access the drag event data that the list view 
produces by default, so I don’t have to re-invent the wheel for the 
already functioning internal drag?


Here is a simplified example that just needs support for dragging an 
item outside of the QApplication.


Any tips would be much appreciated.

Cheers,
frank

|import sys from PySide import QtGui, QtCore app = 
QtGui.QApplication(sys.argv) class MyList(QtGui.QListView): def 
__init__(self, parent=None): super(MyList, self).__init__(parent) 
self.setDragEnabled(True) self.setAcceptDrops(True) list1 = MyList() 
list2 = MyList() model1 = QtGui.QStandardItemModel(list1) model2 = 
QtGui.QStandardItemModel(list1) 
model2.setItemPrototype(QtGui.QStandardItem()) foods = [ 'Cookie 
dough', 'Hummus', 'Spaghetti', 'Dal makhani', 'Chocolate whipped 
cream' ] for food in foods: item = QtGui.QStandardItem(food) 
model1.appendRow(item) list1.setModel(model1) list2.setModel(model2) w 
= QtGui.QSplitter() w.addWidget(list1) w.addWidget(list2) w.show() 
w.raise_() app.exec_() |

​
--

ohufxLogo 50x50 <http://www.ohufx.com>
	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
customisation and consulting <http://ohufx.com/customising.html>* *

*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke 
<http://www.nukepedia.com/nubridge>




___
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] QListView with delegate: support drag outside of QApplication

2018-07-29 Thread Frank Rueter | OHUfx

Hi all,

I have an app that uses two QListViews with delegates.
The user can drag ad drop items from one view into the other to create 
something like a shopping list.

So far so good.
Now I need to enable the user to also drag an item out of the 
application entirely.
Is it possible to access the drag event data that the list view produces 
by default, so I don’t have to re-invent the wheel for the already 
functioning internal drag?


Here is a simplified example that just needs support for dragging an 
item outside of the QApplication.


Any tips would be much appreciated.

Cheers,
frank

|import sys from PySide import QtGui, QtCore app = 
QtGui.QApplication(sys.argv) class MyList(QtGui.QListView): def 
__init__(self, parent=None): super(MyList, self).__init__(parent) 
self.setDragEnabled(True) self.setAcceptDrops(True) list1 = MyList() 
list2 = MyList() model1 = QtGui.QStandardItemModel(list1) model2 = 
QtGui.QStandardItemModel(list1) 
model2.setItemPrototype(QtGui.QStandardItem()) foods = [ 'Cookie dough', 
'Hummus', 'Spaghetti', 'Dal makhani', 'Chocolate whipped cream' ] for 
food in foods: item = QtGui.QStandardItem(food) model1.appendRow(item) 
list1.setModel(model1) list2.setModel(model2) w = QtGui.QSplitter() 
w.addWidget(list1) w.addWidget(list2) w.show() w.raise_() app.exec_() |


​
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] sizeHint for delegates not wqorking

2018-07-03 Thread Frank Rueter | OHUfx

Ah, thanks a lot!
That did indeed fix it.

Cheers,
frank

On 3/07/18 11:56 PM, Francis Herne wrote:

On Tuesday, 3 July 2018 03:11:42 BST Frank Rueter | OHUfx wrote:

Hi all,

I am having trouble controlling my table view’s column sizes.
I thought implementing the delegate’s sizeHint was a way to do this but
it won’t work for me.

Can somebody please point out what I’m missing?

You must also set an appropriate resize mode for the view.

Adding
`self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)`

to MyView.__init__ should solve your problem.

See http://doc.qt.io/qt-5/qheaderview.html#ResizeMode-enum

-Francis


___
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] sizeHint for delegates not wqorking

2018-07-02 Thread Frank Rueter | OHUfx

Hi all,

I am having trouble controlling my table view’s column sizes.
I thought implementing the delegate’s sizeHint was a way to do this but 
it won’t work for me.


Can somebody please point out what I’m missing?
Here is my test code:

|from PySide2 import QtWidgets from PySide2 import QtCore class 
MyItemDelegate(QtWidgets.QStyledItemDelegate): def __init__(self): 
super(MyItemDelegate, self).__init__() def sizeHint(self, option, 
index): # why is this never called? print 'hint' return 
QtCore.QSize(10,10) class MyView(QtWidgets.QTableView): def 
__init__(self, parent=None): super(MyView, self).__init__(parent) 
self.setItemDelegate(MyItemDelegate()) class 
MyModel(QtCore.QAbstractTableModel): def __init__(self, parent=None): 
super(MyModel, self).__init__(parent) self.my_data = [i for i in 
xrange(100)] def data(self, index, role): '''Return required data for 
nodes''' if role == QtCore.Qt.DisplayRole: return 'item 
{}'.format(self.my_data[index.row()]) def columnCount(self, index=None): 
return 2 def rowCount(self, index=None): return len(self.my_data) class 
MyPanel(QtWidgets.QWidget): def __init__(self, parent=None): 
super(MyPanel, self).__init__(parent) self.init_UI() def init_UI(self): 
# widgets self.itemView = MyView() self.model = MyModel() 
self.itemView.setModel(self.model) layout = QtWidgets.QVBoxLayout() 
layout.addWidget(self.itemView) self.setLayout(layout) if __name__ == 
'__main__': import sys app = QtWidgets.QApplication([]) w = MyPanel() 
w.show() sys.exit(app.exec_()) |


​
Thanks,
frank
--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] QTableView - only trigger edit event in lower part of cell

2018-05-01 Thread Frank Rueter | OHUfx
Ah, looks like my approach was correct but I had not turned off edit 
triggers properly, so those were interfering with the expected behaviour.


On 1/05/18 8:21 PM, Frank Rueter | OHUfx wrote:

Hi,

I have spent several hours trying to get this right but seem to be 
failing:
I have a QTableView (which uses a QAbstractTableModel) and a custom 
delegate which takes care of the cell painting.
At the bottom of each cell I need a combo box which I want editable by 
a single click, so no clicking to select or focus the cell first. Here 
is the current state of a cell:


I tried this via the view's mousePressEvent, comparing 
self.visualRect(index) to the cursor position (after mapping both to 
the global coordinate system. But I can't get that right.


Another attempt was to do it via the delegate's createEditor() method 
and just return None if the cursor isn't in the required area.
That seemed to be more promising, but I didn't know how to close the 
editor again when the user clicks into the upper part of the cell.


I want to avoid persistent editors for performance reasons.

Does anybody have any tips how to best tackle this? It feels like it 
shouldn't be too hard and I have stared at it too long now to see any 
obvious solutions, so any help would be great.


Cheers,
frank






--

ohufxLogo 50x50 <http://www.ohufx.com>
	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
customisation and consulting <http://ohufx.com/customising.html>* *

*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke 
<http://www.nukepedia.com/nubridge>




___
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] QTableView - only trigger edit event in lower part of cell

2018-05-01 Thread Frank Rueter | OHUfx

Hi,

I have spent several hours trying to get this right but seem to be failing:
I have a QTableView (which uses a QAbstractTableModel) and a custom 
delegate which takes care of the cell painting.
At the bottom of each cell I need a combo box which I want editable by a 
single click, so no clicking to select or focus the cell first. Here is 
the current state of a cell:


I tried this via the view's mousePressEvent, comparing 
self.visualRect(index) to the cursor position (after mapping both to the 
global coordinate system. But I can't get that right.


Another attempt was to do it via the delegate's createEditor() method 
and just return None if the cursor isn't in the required area.
That seemed to be more promising, but I didn't know how to close the 
editor again when the user clicks into the upper part of the cell.


I want to avoid persistent editors for performance reasons.

Does anybody have any tips how to best tackle this? It feels like it 
shouldn't be too hard and I have stared at it too long now to see any 
obvious solutions, so any help would be great.


Cheers,
frank






--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


[Interest] make QCompleter behave like terminal compleetion

2017-10-18 Thread Frank Rueter | OHUfx

Hi all,

I am trying to make a QLineEdit behave like a terminal in terms of auto  
completing file paths when hitting the tab key.
I found this article 
 but 
it only gets me half way there. The tab key does work with this 
(slightly modified) code but it only selects the next matching word, 
when I need it to complete a match if possible and enter the next level.

Best to explain using an example I guess:
There is a file path like this:

/level1/level2/level3

Then I type "/le" and hit tab it auto-completes to "/level1", but it 
does not add the trailing slash requiring me to hit enter first, then 
start typing again.


If there are no other matches I need the tab key to auto-complete and 
enter the next directory.

Could somebody help me out please?

Cheers,
frank


--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


Re: [Interest] building a light weight tree model

2017-05-03 Thread Frank Rueter | OHUfx

Hi Andre,

>>Do you really?
I do. The spec is to generate a report of a file system including number 
of files and total file size among many other per-file stats.
I also need to identify file names that match certain filters, identify 
empty directories etc.

It's for a pre-archive workflow.
The tree and list views are mostly for sanity checking the results (they 
are colour coded and filtered to facilitate reading the amount of data) 
and eventually for renaming paths if they grow too large for windows to 
operate with during the actual archive process.
Currently this is all pre-flight checking and report building (I am 
outputting an html file with the found stats).


Sorry, I should have outlined all of this in my initial email.

>>You mentioned being able to navigate into zip files?
Not navigating into zip files. I need to display certain groups of 
physical files on disk as "virtual" zip files to show the user what will 
be zipped in the next step.

I am now doing that with a simple proxy model.

Thanks for the explanation regarding the models. That all makes perfect 
sense and in the next run I will endeavour to swap out QSIM with at a 
custom one derived from QAIM. Then see what the performance is after 
Cythonising and compiling.
I am happy to say though that the performance I achieved today seems to 
be acceptable for now (early beta prototype).


Thanks again for your guidance, it's much appreciated!

Cheers,
frank



On 3/05/17 5:48 PM, André Somers wrote:


Hi,


Op 03/05/2017 om 00:18 schreef Frank Rueter | OHUfx:

Thanks for the tip.
I don't know C++ so that's not an option, but I can Cythonise and 
compile later.


Actually, I started with a command line app that just printed out a 
report. In my analysis I need to visit every file and directory and 
collect data such as size, file extensions, matches to a user filter etc.
Do you really? Are you sure you need your tree fully expanded? Note 
that QFileSystemModel (QFSM) does its population in a lazy way: it 
does not iterate over parts of the file system that have not been 
requested yet from the model (and it does not monitor for changes in 
these parts either). Are you sure you need each and every file and 
dir's data right away? Can your user even view that much information?


Hence it felt natural to collect QStandardItems as I went, rather 
than us QFileSystemModel and then cycle through all items after the fact.
Perhaps you should explain your requirements a bit better. What are 
you going to do with the data? What do you need on top of what QFSM 
already supplies? You mentioned being able to navigate into zip files? 
Anything else?


I will have a look at doing that though, since you  seem to be in 
agreement that it will be faster.


>>QStandardItemModel is not the API you are looking for
Can you clarify please? I thought it was one of the simplest models 
and hence I gravitated towards that.
Should I use QAbstractItemModel instead (unless I end up using 
QFileSystemModel)?
QStandardItemModel is all but the simplest model. It is a very heavy 
and complicated one. Its item-based API provides many fields by 
default, and also sports virtual methods. You won't need many of 
these, yet you will pay the price for them for every cell in your 
entire model. It is far more efficient to create a compact data 
structure that contains just the data you really need in your case, 
and expose that via a QAbstractItemModel (QAIM) derived model directly.


Also on a conceptual level, I think the class is wrong for most 
usecases - including yours. It models a collection of independent 
individual cells, like a spread sheet where each cell can recursively 
contain a child spread sheet again (as is the structure of QAIM). But 
your data does not look like that. You are dealing with a forest 
structure: a collection of trees of items, containing directories 
(branches) and files (leafs). Sure, these items have attributes that 
you may want to present in aditional columns in your model, but in 
essense, the data is just about files and directories (which also can 
be thought of as files, only files containing a list of other files). 
So, you want your API to match _that_ concept. You want your API to 
deal with files, not with a row of items that really may contain 
anything.


InsHMO, the naming of this class was a mistake. It should never have 
been called "Standard", as that suggests it is the default choice, 
while in fact it should almost never be that. And the introdcution of 
QListWidget, QTableWidget and QTreeWidget was an even bigger mistake.


André



Cheers,
frank

On 3/05/17 7:52 AM, André Somers wrote:


Hi


Op 02/05/2017 om 09:15 schreef Frank Rueter | OHUfx:
I need a few custom views for my data, including representing 
collections of files with a certain extension as virtual zip files, 
i.e. items that don't actually exist on disk.

So, use a proxy model or a model that wraps the original one.

Re: [Interest] building a light weight tree model

2017-05-02 Thread Frank Rueter | OHUfx

Thanks for the tip.
I don't know C++ so that's not an option, but I can Cythonise and 
compile later.


Actually, I started with a command line app that just printed out a 
report. In my analysis I need to visit every file and directory and 
collect data such as size, file extensions, matches to a user filter etc.
Hence it felt natural to collect QStandardItems as I went, rather than 
us QFileSystemModel and then cycle through all items after the fact.
I will have a look at doing that though, since you  seem to be in 
agreement that it will be faster.


>>QStandardItemModel is not the API you are looking for
Can you clarify please? I thought it was one of the simplest models and 
hence I gravitated towards that.
Should I use QAbstractItemModel instead (unless I end up using 
QFileSystemModel)?


Cheers,
frank

On 3/05/17 7:52 AM, André Somers wrote:


Hi


Op 02/05/2017 om 09:15 schreef Frank Rueter | OHUfx:
I need a few custom views for my data, including representing 
collections of files with a certain extension as virtual zip files, 
i.e. items that don't actually exist on disk.

So, use a proxy model or a model that wraps the original one.
I assumed using QFileSystemModel would not be the most efficient way 
to use i this case (based on various comments I read in the past).
Eh... If you want to know if your code is efficient, you should not 
start from assumptions. You should start with measurements and some 
concrete goals.


Other than that, I fully agree with Chris: if you want this to work 
fast, use C++ and avoid QStandardItemModel, especially for "huge" 
models. QStandardItemModel is not the API you are looking for (ever, 
IMHO, with a possible exception for small toy projects).


André




On 2/05/17 6:25 PM, Ch'Gans wrote:



On 2 May 2017 at 17:55, Frank Rueter | OHUfx <fr...@ohufx.com 
<mailto:fr...@ohufx.com>> wrote:


Hi all,

Here is a snippet of test code to mimic a light weight tree model.
All it is trying to do is mimic the parenting according to the
directory structure on disk using QStandardItems in a
QStandardModel.
It works, but it took me way longer to figure out than I
expected, and I have a feeling some of you may have good advise
on how to make it more efficient.
https://pastebin.com/vRkzDPtt


What's your definition of "more efficient", what are the problems, 
what make you think it's not efficient?


If you want efficiency, then don't use python and don't use 
QStandardModel, if you want expediency then use QFileSystemModel.


My 2 cents.
Chris




I am not using QFileSystemModel as I wanted to keep things as
efficient as possible and also need to add some custom items to
the model.
Also, for the Python programmers: in my actual code I am using
scandir.walk() instead of os.walk() for speed.

Any input would be greatly appreciated as I will need to run
this over disks that have massive amounts of files.

Cheers,
frank


-- 


ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> |
*workflow customisation and consulting
<http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>


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






___
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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] building a light weight tree model

2017-05-02 Thread Frank Rueter | OHUfx
I need a few custom views for my data, including representing 
collections of files with a certain extension as virtual zip files, i.e. 
items that don't actually exist on disk.
I assumed using QFileSystemModel would not be the most efficient way to 
use i this case (based on various comments I read in the past).



On 2/05/17 6:25 PM, Ch'Gans wrote:



On 2 May 2017 at 17:55, Frank Rueter | OHUfx <fr...@ohufx.com 
<mailto:fr...@ohufx.com>> wrote:


Hi all,

Here is a snippet of test code to mimic a light weight tree model.
All it is trying to do is mimic the parenting according to the
directory structure on disk using QStandardItems in a QStandardModel.
It works, but it took me way longer to figure out than I expected,
and I have a feeling some of you may have good advise on how to
make it more efficient.
https://pastebin.com/vRkzDPtt


What's your definition of "more efficient", what are the problems, 
what make you think it's not efficient?


If you want efficiency, then don't use python and don't use 
QStandardModel, if you want expediency then use QFileSystemModel.


My 2 cents.
Chris




I am not using QFileSystemModel as I wanted to keep things as
efficient as possible and also need to add some custom items to
the model.
Also, for the Python programmers: in my actual code I am using
scandir.walk() instead of os.walk() for speed.

Any input would be greatly appreciated as I will need to run this
over disks that have massive amounts of files.

Cheers,
frank


-- 


ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>


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




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


[Interest] building a light weight tree model

2017-05-01 Thread Frank Rueter | OHUfx

Hi all,

Here is a snippet of test code to mimic a light weight tree model.
All it is trying to do is mimic the parenting according to the directory 
structure on disk using QStandardItems in a QStandardModel.
It works, but it took me way longer to figure out than I expected, and I 
have a feeling some of you may have good advise on how to make it more 
efficient.

https://pastebin.com/vRkzDPtt

I am not using QFileSystemModel as I wanted to keep things as efficient 
as possible and also need to add some custom items to the model.
Also, for the Python programmers: in my actual code I am using 
scandir.walk() instead of os.walk() for speed.


Any input would be greatly appreciated as I will need to run this over 
disks that have massive amounts of files.


Cheers,
frank


--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] CSS based pie chart ignored in QWebView

2017-05-01 Thread Frank Rueter | OHUfx
Ok, thanks. I got it to work. I don't know what I did wrong yesterday 
but it seems to be fine now.


Cheers,
frank

On 1/05/17 8:44 PM, Konstantin Tokarev wrote:


01.05.2017, 10:03, "Frank Rueter | OHUfx" <fr...@ohufx.com>:

Hi,

I was hoping to utilise a CSS based pie chart like this in my QWebView to print 
some reports.
I copied the css code from the above example to my already implemented local 
CSS file, but the pie chart wont' display in the QWebView (other css 
definitions do have a effect).

All I'm doing in the Qt relevant code is this:
 self.htmlView = QWebView()
 
self.htmlView.settings().setUserStyleSheetUrl(QtCore.QUrl.fromLocalFile('/ohufx/consulting/PreferredMedia/code/report_template.css'))

Did you load HTML part of page?
This CSS should work, just try loading your codepen URL into QWebView


Is this a limitation of QWebView or am I missing something?
I have attached the css file.

Cheers,
frank

--

   vfx compositing | workflow customisation and consulting

Your gateway to over 1,000 free tools... right inside of Nuke
,

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


--
Regards,
Konstantin


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


[Interest] CSS based pie chart ignored in QWebView

2017-05-01 Thread Frank Rueter | OHUfx

Hi,

I was hoping to utilise a CSS based pie chart like this 
 in my QWebView to print some 
reports.
I copied the css code from the above example to my already implemented 
local CSS file, but the pie chart wont' display in the QWebView (other 
css definitions do have a effect).


All I'm doing in the Qt relevant code is this:
self.htmlView = QWebView()
self.htmlView.settings().setUserStyleSheetUrl(QtCore.QUrl.fromLocalFile('/ohufx/consulting/PreferredMedia/code/report_template.css'))

Is this a limitation of QWebView or am I missing something?
I have attached the css file.

Cheers,
frank


--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



/* 
  make each pie piece a rectangle twice as high as it is wide.
  move the transform origin to the middle of the left side.
  Also ensure that overflow is set to hidden.
*/
h4 {
color: red;
}
.pie {
	position:absolute;
	width:100px;
	height:200px;
	overflow:hidden;
	left:150px;
	-moz-transform-origin:left center;
	-ms-transform-origin:left center;
	-o-transform-origin:left center;
	-webkit-transform-origin:left center;
	transform-origin:left center;
}
/*
unless the piece represents more than 50% of the whole chart.
then make it a square, and ensure the transform origin is
back in the center.

NOTE: since this is only ever a single piece, you could
move this to a piece specific rule and remove the extra class
*/
.pie.big {
	width:200px;
	height:200px;
	left:50px;
	-moz-transform-origin:center center;
	-ms-transform-origin:center center;
	-o-transform-origin:center center;
	-webkit-transform-origin:center center;
	transform-origin:center center;
}
/*
this is the actual visible part of the pie. 
Give it the same dimensions as the regular piece.
Use border radius make it a half circle.
move transform origin to the middle of the right side.
Push it out to the left of the containing box.
*/
.pie:BEFORE {
	content:"";
	position:absolute;
	width:100px;
	height:200px;
	left:-100px;
	border-radius:100px 0 0 100px;
	-moz-transform-origin:right center;
	-ms-transform-origin:right center;
	-o-transform-origin:right center;
	-webkit-transform-origin:right center;
	transform-origin:right center;
	
}
/* if it's part of a big piece, bring it back into the square */
.pie.big:BEFORE {
	left:0px;
}
/* 
big pieces will also need a second semicircle, pointed in the
opposite direction to hide the first part behind.
*/
.pie.big:AFTER {
	content:"";
	position:absolute;
	width:100px;
	height:200px;
	left:100px;
	border-radius:0 100px 100px 0;
}
/*
add colour to each piece.
*/
.pie:nth-of-type(1):BEFORE,
.pie:nth-of-type(1):AFTER {
	background-color:blue;	
}
.pie:nth-of-type(2):AFTER,
.pie:nth-of-type(2):BEFORE {
	background-color:green;	
}
.pie:nth-of-type(3):AFTER,
.pie:nth-of-type(3):BEFORE {
	background-color:red;	
}
.pie:nth-of-type(4):AFTER,
.pie:nth-of-type(4):BEFORE {
	background-color:orange;	
}
/*
now rotate each piece based on their cumulative starting
position
*/
.pie[data-start="30"] {
	-moz-transform: rotate(30deg); /* Firefox */
	-ms-transform: rotate(30deg); /* IE */
	-webkit-transform: rotate(30deg); /* Safari and Chrome */
	-o-transform: rotate(30deg); /* Opera */
	transform:rotate(30deg);
}
.pie[data-start="60"] {
	-moz-transform: rotate(60deg); /* Firefox */
	-ms-transform: rotate(60deg); /* IE */
	-webkit-transform: rotate(60deg); /* Safari and Chrome */
	-o-transform: rotate(60deg); /* Opera */
	transform:rotate(60deg);
}
.pie[data-start="100"] {
	-moz-transform: rotate(100deg); /* Firefox */
	-ms-transform: rotate(100deg); /* IE */
	-webkit-transform: rotate(100deg); /* Safari and Chrome */
	-o-transform: rotate(100deg); /* Opera */
	transform:rotate(100deg);
}
/*
and rotate the amount of the pie that's showing.

NOTE: add an extra degree to all but the final piece, 
to fill in unsightly gaps.
*/
.pie[data-value="30"]:BEFORE {
	-moz-transform: rotate(31deg); /* Firefox */
	-ms-transform: rotate(31deg); /* IE */
	-webkit-transform: rotate(31deg); /* Safari and Chrome */
	-o-transform: rotate(31deg); /* Opera */
	transform:rotate(31deg);
}
.pie[data-value="40"]:BEFORE {
	-moz-transform: rotate(41deg); /* Firefox */
	-ms-transform: rotate(41deg); /* IE */
	-webkit-transform: rotate(41deg); /* Safari and Chrome */
	-o-transform: rotate(41deg); /* Opera */
	transform:rotate(41deg);
}
.pie[data-value="260"]:BEFORE {
	-moz-transform: rotate(260deg); /* Firefox */
	-ms-transform: rotate(260deg); /* IE */
	-webkit-transform: rotate(260deg); /* Safari and Chrome */
	-o-transform: rotate(260deg); /* Opera */
	transform:rotate(260deg);
}
/*
NOTE: you could also apply custom classes (i.e. .s0 

Re: [Interest] OverflowError when setting datat on QStandardItem

2017-04-28 Thread Frank Rueter | OHUfx

Looks like explicitly casting to long() seems to work. e.g.:
i.setData(long(13003676769), QtCore.Qt.UserRole+1)



On 29/04/17 3:41 PM, Frank Rueter | OHUfx wrote:

Hi,

I am traversing a directory collecting file sizes in bytes and 
assigning them as custom data to QStandardItems.
Unfortunately I get an OverflowError when trying to set too large a 
number it would seem:


i = QtGui.QStandardItem()
i.setData(13003676769, QtCore.Qt.UserRole+1)

 File "/path/to/module.py", line 38, in 
  i.setData(13003676769, QtCore.Qt.UserRole+1)

OverflowError:


I guess I could convert to KB, MB, GB etc, or even a string, but those 
all seem like band aids. Can somebody please help me understand why I 
am seeing this error and what the prescribed way of dealing with it is?

I couldn't find anything useful online.

This is Qt 4.8.7

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] OverflowError when setting datat on QStandardItem

2017-04-28 Thread Frank Rueter | OHUfx

Hi,

I am traversing a directory collecting file sizes in bytes and assigning 
them as custom data to QStandardItems.
Unfortunately I get an OverflowError when trying to set too large a 
number it would seem:


   i = QtGui.QStandardItem()
   i.setData(13003676769, QtCore.Qt.UserRole+1)

    File "/path/to/module.py", line 38, in 
  i.setData(13003676769, QtCore.Qt.UserRole+1)

   OverflowError:


I guess I could convert to KB, MB, GB etc, or even a string, but those 
all seem like band aids. Can somebody please help me understand why I am 
seeing this error and what the prescribed way of dealing with it is?

I couldn't find anything useful online.

This is Qt 4.8.7

Thanks,
frank

--

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


Re: [Interest] changing colours for progressbar with GTK style

2017-04-28 Thread Frank Rueter | OHUfx

Thanks Benjamin,

so that means this can't be done?
Is there style sheet syntax to get the pulsing rather than the traveling 
blocks?


Cheers,
frank

On 29/04/17 12:09 AM, Benjamin TERRIER wrote:

Hi,

Normally you would use a QPalette to change the colors.

However, Qt styles can choose to take the set QPalette into account or 
to ignore it.
The last time I checked the GTK style completely ignores it. I cannot 
check right know,

but I think it is because it follows the GTK theme of your system.

BR,

Benjamin

2017-04-28 10:54 GMT+02:00 Frank Rueter | OHUfx <fr...@ohufx.com 
<mailto:fr...@ohufx.com>>:


Hi,

I have a QProgressBar set to GTK like this:

self.pBar = QtGui.QProgressBar()
self.pBar.setRange(0, 0)
self.pBar.setStyle(QtGui.QStyleFactory.create('GTK'))

I like the subtle colour pulsing from dark blue to light blue for
a busy bar better than the traveling blocks.
However, the default is a little too subtle and I can barely see
any pulsing at all:


How would I go about setting the colours for a progressbar in GTK
style?

Thanks,
frank


-- 


ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>   


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>


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




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


[Interest] changing colours for progressbar with GTK style

2017-04-28 Thread Frank Rueter | OHUfx

Hi,

I have a QProgressBar set to GTK like this:

self.pBar = QtGui.QProgressBar()
self.pBar.setRange(0, 0)
self.pBar.setStyle(QtGui.QStyleFactory.create('GTK'))

I like the subtle colour pulsing from dark blue to light blue for a busy 
bar better than the traveling blocks.
However, the default is a little too subtle and I can barely see any 
pulsing at all:



How would I go about setting the colours for a progressbar in GTK style?

Thanks,
frank


--

ohufxLogo 50x50 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



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


Re: [Interest] I feel stupid: QStandardItem::insertRows: Ignoring duplicate insertion of item

2017-04-26 Thread Frank Rueter | OHUfx
I just found this 
<http://stackoverflow.com/questions/21564976/how-to-create-a-proxy-model-that-would-flatten-nodes-of-a-qabstractitemmodel-int>SO 
thread 
<http://stackoverflow.com/questions/21564976/how-to-create-a-proxy-model-that-would-flatten-nodes-of-a-qabstractitemmodel-int>:


|view 
=QtGui.QTreeView()view.setModel(model)view.expandAll()view.setIndentation(0)view.header().hide()|



I haven't tries it yet but it looks like it's perfect for my need.
Just wanted to post it here for posterity.

Cheers,
frank


On 27/04/17 1:29 PM, Frank Rueter | OHUfx wrote:
So I read the SO post but feel that my task is way simpler than the 
one stated in that post.
As mentioned before, all I am trying to achieve is a flattened list 
view and a tree view feeding off the same data, e.g.:


QListView should ignoring existing parenting and show:

  * itemA
  * itemB
  * itemC


QTreeView of the same model would show (based on previous parenting):
itemA
|___itemB
|itemC

Ideally I'd use a proxy model to "un-parent" all items to feed the 
list view, while the original model retains it's hierarchy and thus 
yields the expected tree view.
Is this possible to do through a proxy model? I have only ever used a 
QSortFilterProxy so far.


Thanks,
frank

On 27/04/17 3:47 AM, Kevin Funk wrote:

On Wednesday, 26 April 2017 21:32:13 CEST Frank Rueter | OHUfx wrote:

You are dead right as my follow up email confirms.
Now the question is how to use the same (parented) item in a tree view
and a list view.

That's discussed over here:
   
http://stackoverflow.com/questions/19498753/append-qstandarditem-in-two-qstandarditemmodel-at-the-same-time

You might want to start writing a proper model (QAbstractItemModel based)
instead. Or you'll need to create copies of the QStandardItems (which is
probably undesired as you manually need to keep them in sync if needed).

Hope that helps,
Kevin


I guess I will be RTFM-ing a bit.

Cheers,
frank

On 26/04/17 9:24 PM, Kevin Funk wrote:

On Wednesday, 26 April 2017 19:50:54 CEST Frank Rueter | OHUfx wrote:

Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor
generated, and I want to add them to a QStandardItemModel like this:

for item in myItemList:
   self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none of

my items but one of those errors for each item:
   QStandardItem::insertRows: Ignoring duplicate insertion of item

Use the source, Luke :)

QStandardItemModel::appendRow calls
- QStandardItem::appendRow which calls
- QStandardItem::insertRow which calls
- QStandardItemPrivate::insertRows [1]

Excerpt from QStandardItemPrivate::insertRows:
```
//...
if (item->d_func()->parent == 0) {

  item->d_func()->setParentAndModel(q, model);

} else {

  qWarning("QStandardItem::insertRows: Ignoring duplicate insertion of
  item

%p",

   item);
  
  item = 0;


}
//...
```

=> The warning is thrown when your items already have a parent set

Is that the case for you?

Hope that helps,
Kevin

PS: The Woboq code browser is an awesome tool to follow call chains (or
any
decent IDE will do, if you have the Qt sources)

[1]https://code.woboq.org/qt5/qtbase/src/gui/itemmodels/
qstandarditemmodel.cpp.html#_ZN20QStandardItemPrivate10insertRowsEiiRK5QLi
stIP13QStandardItemE>

I know I should know this but I can't figure out why this is happening.
Is there something special I need to do when subclassing QStandardItem?


Cheers,
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] I feel stupid: QStandardItem::insertRows: Ignoring duplicate insertion of item

2017-04-26 Thread Frank Rueter | OHUfx
So I read the SO post but feel that my task is way simpler than the one 
stated in that post.
As mentioned before, all I am trying to achieve is a flattened list view 
and a tree view feeding off the same data, e.g.:


   QListView should ignoring existing parenting and show:

 * itemA
 * itemB
 * itemC


   QTreeView of the same model would show (based on previous parenting):
   itemA
|___itemB
|itemC

Ideally I'd use a proxy model to "un-parent" all items to feed the list 
view, while the original model retains it's hierarchy and thus yields 
the expected tree view.
Is this possible to do through a proxy model? I have only ever used a 
QSortFilterProxy so far.


Thanks,
frank

On 27/04/17 3:47 AM, Kevin Funk wrote:

On Wednesday, 26 April 2017 21:32:13 CEST Frank Rueter | OHUfx wrote:

You are dead right as my follow up email confirms.
Now the question is how to use the same (parented) item in a tree view
and a list view.

That's discussed over here:
   
http://stackoverflow.com/questions/19498753/append-qstandarditem-in-two-qstandarditemmodel-at-the-same-time

You might want to start writing a proper model (QAbstractItemModel based)
instead. Or you'll need to create copies of the QStandardItems (which is
probably undesired as you manually need to keep them in sync if needed).

Hope that helps,
Kevin


I guess I will be RTFM-ing a bit.

Cheers,
frank

On 26/04/17 9:24 PM, Kevin Funk wrote:

On Wednesday, 26 April 2017 19:50:54 CEST Frank Rueter | OHUfx wrote:

Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor
generated, and I want to add them to a QStandardItemModel like this:

for item in myItemList:
   self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none of

my items but one of those errors for each item:
   QStandardItem::insertRows: Ignoring duplicate insertion of item

Use the source, Luke :)

QStandardItemModel::appendRow calls
- QStandardItem::appendRow which calls
- QStandardItem::insertRow which calls
- QStandardItemPrivate::insertRows [1]

Excerpt from QStandardItemPrivate::insertRows:
```
//...
if (item->d_func()->parent == 0) {

  item->d_func()->setParentAndModel(q, model);

} else {

  qWarning("QStandardItem::insertRows: Ignoring duplicate insertion of
  item

%p",

   item);
  
  item = 0;


}
//...
```

=> The warning is thrown when your items already have a parent set

Is that the case for you?

Hope that helps,
Kevin

PS: The Woboq code browser is an awesome tool to follow call chains (or
any
decent IDE will do, if you have the Qt sources)

[1] https://code.woboq.org/qt5/qtbase/src/gui/itemmodels/
qstandarditemmodel.cpp.html#_ZN20QStandardItemPrivate10insertRowsEiiRK5QLi
stIP13QStandardItemE>

I know I should know this but I can't figure out why this is happening.
Is there something special I need to do when subclassing QStandardItem?


Cheers,
frank




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


Re: [Interest] I feel stupid: QStandardItem::insertRows: Ignoring duplicate insertion of item

2017-04-26 Thread Frank Rueter | OHUfx

Thanks Kevin, I will read up on that.


On 27/04/17 3:47 AM, Kevin Funk wrote:

On Wednesday, 26 April 2017 21:32:13 CEST Frank Rueter | OHUfx wrote:

You are dead right as my follow up email confirms.
Now the question is how to use the same (parented) item in a tree view
and a list view.

That's discussed over here:
   
http://stackoverflow.com/questions/19498753/append-qstandarditem-in-two-qstandarditemmodel-at-the-same-time

You might want to start writing a proper model (QAbstractItemModel based)
instead. Or you'll need to create copies of the QStandardItems (which is
probably undesired as you manually need to keep them in sync if needed).

Hope that helps,
Kevin


I guess I will be RTFM-ing a bit.

Cheers,
frank

On 26/04/17 9:24 PM, Kevin Funk wrote:

On Wednesday, 26 April 2017 19:50:54 CEST Frank Rueter | OHUfx wrote:

Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor
generated, and I want to add them to a QStandardItemModel like this:

for item in myItemList:
   self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none of

my items but one of those errors for each item:
   QStandardItem::insertRows: Ignoring duplicate insertion of item

Use the source, Luke :)

QStandardItemModel::appendRow calls
- QStandardItem::appendRow which calls
- QStandardItem::insertRow which calls
- QStandardItemPrivate::insertRows [1]

Excerpt from QStandardItemPrivate::insertRows:
```
//...
if (item->d_func()->parent == 0) {

  item->d_func()->setParentAndModel(q, model);

} else {

  qWarning("QStandardItem::insertRows: Ignoring duplicate insertion of
  item

%p",

   item);
  
  item = 0;


}
//...
```

=> The warning is thrown when your items already have a parent set

Is that the case for you?

Hope that helps,
Kevin

PS: The Woboq code browser is an awesome tool to follow call chains (or
any
decent IDE will do, if you have the Qt sources)

[1] https://code.woboq.org/qt5/qtbase/src/gui/itemmodels/
qstandarditemmodel.cpp.html#_ZN20QStandardItemPrivate10insertRowsEiiRK5QLi
stIP13QStandardItemE>

I know I should know this but I can't figure out why this is happening.
Is there something special I need to do when subclassing QStandardItem?


Cheers,
frank




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


Re: [Interest] I feel stupid: QStandardItem::insertRows: Ignoring duplicate insertion of item

2017-04-26 Thread Frank Rueter | OHUfx

You are dead right as my follow up email confirms.
Now the question is how to use the same (parented) item in a tree view 
and a list view.

I guess I will be RTFM-ing a bit.

Cheers,
frank


On 26/04/17 9:24 PM, Kevin Funk wrote:

On Wednesday, 26 April 2017 19:50:54 CEST Frank Rueter | OHUfx wrote:

Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor
generated, and I want to add them to a QStandardItemModel like this:

for item in myItemList:
  self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none of
my items but one of those errors for each item:
  QStandardItem::insertRows: Ignoring duplicate insertion of item

Use the source, Luke :)

QStandardItemModel::appendRow calls
- QStandardItem::appendRow which calls
- QStandardItem::insertRow which calls
- QStandardItemPrivate::insertRows [1]

Excerpt from QStandardItemPrivate::insertRows:
```
//...
if (item->d_func()->parent == 0) {
 item->d_func()->setParentAndModel(q, model);
} else {
 qWarning("QStandardItem::insertRows: Ignoring duplicate insertion of item
%p",
  item);
 item = 0;
}
//...
```

=> The warning is thrown when your items already have a parent set

Is that the case for you?

Hope that helps,
Kevin

PS: The Woboq code browser is an awesome tool to follow call chains (or any
decent IDE will do, if you have the Qt sources)

[1] https://code.woboq.org/qt5/qtbase/src/gui/itemmodels/
qstandarditemmodel.cpp.html#_ZN20QStandardItemPrivate10insertRowsEiiRK5QListIP13QStandardItemE

I know I should know this but I can't figure out why this is happening.
Is there something special I need to do when subclassing QStandardItem?


Cheers,
frank




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


Re: [Interest] I feel stupid: QStandardItem::insertRows: Ignoring duplicate insertion of item

2017-04-26 Thread Frank Rueter | OHUfx

I found the culprit but not a solution yet:
When generating the list of items in my pre-process, I already parent 
them to each other for use in a QTreeView, e.g.:

cur_root_item.setChild(item_counter, cur_file_item)

Turns out I can't just show all items in a simple list ignoring their 
parenting.
How would I go about this then if I need both a "flat" list for a report 
print out and also tree view for the user to interact with, e.g.:


QListView would show (ignoring existing parenting):

 * itemA
 * itemB
 * itemC


QTreeView of the same model would show (based on previous parenting):
itemA
|___itemB
|itemC

Do I need two models and communicate between them (e.g. if a user 
renames an item)?

Or can this be achieved with a single model?

Thanks,
frank


On 26/04/17 7:50 PM, Frank Rueter | OHUfx wrote:

Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor 
generated, and I want to add them to a QStandardItemModel like this:


for item in myItemList:
self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none 
of my items but one of those errors for each item:

QStandardItem::insertRows: Ignoring duplicate insertion of item

I know I should know this but I can't figure out why this is 
happening. Is there something special I need to do when subclassing 
QStandardItem?



Cheers,
frank

--
<http://www.nukepedia.com>

over 1,000 free tools for Nuke <http://www.nukepedia.com>

<https://vimeo.com/channels/nukepedia/165747936>  

full access from within... coming soon 
<https://vimeo.com/channels/nukepedia/165747936>




___
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] I feel stupid: QStandardItem::insertRows: Ignoring duplicate insertion of item

2017-04-26 Thread Frank Rueter | OHUfx

Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor 
generated, and I want to add them to a QStandardItemModel like this:


for item in myItemList:
self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none of 
my items but one of those errors for each item:

QStandardItem::insertRows: Ignoring duplicate insertion of item

I know I should know this but I can't figure out why this is happening. 
Is there something special I need to do when subclassing QStandardItem?



Cheers,
frank

--


over 1,000 free tools for Nuke 

  

full access from within... coming soon 



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


Re: [Interest] QListWidgetItem selection border too large

2017-04-04 Thread Frank Rueter | OHUfx

Ah, thanks Jake, that would explain it. I am using an earlier version.
The host software I tested this in uses 4.8.5 though and somehow the 
problem doesn't appear in their version.
I wonder if there is a way to workaround this bug (as it will have to 
work as a standalone rather than run inside the host app)?!


I will likely opt for a horizontal splitter which would avoid the 
problem anyway, but I'd rather know how to fix it if at all possible.


Cheers,
frank


On 04/05/2017 12:01 PM, Jake Petroules wrote:

Which version of Qt are you using? I believe this was fixed by 
https://codereview.qt-project.org/#/c/150307/ in Qt 5.6. See also 
https://bugreports.qt.io/browse/QTBUG-50645


On Apr 4, 2017, at 1:59 PM, Frank Rueter | OHUfx <fr...@ohufx.com> wrote:

Hi,

I have two QListWidgets living in a QSplitter.
I need the items to be editable.
Some of the item labels are longer than the visible label.
When I edit one, it's selection border extends right across the splitter like 
this:


It seems that the selection box is as large as the longest item label in the 
list.
How can I control this so it stays within it's own splitter space?

When I open it in a host app that bundles it's own PySide (and has it's one 
style sheet for all widgets), this problem does not occur, so I'm hoping there 
is a simple solution here.

Attached is the sample code.

Cheers,
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] QListWidgetItem selection border too large

2017-04-04 Thread Frank Rueter | OHUfx

Hi,

I have two QListWidgets living in a QSplitter.
I need the items to be editable.
Some of the item labels are longer than the visible label.
When I edit one, it's selection border extends right across the splitter 
like this:



It seems that the selection box is as large as the longest item label in 
the list.

How can I control this so it stays within it's own splitter space?

When I open it in a host app that bundles it's own PySide (and has it's 
one style sheet for all widgets), this problem does not occur, so I'm 
hoping there is a simple solution here.


Attached is the sample code.

Cheers,
frank
#!/usr/bin/env python
import Analysis
from PySide import QtGui, QtCore

class FileAnalyserPanel(QtGui.QDialog):

def __init__(self, parent=None):
super(FileAnalyserPanel, self).__init__(parent)
self.path = QtCore.QDir.homePath()
self.buildUI()
self.connectSignals()

def buildUI(self):
'''Sets all the rewuired layouts and widgets'''
# layouts
mainLayout = QtGui.QVBoxLayout()
self.setLayout(mainLayout)
topLayout = QtGui.QHBoxLayout()
middleLayout1 = QtGui.QHBoxLayout()
middleLayout1.setSizeConstraint(QtGui.QLayout.SetFixedSize)
middleLayout2 = QtGui.QHBoxLayout()
middleLayout2.setSizeConstraint(QtGui.QLayout.SetFixedSize)
bottomLayout = QtGui.QHBoxLayout()

# widgets
pathLabel = QtGui.QLabel('root path')
self.pathWidget = QtGui.QLabel()
self.pathWidget.setFrameStyle(QtGui.QFrame.StyledPanel|
  QtGui.QFrame.Sunken)
self.pathBtn = QtGui.QPushButton('Set Path...')
splitterWidget = QtGui.QSplitter()
self.fileListWidgetTotal = QtGui.QListWidget()
self.fileListWidgetAccepted = QtGui.QListWidget()
self.fileListWidgetRejected = QtGui.QListWidget()
splitterWidget.addWidget(self.fileListWidgetAccepted)
splitterWidget.addWidget(self.fileListWidgetRejected)

labelAccepted = QtGui.QLabel('Accepted')
labelAccepted.setSizePolicy(QtGui.QSizePolicy.Policy.Expanding, QtGui.QSizePolicy.Policy.Fixed)
labelRejected = QtGui.QLabel('Rejected')
labelRejected.setSizePolicy(QtGui.QSizePolicy.Policy.Expanding, QtGui.QSizePolicy.Policy.Fixed)
self.counterAccepted = QtGui.QLCDNumber()
self.counterAccepted.setSegmentStyle(QtGui.QLCDNumber.Flat)
self.counterAccepted.setSizePolicy(QtGui.QSizePolicy.Policy.Expanding, QtGui.QSizePolicy.Policy.Fixed)
self.counterRejected = QtGui.QLCDNumber()
self.counterRejected.setSegmentStyle(QtGui.QLCDNumber.Flat)
self.counterRejected.setSizePolicy(QtGui.QSizePolicy.Policy.Expanding, QtGui.QSizePolicy.Policy.Fixed)

# add widgets to layouts
topLayout.addWidget(pathLabel)
topLayout.addWidget(self.pathWidget, True)
topLayout.addWidget(self.pathBtn)
topLayout.addWidget(splitterWidget)
middleLayout1.addWidget(labelAccepted)
middleLayout1.addWidget(labelRejected)
middleLayout2.addWidget(self.counterAccepted)
middleLayout2.addWidget(self.counterRejected)
mainLayout.addLayout(topLayout)
mainLayout.addLayout(middleLayout1)
mainLayout.addWidget(splitterWidget)
mainLayout.addLayout(middleLayout2)
mainLayout.addLayout(bottomLayout)

def connectSignals(self):
self.pathBtn.clicked.connect(self.setPath)

def setPath(self):
#self.path = QtGui.QFileDialog.getExistingDirectory(self,
  #'Choose Path to analyse',
  #self.path)
self.pathWidget.setText(self.path)
listOfStuff = ['a'*100, 'b'*50, 'c'*20]
for f in listOfStuff:
item = QtGui.QListWidgetItem(f)
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
self.fileListWidgetAccepted.addItem(item)

if __name__ == '__main__':
import sys

app = QtGui.QApplication(sys.argv)
panel = FileAnalyserPanel()
panel.show()
panel.raise_()
sys.exit(app.exec_())
___
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 <fr...@ohufx.com> 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] 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


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

2017-03-26 Thread Frank Rueter | OHUfx

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


Re: [Interest] using QSetting when host application is using it as well

2017-02-06 Thread Frank Rueter | OHUfx

Ok, thanks Constantin.

On 5/02/17 2:55 AM, Constantin Makshin wrote:

QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.HomeLocation)
and os.path.expanduser('~') will return path to the user's home
directory ("C:\Users\") while the
better/more_common/proper/recommended/whatever place for configuration
files is somewhere under either "C:\Users\\AppData\Local" or
"C:\Users\\AppData\Roaming". It's somewhat like storing
settings in "~/." instead of "~/.config/" on *nix.

On 02/03/2017 06:20 AM, Frank Rueter | OHUfx wrote:

Thanks.
I'm stuck with QT 4.8.5 at the moment so QStandardPaths is not
available, but I could use QDesktopServices instead, e.g.:

QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.HomeLocation)


What would be the difference to os.path.expanduser('~') though?

Cheers,
frank



On 2/02/17 8:19 PM, Constantin Makshin wrote:

Hi Frank.

Looks like the host application uses QSettings::setPath()
(http://doc.qt.io/qt-5/qsettings.html#setPath) to enforce a specific
directory for configuration files. Calling that method from your code is
obviously a bad idea (high risk of screwing up the host application), so
your "fallback" is the easiest solution. It'll be even better if you
replace the "~/.config" part with proper runtime detection of user
settings' directory (e.g.
QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)).

On 02/02/2017 08:35 AM, Frank Rueter | OHUfx wrote:

In the meantime I am falling back on using this:
  os.path.expanduser('~/.config/companyName/appName')

While this does not give me the OS' native support directory for the
respective user at least it's consistent :)

I'd still be interested in a QSettings solution though.

Cheers,
frank

On 2/02/17 4:51 PM, Frank Rueter | OHUfx wrote:

Hi all,

I have been using QSettings for reading/writing user settings.
All works well until I run my (PySide) application inside a host
application that is also written in QT, and which also uses the
QSettings object.

I am now struggling to understand how I can properly differentiate
between the host application's settings instance and my own.
In particular, I need to use QSettings().fileName() to determine the
correct support path for my ini files for each platform.
But this line gives me different values inside and outside the host
application:

 QtCore.QSettings(QtCore.QSettings.IniFormat,
 QtCore.QSettings.UserScope, "companyName", "appName").fileName()

E.g.:
Outside the host application I get what I want:

 /Users/frank/.config/companyName/appName.ini

But the return value is a completely different inside the host app and
actually points to the host app's internal file structure.
Fair enough too I guess.

So my question is:
How can I use QSettings to determine support paths etc while making
sure that I don't accidentally mess with the host applications QSettings?

Cheers,
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] using QSetting when host application is using it as well

2017-02-02 Thread Frank Rueter | OHUfx

Thanks.
I'm stuck with QT 4.8.5 at the moment so QStandardPaths is not 
available, but I could use QDesktopServices instead, e.g.:


QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.HomeLocation)


What would be the difference to os.path.expanduser('~') though?

Cheers,
frank



On 2/02/17 8:19 PM, Constantin Makshin wrote:

Hi Frank.

Looks like the host application uses QSettings::setPath()
(http://doc.qt.io/qt-5/qsettings.html#setPath) to enforce a specific
directory for configuration files. Calling that method from your code is
obviously a bad idea (high risk of screwing up the host application), so
your "fallback" is the easiest solution. It'll be even better if you
replace the "~/.config" part with proper runtime detection of user
settings' directory (e.g.
QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)).

On 02/02/2017 08:35 AM, Frank Rueter | OHUfx wrote:

In the meantime I am falling back on using this:
  os.path.expanduser('~/.config/companyName/appName')

While this does not give me the OS' native support directory for the
respective user at least it's consistent :)

I'd still be interested in a QSettings solution though.

Cheers,
frank

On 2/02/17 4:51 PM, Frank Rueter | OHUfx wrote:

Hi all,

I have been using QSettings for reading/writing user settings.
All works well until I run my (PySide) application inside a host
application that is also written in QT, and which also uses the
QSettings object.

I am now struggling to understand how I can properly differentiate
between the host application's settings instance and my own.
In particular, I need to use QSettings().fileName() to determine the
correct support path for my ini files for each platform.
But this line gives me different values inside and outside the host
application:

 QtCore.QSettings(QtCore.QSettings.IniFormat,
 QtCore.QSettings.UserScope, "companyName", "appName").fileName()

E.g.:
Outside the host application I get what I want:

 /Users/frank/.config/companyName/appName.ini

But the return value is a completely different inside the host app and
actually points to the host app's internal file structure.
Fair enough too I guess.

So my question is:
How can I use QSettings to determine support paths etc while making
sure that I don't accidentally mess with the host applications QSettings?

Cheers,
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] using QSetting when host application is using it as well

2017-02-01 Thread Frank Rueter | OHUfx

In the meantime I am falling back on using this:
 os.path.expanduser('~/.config/companyName/appName')

While this does not give me the OS' native support directory for the 
respective user at least it's consistent :)


I'd still be interested in a QSettings solution though.

Cheers,
frank

On 2/02/17 4:51 PM, Frank Rueter | OHUfx wrote:

Hi all,

I have been using QSettings for reading/writing user settings.
All works well until I run my (PySide) application inside a host 
application that is also written in QT, and which also uses the 
QSettings object.


I am now struggling to understand how I can properly differentiate 
between the host application's settings instance and my own.
In particular, I need to use QSettings().fileName() to determine the 
correct support path for my ini files for each platform.
But this line gives me different values inside and outside the host 
application:


QtCore.QSettings(QtCore.QSettings.IniFormat,
QtCore.QSettings.UserScope, "companyName", "appName").fileName()

E.g.:
Outside the host application I get what I want:

/Users/frank/.config/companyName/appName.ini

But the return value is a completely different inside the host app and 
actually points to the host app's internal file structure.

Fair enough too I guess.

So my question is:
How can I use QSettings to determine support paths etc while making 
sure that I don't accidentally mess with the host applications QSettings?


Cheers,
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] using QSetting when host application is using it as well

2017-02-01 Thread Frank Rueter | OHUfx

Hi all,

I have been using QSettings for reading/writing user settings.
All works well until I run my (PySide) application inside a host 
application that is also written in QT, and which also uses the 
QSettings object.


I am now struggling to understand how I can properly differentiate 
between the host application's settings instance and my own.
In particular, I need to use QSettings().fileName() to determine the 
correct support path for my ini files for each platform.
But this line gives me different values inside and outside the host 
application:


   QtCore.QSettings(QtCore.QSettings.IniFormat,
   QtCore.QSettings.UserScope, "companyName", "appName").fileName()

E.g.:
Outside the host application I get what I want:

   /Users/frank/.config/companyName/appName.ini

But the return value is a completely different inside the host app and 
actually points to the host app's internal file structure.

Fair enough too I guess.

So my question is:
How can I use QSettings to determine support paths etc while making sure 
that I don't accidentally mess with the host applications QSettings?


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


Re: [Interest] TypeError during cythonize

2017-01-26 Thread Frank Rueter | OHUfx

true, will do, thanks.

On 26/01/17 11:03 PM, Alexandru Croitor wrote:

Hi,

In case you are using PyQt, I would suggest you will get higher 
response rates at the PyQt mailing list,
because this particular curiosity does not seem related to the 
internal Qt code.


On 25 Jan 2017, at 21:38, Frank Rueter | OHUfx <fr...@ohufx.com 
<mailto:fr...@ohufx.com>> wrote:


Hi all,

I have run into this issue a couple of times now:

Some of my class declarations look like this:

class DBTaskQueue(QtCore.QObject):
def __init__(self, npdbInstance, task=None, parent=None):
super(DBTaskQueue, self).__init__(parent)


This works fine when run as pure python code but when I cythonize I 
get this error:


TypeError:super(type,obj):obj must be an instance orsubtype of type


The error only happens when I provide arguments to t super() - e.g. 
"parent" in this case.

The workaround is to use this instead:

class DBTaskQueue(QtCore.QObject):
def __init__(self, npdbInstance, task=None, parent=None):
*QtCore.QObject.__init__(self, parent)*


When there is no  argument to super() it always seems to be happy.

Is this a bug or user error?

Cheers,
frank


--
 <http://www.ohufx.com/> 	*vfx compositing 
<http://ohufx.com/compositing.html> | *workflow customisation and 
consulting <http://ohufx.com/customising.html>* *


___
Interest mailing list
Interest@qt-project.org <mailto: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] TypeError during cythonize

2017-01-25 Thread Frank Rueter | OHUfx

Hi all,

I have run into this issue a couple of times now:

Some of my class declarations look like this:

   class DBTaskQueue(QtCore.QObject):
def __init__(self, npdbInstance, task=None, parent=None):
super(DBTaskQueue, self).__init__(parent)


This works fine when run as pure python code but when I cythonize I get 
this error:


   TypeError:super(type,obj):obj must be an instance orsubtype of type


The error only happens when I provide arguments to t super() - e.g. 
"parent" in this case.

The workaround is to use this instead:

   class DBTaskQueue(QtCore.QObject):
def __init__(self, npdbInstance, task=None, parent=None):
   *QtCore.QObject.__init__(self, parent)*


When there is no  argument to super() it always seems to be happy.

Is this a bug or user error?

Cheers,
frank


--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation and 
consulting * *


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


Re: [Interest] QThreadPool functionality for QThreads

2017-01-20 Thread Frank Rueter | OHUfx

QRunnables with QThreadPool seem to work great in my case.
I am instantitating my main worker class inside the QRunnable now to be 
able send signals via that (e.g. runnable.worker.signal.emit()).
I tried multiple inheritance to just have one QRunnable class that can 
emit signals, but that didn't work, e.g.:

class MyRunable(QtCore.QObject, QtCore.QRunnable()

But I'm happy with my solution now, so thanks everybody for contributing.

frank

On 20/01/17 3:08 PM, Thiago Macieira wrote:

On quinta-feira, 19 de janeiro de 2017 07:55:12 PST Elvis Stansvik wrote:

Frank, another threading approach in Qt which we haven't mentioned yet
is QtConcurrent. I use that myself in an application where I had to
load a series of large tomographic volumes using VTK (so blocking
I/O). It might not be a good fit for your use case, but thought I
should mention it for brevity.

Or you can use Thread Building Blocks too.



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


Re: [Interest] QThreadPool - global instance or custom one

2017-01-20 Thread Frank Rueter | OHUfx

Thanks for confirming Bo, I will adjust my code accordingly.

On 20/01/17 10:36 PM, Bo Thorsen wrote:
I have exactly the same rule for my coding as Thiago does. And my 
answer would be the same for this. If one of the models have jobs that 
could hurt the performance of the other jobs, give it a pool of it's 
own. If not, you can share.


Bo.

2017-01-20 4:44 GMT+01:00 Frank Rueter | OHUfx <fr...@ohufx.com 
<mailto:fr...@ohufx.com>>:


Great, thanks for the quick reply and confirmation.
One more question: Would you create one QThreadPool instance for
the entire application or create new instances as you go (from
within different modules). Does it matter?

Cheers,
frank

On 20/01/17 3:29 PM, Thiago Macieira wrote:

On sexta-feira, 20 de janeiro de 2017 11:59:31 PST Frank
        Rueter | OHUfx wrote:

Hi all,

I have started using QThreadPool for the first time and am
wondering if
it's save/recommended to create my own instance of it or
to always use
the global instance?

The rule I use is that you should use your own pool if you
plan on launching
tasks that may block, but it's ok to use the global one if you
need to run
things that run as fast as they can without blocking.

QHostInfo uses its own thread pool because it calls a blocking
function that
is known to sometimes take 30 seconds to return (getaddrinfo).

In my case my app will run inside a host application, so
my gut feeling
says to create my own thread pool so I don't accidentally
hijack the
host application's pool, but I may be wrong?!

You're probably right. QHostInfo's example also matches your
thinking: Qt's
behind-the-scenes usage should not affect the main
application's ability to
use the global thread pool.


___
Interest mailing list
Interest@qt-project.org <mailto:Interest@qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest
<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] QThreadPool - global instance or custom one

2017-01-19 Thread Frank Rueter | OHUfx

Great, thanks for the quick reply and confirmation.
One more question: Would you create one QThreadPool instance for the 
entire application or create new instances as you go (from within 
different modules). Does it matter?


Cheers,
frank

On 20/01/17 3:29 PM, Thiago Macieira wrote:

On sexta-feira, 20 de janeiro de 2017 11:59:31 PST Frank Rueter | OHUfx wrote:

Hi all,

I have started using QThreadPool for the first time and am wondering if
it's save/recommended to create my own instance of it or to always use
the global instance?

The rule I use is that you should use your own pool if you plan on launching
tasks that may block, but it's ok to use the global one if you need to run
things that run as fast as they can without blocking.

QHostInfo uses its own thread pool because it calls a blocking function that
is known to sometimes take 30 seconds to return (getaddrinfo).


In my case my app will run inside a host application, so my gut feeling
says to create my own thread pool so I don't accidentally hijack the
host application's pool, but I may be wrong?!

You're probably right. QHostInfo's example also matches your thinking: Qt's
behind-the-scenes usage should not affect the main application's ability to
use the global thread pool.



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


[Interest] QThreadPool - global instance or custom one

2017-01-19 Thread Frank Rueter | OHUfx

Hi all,

I have started using QThreadPool for the first time and am wondering if 
it's save/recommended to create my own instance of it or to always use 
the global instance?
I.e. the docs all tend to refer to the global instance but they don't 
say anything about creating your own.


Are there any pros and cons?

In my case my app will run inside a host application, so my gut feeling 
says to create my own thread pool so I don't accidentally hijack the 
host application's pool, but I may be wrong?!


Any insight on this?

Cheers,
frank

--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation and 
consulting * *


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


Re: [Interest] QThreadPool functionality for QThreads

2017-01-18 Thread Frank Rueter | OHUfx

Thanks Elvis, much appreciated!


On 19/01/17 7:55 PM, Elvis Stansvik wrote:

2017-01-19 1:10 GMT+01:00 Thiago Macieira :

On quarta-feira, 18 de janeiro de 2017 20:04:41 PST Elvis Stansvik wrote:

If you have one QThread that depends on the completion of another,
then no, I don't think there's a convenient API in Qt to express that
relationship and run the threads in sequence. You'll have to string
them together yourself, or maybe use something else like Threadweaver.
I could be wrong of course

You can always chain-connect one thread's finished() signal to the other's
start() slot.

Yes sorry, should have been more explicit, that's what I meant with
"string them together".

Frank, another threading approach in Qt which we haven't mentioned yet
is QtConcurrent. I use that myself in an application where I had to
load a series of large tomographic volumes using VTK (so blocking
I/O). It might not be a good fit for your use case, but thought I
should mention it for brevity.

Elvis


But that's unnecessary overhead: stopping and starting threads. You should do
like Elvis says and just reuse the thread.

--
Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel Open Source Technology Center

___
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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThreadPool functionality for QThreads

2017-01-18 Thread Frank Rueter | OHUfx

OK, thanks Thiago and Elvis.
I think I got the picture now and can proceed knowing I'm not heading 
into a dead end.


Cheers,
frank

On 19/01/17 1:10 PM, Thiago Macieira wrote:

On quarta-feira, 18 de janeiro de 2017 20:04:41 PST Elvis Stansvik wrote:

If you have one QThread that depends on the completion of another,
then no, I don't think there's a convenient API in Qt to express that
relationship and run the threads in sequence. You'll have to string
them together yourself, or maybe use something else like Threadweaver.
I could be wrong of course

You can always chain-connect one thread's finished() signal to the other's
start() slot.

But that's unnecessary overhead: stopping and starting threads. You should do
like Elvis says and just reuse the thread.



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


Re: [Interest] QThreadPool functionality for QThreads

2017-01-18 Thread Frank Rueter | OHUfx

Thanks Elvis.
And my apologies (especially to Thiago) for posting a misleading and 
incopmlete question.


I have been playing with converting to QRunner which seems to work fine 
(haven't tested it thoroughly though).
I will have a look at QNetworkAccessManager so I can compare the 
approaches, thanks for the tip.


Cheers,
frank

On 19/01/17 8:12 AM, Elvis Stansvik wrote:

2017-01-18 20:11 GMT+01:00 Elvis Stansvik <elvst...@gmail.com>:

2017-01-18 20:04 GMT+01:00 Elvis Stansvik <elvst...@gmail.com>:

2017-01-18 8:17 GMT+01:00 Frank Rueter | OHUfx <fr...@ohufx.com>:

Hi Thiago,

thanks for your quick reply. I will try and give some more context:
I use the python requests module inside my PySide app to post requests to a
website. Some of those requests return a lot of data that I need to parse to
be able to show progress, other requests are file downloads that I need
progress bars for as they stream onto disk.
I had tried to not use threads and use QApplication.processEvents() for each
data chunk downloaded, but that made the download about 4-5 times slower.
Introducing threading made a huge difference.

Right, you won't get a good result with that approach. It's always
good to be up front with any special circumstances like this (using a
networking API that does not run on top of the Qt event loop).


My app can download a list of files at the same time. Depending on the
situation and the user request, the list of files to be downloaded can
happen asynchronously, in other situations they need to be downloaded one
after the other.

I think this is what confused Thiago: What you mean is sequential (as
opposed to parallell), not synchronous.

If you have one QThread that depends on the completion of another,
then no, I don't think there's a convenient API in Qt to express that
relationship and run the threads infrom sequence. You'll have to string
them together yourself, or maybe use something else like Threadweaver.
I could be wrong of course :)

Another approach is of course to ditch the threading and use the
asyncronous QNetworkAccessManager from Qt, instead of using the Python
requests module. You can use the downloadProgress/uploadProgress of

downloadProgress/uploadProgress *signals*.


the QNetworkReply you get from get(..) or post(..) if you want to show
progress (haven't used it myself).

Elvis


Elvis


All I can tell you is that you don't need to do what you're trying to do,
since you don't need threads in the first place.

If I can avoid threads to do the above I would be more than happy to adjust
and get rid of them again, but I haven't managed to find a non-threaded
approach that doesn't slow down the download significantly.

Cheers,
frank


On 18/01/17 6:26 PM, Thiago Macieira wrote:

On quarta-feira, 18 de janeiro de 2017 17:21:46 PST Frank Rueter | OHUfx
wrote:

Hi,

I got another threading question for the pros out there:

In  my current application I am using QThread objects and
QObject.moveToThread() to enable my GUI to download multiple files while
updating progress bars in the main event loop. This is the respective

As usual, the usual disclaimer: you do not need threads to do networking
or
file I/O. The combined overhead of the networking I/O and saving of the
files is
unlikely to overwhelm the event loop to the point that the progress bar
can't
update smoothly.

I'm not saying impossible, but it's unlikely.


snippet of code:
   self.worker = MyClass()
   self.workerThread = QtCore.QThread()
   self.worker.moveToThread(self.workerThread)

The trouble is when the user wants to download multiple files at once.
In my current implementation that all works fine and I see multiple
progress bars do there thing.
However, there are cases when I need to force the download threads to be
synchronous. I had hoped that I can use QThreadPool with QThreads, but
turns out I need QRunnables in this case, and those don't have the same
signals as QThread.

Why do you need to force them to be synchronous? And synchronous with
what?
With each other? Or do you mean sync() in the file saving?

Finally, what does being synchronous have to do with signals?


So my question is:
Is there a good way to use QThreads in a queue which is controlled by
the main thread, or should I re-write my code and subclass QRunnable to
add the signals I need (i.e. the ones that QThread has by default)?

The whole point of QThread is that the code it runs is independent of
anything
else. Only the OS scheduler decides when it's time to run it or suspend
it.


In the latter case I guess I'd have to inherit from both QObject and
QRunnable, is this ok?

Right.

But we still don't understand what you're trying to do. All I can tell you
is
that you don't need to do what you're trying to do, since you don't need
threads in the first place.


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

Re: [Interest] QThreadPool functionality for QThreads

2017-01-17 Thread Frank Rueter | OHUfx

Hi Thiago,

thanks for your quick reply. I will try and give some more context:
I use the python requests module inside my PySide app to post requests 
to a website. Some of those requests return a lot of data that I need to 
parse to be able to show progress, other requests are file downloads 
that I need progress bars for as they stream onto disk.
I had tried to not use threads and use QApplication.processEvents() for 
each data chunk downloaded, but that made the download about 4-5 times 
slower. Introducing threading made a huge difference.


My app can download a list of files at the same time. Depending on the 
situation and the user request, the list of files to be downloaded can 
happen asynchronously, in other situations they need to be downloaded 
one after the other.


>>All I can tell you is that you don't need to do what you're trying to 
do, since you don't need threads in the first place.
If I can avoid threads to do the above I would be more than happy to 
adjust and get rid of them again, but I haven't managed to find a 
non-threaded approach that doesn't slow down the download significantly.


Cheers,
frank

On 18/01/17 6:26 PM, Thiago Macieira wrote:

On quarta-feira, 18 de janeiro de 2017 17:21:46 PST Frank Rueter | OHUfx
wrote:

Hi,

I got another threading question for the pros out there:

In  my current application I am using QThread objects and
QObject.moveToThread() to enable my GUI to download multiple files while
updating progress bars in the main event loop. This is the respective

As usual, the usual disclaimer: you do not need threads to do networking or
file I/O. The combined overhead of the networking I/O and saving of the files is
unlikely to overwhelm the event loop to the point that the progress bar can't
update smoothly.

I'm not saying impossible, but it's unlikely.


snippet of code:
  self.worker = MyClass()
  self.workerThread = QtCore.QThread()
  self.worker.moveToThread(self.workerThread)

The trouble is when the user wants to download multiple files at once.
In my current implementation that all works fine and I see multiple
progress bars do there thing.
However, there are cases when I need to force the download threads to be
synchronous. I had hoped that I can use QThreadPool with QThreads, but
turns out I need QRunnables in this case, and those don't have the same
signals as QThread.

Why do you need to force them to be synchronous? And synchronous with what?
With each other? Or do you mean sync() in the file saving?

Finally, what does being synchronous have to do with signals?


So my question is:
Is there a good way to use QThreads in a queue which is controlled by
the main thread, or should I re-write my code and subclass QRunnable to
add the signals I need (i.e. the ones that QThread has by default)?

The whole point of QThread is that the code it runs is independent of anything
else. Only the OS scheduler decides when it's time to run it or suspend it.


In the latter case I guess I'd have to inherit from both QObject and
QRunnable, is this ok?

Right.

But we still don't understand what you're trying to do. All I can tell you is
that you don't need to do what you're trying to do, since you don't need
threads in the first place.



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


[Interest] QThreadPool functionality for QThreads

2017-01-17 Thread Frank Rueter | OHUfx

Hi,

I got another threading question for the pros out there:

In  my current application I am using QThread objects and 
QObject.moveToThread() to enable my GUI to download multiple files while 
updating progress bars in the main event loop. This is the respective 
snippet of code:

self.worker = MyClass()
self.workerThread = QtCore.QThread()
self.worker.moveToThread(self.workerThread)


The trouble is when the user wants to download multiple files at once. 
In my current implementation that all works fine and I see multiple 
progress bars do there thing.
However, there are cases when I need to force the download threads to be 
synchronous. I had hoped that I can use QThreadPool with QThreads, but 
turns out I need QRunnables in this case, and those don't have the same 
signals as QThread.

So my question is:
Is there a good way to use QThreads in a queue which is controlled by 
the main thread, or should I re-write my code and subclass QRunnable to 
add the signals I need (i.e. the ones that QThread has by default)?
In the latter case I guess I'd have to inherit from both QObject and 
QRunnable, is this ok?



Cheers,
frank



--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation and 
consulting * *


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


Re: [Interest] QWebView and Joomla pages

2017-01-14 Thread Frank Rueter | OHUfx
I go tit working now by adding the header data back into the downloaded 
html.

Thanks a lot Kai!

frank

On 15/01/17 2:22 PM, Frank Rueter | OHUfx wrote:

Hi Kai,

my apologies for not replying earlier!
Thank you for the explanation, so it sounds like its "should just work".
After reading your explanation I realised that the html I am feeding 
into the WebView comes directly from a data base query and does not 
include the headers you see in the source of the web page.


So I suppose if I find the right CSS files and add the respective 
lines back to the downloaded html before feeding it into WebView via 
setHtml it should work?!

e.g.:

cssHeaders = 'href="/templates/yoo_sync/base.css" />'


webView.setHtml(cssHeaders + html)

Those particular css files don't give me what I'm aft so I need to dig 
up the correct one, but should this work?


Cheers,
frank

On 12/01/17 11:29 PM, Kai Koehne wrote:

-Original Message-----
From: Frank Rueter | OHUfx [mailto:fr...@ohufx.com]
Sent: Thursday, January 12, 2017 9:05 AM
To: Kai Koehne<kai.koe...@qt.io>;interest@qt-project.org
Subject: Re: [Interest] QWebView and Joomla pages

Thanks Kai,

thanks for the quick reply!
I'd be quite happy to read the CSS files from the server rather than injecting
locally, but I know little about CSS and the website has a whole bunch that all
happily cross import things.

Hi Frank,

Usually the setup is that the CMS links to the CSS from the HTML. That is, the 
page
Delivered to the web browser contains lines like

   
   

This is actually 
fromview-source:http://www.nukepedia.com/gizmos/filter/efibonacciglow. The web 
browser will then automatically try to download and apply 
e.g.http://www.nukepedia.com/components/com_jcomments/tpl/default/style.css?v=21
  .

I understand that either your CMS is configured wrong, and doesn't include 
these links, or that you hit a bug in WebEngine where the css for a reason or 
the other is not fetched, or applied correctly. Can you clarify??


I have attached the css folder from the website as that will tell you more than
my ramblings

If it's possible to simply point QWebView to that online folder and make
sense of it on the fly, I would be perfectly happy.

See above - it is something that the .html page itself should link to. The 
QWebEngineSettings::setUserStyleSheetUrl you found is only a fallback, e.g. if 
you want to tweak the layout of pages you don't have any control over on the 
server side.


Otherwise I guess I will have to figure out how to merge all these things into
a master css.

As I mentioned already, you can also link from a CSS to another CSS by using 
the @import rule .

Regards

Kai




___
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] QWebView and Joomla pages

2017-01-14 Thread Frank Rueter | OHUfx

Hi Kai,

my apologies for not replying earlier!
Thank you for the explanation, so it sounds like its "should just work".
After reading your explanation I realised that the html I am feeding 
into the WebView comes directly from a data base query and does not 
include the headers you see in the source of the web page.


So I suppose if I find the right CSS files and add the respective lines 
back to the downloaded html before feeding it into WebView via setHtml 
it should work?!

e.g.:

cssHeaders = 'href="/templates/yoo_sync/base.css" />'


webView.setHtml(cssHeaders + html)

Those particular css files don't give me what I'm aft so I need to dig 
up the correct one, but should this work?


Cheers,
frank

On 12/01/17 11:29 PM, Kai Koehne wrote:

-Original Message-----
From: Frank Rueter | OHUfx [mailto:fr...@ohufx.com]
Sent: Thursday, January 12, 2017 9:05 AM
To: Kai Koehne <kai.koe...@qt.io>; interest@qt-project.org
Subject: Re: [Interest] QWebView and Joomla pages

Thanks Kai,

thanks for the quick reply!
I'd be quite happy to read the CSS files from the server rather than injecting
locally, but I know little about CSS and the website has a whole bunch that all
happily cross import things.

Hi Frank,

Usually the setup is that the CMS links to the CSS from the HTML. That is, the 
page
Delivered to the web browser contains lines like

   
   

This is actually from 
view-source:http://www.nukepedia.com/gizmos/filter/efibonacciglow. The web 
browser will then automatically try to download and apply e.g. 
http://www.nukepedia.com/components/com_jcomments/tpl/default/style.css?v=21 .

I understand that either your CMS is configured wrong, and doesn't include 
these links, or that you hit a bug in WebEngine where the css for a reason or 
the other is not fetched, or applied correctly. Can you clarify??


I have attached the css folder from the website as that will tell you more than
my ramblings

If it's possible to simply point QWebView to that online folder and make
sense of it on the fly, I would be perfectly happy.

See above - it is something that the .html page itself should link to. The 
QWebEngineSettings::setUserStyleSheetUrl you found is only a fallback, e.g. if 
you want to tweak the layout of pages you don't have any control over on the 
server side.


Otherwise I guess I will have to figure out how to merge all these things into
a master css.

As I mentioned already, you can also link from a CSS to another CSS by using 
the @import rule .

Regards

Kai


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


[Interest] QWebView and Joomla pages

2017-01-11 Thread Frank Rueter | OHUfx

Hi all,

this may be a long shot but i don't quite know where else to get help:

I am trying to use QWebView to display a part of a Joomla page like this 
one. 
Trouble is that I can't figure out how to deal with the required css 
files to ensure the widget looks like the browser.
Trouble is Joomla is a CMS and there are a bunch of CSS files that are 
used for any given page, and I don't know if QWebView can deal with that 
as well?
Is it possible to make QWebView interpret a chain of CSS files that may 
all import other ones?
E.g. could I somehow tell QWebView to load the CSS structures from the 
online page or do I have to provide  a single css and use it like this?


QWebView()settings().setUserStyleSheetUrl(QUrl.fromLocalFile(cssFile))


If the latter is the only way to get QT to utilise css information, then 
I need to find a way to bake and merge those online css files to 
generate one that I can use with QT, but maybe QT is cleverer than that?


Any pointers would be great as I am truly stuck with this (web stuff is 
not my strong side).


Cheers,
frank

--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


Re: [Interest] suppressing tooltips of all widgets

2017-01-11 Thread Frank Rueter | OHUfx

oops I was too trigger happy.
Installing the event filter on the top level widget triggers the filter 
_after_ the tooltips were shown for some reason.
Only when I install it on the QApplication instance do I get a chance to 
filter before the default event.


Oh well, back to using enter and leave events to install and remove the 
filter I guess.


On 12/01/17 1:43 PM, Frank Rueter | OHUfx wrote:

DOH, ignore that last bit.
I wrongly assumed that I need to install event filters to QApplication 
instances when in fact I can install them to any QObject.

So there is no need to mess with enter and leave events.
Nice

On 12/01/17 1:35 PM, Frank Rueter | OHUfx wrote:

Thanks guys, works perfectly.

Since my app will run inside of another host application I just need 
to make sure to install the event to QApplication.instance()
in my main widget's enterEvent and uninstall it again in the 
leaveEvent to avoid processing the host application's events.

But that should be ok, right?!

Thanks again!
frank


On 12/01/17 1:13 PM, william.croc...@analog.com wrote:

On 01/11/2017 06:37 PM, Frank Rueter | OHUfx wrote:

Thanks Giuseppe,
I will check out both those options and report back.

On 12/01/17 12:15 PM, Giuseppe D'Angelo wrote:

Il 12/01/2017 00:02, Frank Rueter | OHUfx ha scritto:
Is there any way to intercept a any tool tip even from anywhere 
in the app?

Install a global event filter on QApplication, and filter out all
QEvent::ToolTip events? (Never tried myself, so take it with a 
grain of

salt.)



Yes. That is how I have been doing it for years.

class GlobalEventFilter : public QObject {
Q_OBJECT
typedef QObject BaseClass;
  public:
GlobalEventFilter( QObject *parent ) : BaseClass(parent) { }
  protected:
bool eventFilter(QObject*,QEvent*);
};

bool
GlobalEventFilter::eventFilter( QObject *op, QEvent *ep ) {
if( ep->type() == QEvent::ToolTip && 
!CommandLineArg::s_DoToolTips )

return true;// Filter out.
return BaseClass::eventFilter(op,ep);
}

...
GlobalEventFilter *mp = new GlobalEventFilter(s_QtApp);
my_qt_app->installEventFilter(mp);
...

Bill


Another option: install a QProxyStyle and return a wait period for
showing tooltips ridiculously high (INT_MAX).

HTH,


___
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 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 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] suppressing tooltips of all widgets

2017-01-11 Thread Frank Rueter | OHUfx

DOH, ignore that last bit.
I wrongly assumed that I need to install event filters to QApplication 
instances when in fact I can install them to any QObject.

So there is no need to mess with enter and leave events.
Nice

On 12/01/17 1:35 PM, Frank Rueter | OHUfx wrote:

Thanks guys, works perfectly.

Since my app will run inside of another host application I just need 
to make sure to install the event to QApplication.instance()
in my main widget's enterEvent and uninstall it again in the 
leaveEvent to avoid processing the host application's events.

But that should be ok, right?!

Thanks again!
frank


On 12/01/17 1:13 PM, william.croc...@analog.com wrote:

On 01/11/2017 06:37 PM, Frank Rueter | OHUfx wrote:

Thanks Giuseppe,
I will check out both those options and report back.

On 12/01/17 12:15 PM, Giuseppe D'Angelo wrote:

Il 12/01/2017 00:02, Frank Rueter | OHUfx ha scritto:
Is there any way to intercept a any tool tip even from anywhere in 
the app?

Install a global event filter on QApplication, and filter out all
QEvent::ToolTip events? (Never tried myself, so take it with a 
grain of

salt.)



Yes. That is how I have been doing it for years.

class GlobalEventFilter : public QObject {
Q_OBJECT
typedef QObject BaseClass;
  public:
GlobalEventFilter( QObject *parent ) : BaseClass(parent) { }
  protected:
bool eventFilter(QObject*,QEvent*);
};

bool
GlobalEventFilter::eventFilter( QObject *op, QEvent *ep ) {
if( ep->type() == QEvent::ToolTip && !CommandLineArg::s_DoToolTips )
return true;// Filter out.
return BaseClass::eventFilter(op,ep);
}

...
GlobalEventFilter *mp = new GlobalEventFilter(s_QtApp);
my_qt_app->installEventFilter(mp);
...

Bill


Another option: install a QProxyStyle and return a wait period for
showing tooltips ridiculously high (INT_MAX).

HTH,


___
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 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 mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] suppressing tooltips of all widgets

2017-01-11 Thread Frank Rueter | OHUfx

Thanks guys, works perfectly.

Since my app will run inside of another host application I just need to 
make sure to install the event to QApplication.instance()
in my main widget's enterEvent and uninstall it again in the leaveEvent 
to avoid processing the host application's events.

But that should be ok, right?!

Thanks again!
frank


On 12/01/17 1:13 PM, william.croc...@analog.com wrote:

On 01/11/2017 06:37 PM, Frank Rueter | OHUfx wrote:

Thanks Giuseppe,
I will check out both those options and report back.

On 12/01/17 12:15 PM, Giuseppe D'Angelo wrote:

Il 12/01/2017 00:02, Frank Rueter | OHUfx ha scritto:
Is there any way to intercept a any tool tip even from anywhere in 
the app?

Install a global event filter on QApplication, and filter out all
QEvent::ToolTip events? (Never tried myself, so take it with a grain of
salt.)



Yes. That is how I have been doing it for years.

class GlobalEventFilter : public QObject {
Q_OBJECT
typedef QObject BaseClass;
  public:
GlobalEventFilter( QObject *parent ) : BaseClass(parent) { }
  protected:
bool eventFilter(QObject*,QEvent*);
};

bool
GlobalEventFilter::eventFilter( QObject *op, QEvent *ep ) {
if( ep->type() == QEvent::ToolTip && !CommandLineArg::s_DoToolTips )
return true;// Filter out.
return BaseClass::eventFilter(op,ep);
}

...
GlobalEventFilter *mp = new GlobalEventFilter(s_QtApp);
my_qt_app->installEventFilter(mp);
...

Bill


Another option: install a QProxyStyle and return a wait period for
showing tooltips ridiculously high (INT_MAX).

HTH,


___
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 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] suppressing tooltips of all widgets

2017-01-11 Thread Frank Rueter | OHUfx

Thanks Giuseppe,
I will check out both those options and report back.

On 12/01/17 12:15 PM, Giuseppe D'Angelo wrote:

Il 12/01/2017 00:02, Frank Rueter | OHUfx ha scritto:

Is there any way to intercept a any tool tip even from anywhere in the app?

Install a global event filter on QApplication, and filter out all
QEvent::ToolTip events? (Never tried myself, so take it with a grain of
salt.)

Another option: install a QProxyStyle and return a wait period for
showing tooltips ridiculously high (INT_MAX).

HTH,


___
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] suppressing tooltips of all widgets

2017-01-11 Thread Frank Rueter | OHUfx

Hi all,

what is the best way to suppress tool tips for all widgets in an app?
I have been asked to implement a user preference for showing tool tips 
and am reluctant to modify every single widget to check the preference 
before showing the tooltip.


I had hoped that I can maybe intercept the QHelpEvent on the top level 
widget, but that doesn't catch the child widget's events.


I also looked at intercepting topLevelWidget.childEvent(), but that is 
not recursive, so wouldn't catch all the nested widgets (and would 
probably lead to performance issues as well).


Is there any way to intercept a any tool tip even from anywhere in the app?

Cheers,
frank


--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


[Interest] suppressing "modalSession has been exited prematurely - check for a reentrant call to endModalSession:"

2017-01-10 Thread Frank Rueter | OHUfx

Hi all,

happy 2017!

In my current GUI code I have a few simple QDialogs that are called via 
their exec_() methods.
Unfortunately with the version of QT that I have to use there is this 
bug  that spits out this 
warning under OSX when such modal dialogs are closed again:
"modalSession has been exited prematurely - check for a reentrant 
call to endModalSession"



I may re-write the code to use QDialog.open() instead and refactor 
everything so use QDialog's respective signals.
But before I do that I thought I'd check in to see of there is an easy 
way to suppress this warning as it is benign afaik?!


Cheers,
frank


--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


[Interest] model/view: fetchMore with a QSortFilterProxyModel

2016-09-01 Thread Frank Rueter | OHUfx

Hi all,

I'm implementing a model using fetchMore, to retrieve data from a model 
on demand, which in my case means the model fetches more data as the 
user scrolls down a QListView.
Technically this works just fine, except that the scrollbar adjusts it's 
width every time it hits the bottom, to accommodate the increase in 
rowCount.
I suppose I need to re-implement some methods to take over control of 
the view's verticalScrollbar(), but I'm not quite sure how.
I suspect I should use the view's resizeEvent to set a static range for 
my scrollbar, but I also need to make it stop adjust itself every time 
fetchMore is called by the model.

Has anybody ever done this?

Also, and more importantly, is anybody aware of examples that show the 
use of a QAbstractListModel (or QAbstractItemModel in general) which 
deploys the fetchMore logic along a QSortFilterProxyModel?
Currently my filter results are quite unexpected after implementing 
fetchMore and I'm not quite sure where to start to fix this. Should I 
implement the fetchMore method on the proxy model rather than the source 
model?

I can't find any documentation or examples about this.

Any pointers would be much appreciated.

Cheers,
frank

--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


Re: [Interest] QListView: drag custom item

2016-08-17 Thread Frank Rueter | OHUfx
Thanks, but that still causes the default drag behaviour to drop a 
QStandardItem rather than the subclassed custom item that was dragged. 
It's not the data that is the issue but the class type itself.


I have now refactored my code to use QStdandardItem instead of a custom 
one which makes it all work, but I'd still be quite interested to know 
the best way to do this (drag a custom item between two QListViews 
in the same application).



Cheers,
frank

On 17/08/16 8:24 PM, Viktor Engelmann wrote:


The QStandardItem seems to be used to limit the drag to files, 
images, text etc. so that you can drag & drop from and to external 
applications (which is not possible for general objects).


http://doc.qt.io/qt-4.8/qstandarditem.html#subclassing says you should 
subclass QStandardItem and override read and write or data and 
setData. That is probably used to marshal and unmashal the objects, to 
make them compatible to text, which can be passed to and from external 
applications.


Viktor


On 16.08.2016 23:56, Frank Rueter | OHUfx wrote:

Anybody?
I can find plenty of examples on how to drag items from a view to a 
widget but can't find anything about dragging a custom item from one 
view to another.
Guess I will start to re-implement the entire drag, maybe the 
solution will become apparent then.



On 16/08/16 7:26 PM, Frank Rueter | OHUfx wrote:

Hi,

I am trying to get drag to work between two QListViews using a 
custom item.
I can't find the info I need online other than this document 
<https://doc.qt.io/archives/4.6/model-view-dnd.html> which helped a 
little bit but now I'm stuck.


Drag from one QListView to another works fine when I use a 
QStandardItem to hold my data, but when I use a custom item I run 
into trouble, because the receiving model/view creates a 
QStandardItem when the incoming custom items are dropped.


Ideally I could tell the receiving model to use my custom item as 
the default item and otherwise just do it's thing, but I suppose it 
won't be that easy?!
I have played around with the receiving model's dropMimeData() and 
insertRows() methods but can't work out how to read the incoming 
data to then insert a custom item into the receiving model manually.
In QAbstractItemModel.dropMimeData() I tried reading 
mimeData.data('application/x-qabstractitemmodeldatalist'), but that 
returns a byte stream that I don't know how to handle.


Do I have to re-implement the sender's drag data as well to send the 
custom item in the first place?


It seems that everything works out of the box except the creation of 
the QStandardItem upon drop, rather than my custom item, so I am 
hoping I don't have to re-invent the (drag) wheel just to get 
that one part right?!


Any advise would be greatly appreciated.

Thanks,
frank



--
ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
<http://ohufx.com/index.php/vfx-compositing> | *workflow 
customisation and consulting 
<http://ohufx.com/index.php/vfx-customising>* *




___
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


--


Viktor Engelmann
Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
viktor.engelm...@qt.io
+49 151 26784521
http://qt.io

Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht 
Charlottenburg, HRB 144331 B

<http://qt.io>
<http://www.facebook.com/Qt> 	<http://www.twitter.com/qtproject> 
<https://www.linkedin.com/company/the-qt-company/> 
<https://plus.google.com/104580575722059274792> 
<https://www.youtube.com/QtStudios>




___
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] QListView: drag custom item

2016-08-16 Thread Frank Rueter | OHUfx

Anybody?
I can find plenty of examples on how to drag items from a view to a 
widget but can't find anything about dragging a custom item from one 
view to another.
Guess I will start to re-implement the entire drag, maybe the 
solution will become apparent then.



On 16/08/16 7:26 PM, Frank Rueter | OHUfx wrote:

Hi,

I am trying to get drag to work between two QListViews using a 
custom item.
I can't find the info I need online other than this document 
<https://doc.qt.io/archives/4.6/model-view-dnd.html> which helped a 
little bit but now I'm stuck.


Drag from one QListView to another works fine when I use a 
QStandardItem to hold my data, but when I use a custom item I run into 
trouble, because the receiving model/view creates a QStandardItem when 
the incoming custom items are dropped.


Ideally I could tell the receiving model to use my custom item as the 
default item and otherwise just do it's thing, but I suppose it won't 
be that easy?!
I have played around with the receiving model's dropMimeData() and 
insertRows() methods but can't work out how to read the incoming data 
to then insert a custom item into the receiving model manually.
In QAbstractItemModel.dropMimeData() I tried reading 
mimeData.data('application/x-qabstractitemmodeldatalist'), but that 
returns a byte stream that I don't know how to handle.


Do I have to re-implement the sender's drag data as well to send the 
custom item in the first place?


It seems that everything works out of the box except the creation of 
the QStandardItem upon drop, rather than my custom item, so I am 
hoping I don't have to re-invent the (drag) wheel just to get 
that one part right?!


Any advise would be greatly appreciated.

Thanks,
frank



--
ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation 
and consulting <http://ohufx.com/index.php/vfx-customising>* *




___
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] QListView: drag custom item

2016-08-16 Thread Frank Rueter | OHUfx

Hi,

I am trying to get drag to work between two QListViews using a 
custom item.
I can't find the info I need online other than this document 
 which helped a 
little bit but now I'm stuck.


Drag from one QListView to another works fine when I use a 
QStandardItem to hold my data, but when I use a custom item I run into 
trouble, because the receiving model/view creates a QStandardItem when 
the incoming custom items are dropped.


Ideally I could tell the receiving model to use my custom item as the 
default item and otherwise just do it's thing, but I suppose it won't be 
that easy?!
I have played around with the receiving model's dropMimeData() and 
insertRows() methods but can't work out how to read the incoming data to 
then insert a custom item into the receiving model manually.
In QAbstractItemModel.dropMimeData() I tried reading 
mimeData.data('application/x-qabstractitemmodeldatalist'), but that 
returns a byte stream that I don't know how to handle.


Do I have to re-implement the sender's drag data as well to send the 
custom item in the first place?


It seems that everything works out of the box except the creation of the 
QStandardItem upon drop, rather than my custom item, so I am hoping I 
don't have to re-invent the (drag) wheel just to get that one part 
right?!


Any advise would be greatly appreciated.

Thanks,
frank



--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


Re: [Interest] item edit on mouse over - was: dynamic widget creation in QScrollArea

2016-08-11 Thread Frank Rueter | OHUfx

Quick follow up (as usual):

The problem is that the view's mouseMoveEvent fires faster than the 
MyMovie() widget's leaveEvent can trigger the emission of the 
closeEditor signal.
In other words I have to somehow refactor the code to ensure that the 
current editor is closed before the new one is opened.




On 12/08/16 2:12 PM, Frank Rueter | OHUfx wrote:

So I made some progress here:
I am now using the QListView's mouseMoveEvent() to get the item under 
the mouse and edit() it:


def mouseMoveEvent(self, event):

'''Find item under mouse and pop it into edit mode'''
index = self.indexAt(event.pos())
if index.isValid():
self.edit(index)
super(ElementView, self).mouseMoveEvent(event)

In my Delegate's createEditor() method I have this:

def createEditor(self, parent, option, index):
proxyModel = index.model()
item = 
proxyModel.sourceModel().itemFromIndex(proxyModel.mapToSource(index))

currentEditor = *MyMovie*(item, parent=parent)

currentEditor.*mouseLeftWidget*.connect(self.emitCloseEditorSignal)

return currentEditor

The *MyMovie() *class has a leaveEvent that emits the 
*mouseLeftWidget* signal.



The above works and the various instances of MyMovie() play back on 
mouse over inside my QWLIstView and stop when the mouse leaves them, 
but for some reason I still get "edit: editing failed" messages when I 
move the mouse around quickly.
I don't get those messages when I move the mouse slowly though, which 
is interesting.


Does anybody have an idea why that would be?

Cheers,
frank



On 9/08/16 5:50 PM, Frank Rueter | OHUfx wrote:

And one more follow up:
I just tried this in my view class:
def mouseMoveEvent(self, event):
'''Find item under mouse and pop it into edit mode'''
index = self.indexAt(event.pos())
self.edit(index)

This successfully pops the first item under the mouse into edit mode, 
but as I keep moving the cursor around I just get:

edit: editing failed

This one stumped me yesterday as well when I tried to use the 
Delegate's paint method to trigger it's editor on mouse over.


Does anybody have any ideas how to start editing on mouse over with 
delegates and list views?


Cheers,
frank



On 9/08/16 5:27 pm, Frank Rueter | OHUfx wrote:
Ok, so after some more experimenting I am fairly certain that using 
seItemWidget inside the delegate's paint event is a bad idea.
My second approach seems more promising so far: Using the custom 
movie player widget as the delegate's editor, even though I don't 
actually want to edit anything.
However, since I need the movie player to start playing on mouse 
over, I need to work out how to pop the item under the mouse into 
edit() mode (and finish editing when the mouse leaves the item).
After googling a bit it seems a few others have tried this but to no 
avail.


Any ideas on that one?

Cheers,
frank

On 8/08/16 4:28 pm, Frank Rueter | OHUfx wrote:

Hi Bo,

I have followed your advise and gone back to QListView with a delegate.
My first test was to render the custom widget I need via the 
delegate paint method. This populates a static version of the movie 
player (the custom widget I need).
Then, also in the delegate's paint method, I use setItemWidget if 
the mouse hovers over the item, to get the fully fledged and 
interactive widget.
This seems to be promising but it kinda feels wrong to set an item 
widget in the paint method. Should I worry?


Also, I can't get the rendered image to line up with the item 
widget itself. The render seems to have the correct size but the 
widget, when the mouse hovers over the item, is slightly off, 
causing the item to pop a little and leave out-of-date paint 
artifacts when the mouse leaves again.


Below is my test code for the delegate.

Now I am wondering if the below approach is acceptable (setting an 
item widget inside the delegate's paint event).
Alternatively I'm wondering if I could/should use the delegate's 
createEditor method to display the widgets of all visible items to 
achieve the same thing (which is full interactive and animated 
widget in all visible items). I have, however, not been able to 
figure out how to call the editor on mouse enter, which I need 
because the movie is supposed to play when the mouse hovers over it.


Any opinions on this?

Cheers,
frank


class DelegateOld(QtGui.QItemDelegate):

def __init__(self, parent = None):

super(Delegate, self).__init__(parent)
self.thumbnail = None

def paint(self, painter, option, index):
item = index.model().itemFromIndex(index)
self.thumbnail = MyMovie(item)

if option.state & QtGui.QStyle.State_MouseOver:
# swap render for actual widget here. So the user can 
interact with it - doesn't feel right though to do this in the 
paint event

existingThumb = self.view.indexWidget(index)
if not

Re: [Interest] item edit on mouse over - was: dynamic widget creation in QScrollArea

2016-08-11 Thread Frank Rueter | OHUfx

So I made some progress here:
I am now using the QListView's mouseMoveEvent() to get the item under 
the mouse and edit() it:


def mouseMoveEvent(self, event):

'''Find item under mouse and pop it into edit mode'''
index = self.indexAt(event.pos())
if index.isValid():
self.edit(index)
super(ElementView, self).mouseMoveEvent(event)

In my Delegate's createEditor() method I have this:

def createEditor(self, parent, option, index):
proxyModel = index.model()
item = 
proxyModel.sourceModel().itemFromIndex(proxyModel.mapToSource(index))

currentEditor = *MyMovie*(item, parent=parent)
currentEditor.*mouseLeftWidget*.connect(self.emitCloseEditorSignal)
return currentEditor

The *MyMovie() *class has a leaveEvent that emits the *mouseLeftWidget* 
signal.



The above works and the various instances of MyMovie() play back on 
mouse over inside my QWLIstView and stop when the mouse leaves them, but 
for some reason I still get "edit: editing failed" messages when I move 
the mouse around quickly.
I don't get those messages when I move the mouse slowly though, which is 
interesting.


Does anybody have an idea why that would be?

Cheers,
frank



On 9/08/16 5:50 PM, Frank Rueter | OHUfx wrote:

And one more follow up:
I just tried this in my view class:
def mouseMoveEvent(self, event):
'''Find item under mouse and pop it into edit mode'''
index = self.indexAt(event.pos())
self.edit(index)

This successfully pops the first item under the mouse into edit mode, 
but as I keep moving the cursor around I just get:

edit: editing failed

This one stumped me yesterday as well when I tried to use the 
Delegate's paint method to trigger it's editor on mouse over.


Does anybody have any ideas how to start editing on mouse over with 
delegates and list views?


Cheers,
frank



On 9/08/16 5:27 pm, Frank Rueter | OHUfx wrote:
Ok, so after some more experimenting I am fairly certain that using 
seItemWidget inside the delegate's paint event is a bad idea.
My second approach seems more promising so far: Using the custom 
movie player widget as the delegate's editor, even though I don't 
actually want to edit anything.
However, since I need the movie player to start playing on mouse 
over, I need to work out how to pop the item under the mouse into 
edit() mode (and finish editing when the mouse leaves the item).
After googling a bit it seems a few others have tried this but to no 
avail.


Any ideas on that one?

Cheers,
frank

On 8/08/16 4:28 pm, Frank Rueter | OHUfx wrote:

Hi Bo,

I have followed your advise and gone back to QListView with a delegate.
My first test was to render the custom widget I need via the 
delegate paint method. This populates a static version of the movie 
player (the custom widget I need).
Then, also in the delegate's paint method, I use setItemWidget if 
the mouse hovers over the item, to get the fully fledged and 
interactive widget.
This seems to be promising but it kinda feels wrong to set an item 
widget in the paint method. Should I worry?


Also, I can't get the rendered image to line up with the item widget 
itself. The render seems to have the correct size but the widget, 
when the mouse hovers over the item, is slightly off, causing the 
item to pop a little and leave out-of-date paint artifacts when the 
mouse leaves again.


Below is my test code for the delegate.

Now I am wondering if the below approach is acceptable (setting an 
item widget inside the delegate's paint event).
Alternatively I'm wondering if I could/should use the delegate's 
createEditor method to display the widgets of all visible items to 
achieve the same thing (which is full interactive and animated 
widget in all visible items). I have, however, not been able to 
figure out how to call the editor on mouse enter, which I need 
because the movie is supposed to play when the mouse hovers over it.


Any opinions on this?

Cheers,
frank


class DelegateOld(QtGui.QItemDelegate):

def __init__(self, parent = None):

super(Delegate, self).__init__(parent)
self.thumbnail = None

def paint(self, painter, option, index):
item = index.model().itemFromIndex(index)
self.thumbnail = MyMovie(item)

if option.state & QtGui.QStyle.State_MouseOver:
# swap render for actual widget here. So the user can 
interact with it - doesn't feel right though to do this in the paint 
event

existingThumb = self.view.indexWidget(index)
if not existingThumb:
self.view.setIndexWidget(index, self.thumbnail)
else:
self.thumbnail.render(painter, 
QtCore.QPoint(option.rect.x(), option.rect.y()))


def sizeHint(self, option, index):
return MyMovie.thumbSize

On 4/08/16 8:36 pm, Bo Thorsen wrote:

Den 04-08-2016 kl. 10:05 skrev Frank Rueter | OHUfx:

I am playing with the idea of wr

Re: [Interest] item edit on mouse over - was: dynamic widget creation in QScrollArea

2016-08-09 Thread Frank Rueter | OHUfx

Hi Volker,

that doesn't sound like a bad idea at all I think, though I'm no QT 
expert myself.

I will try that tomorrow, thanks.



On 9/08/16 5:57 pm, Volker Siepmann wrote:

I'm quite new to qt, so please set me straight if this is nonsense:
Can you use the blockSignals(True) method once the event was called, 
so it doesn't try to open it multiple times as you continue hovering?
Then you need to catch the event of editor closing, so you can enable 
the signals again by blockSignals(False).

​


--
ohufxLogo 50x50 

*vfx for storytellers *

*vfx compositing  | 
*workflow customisation & consulting 
**


*W E L L I N G T O N|N E W   Z E A L A N D *

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


Re: [Interest] item edit on mouse over - was: dynamic widget creation in QScrollArea

2016-08-08 Thread Frank Rueter | OHUfx

And one more follow up:
I just tried this in my view class:
def mouseMoveEvent(self, event):
'''Find item under mouse and pop it into edit mode'''
index = self.indexAt(event.pos())
self.edit(index)

This successfully pops the first item under the mouse into edit mode, 
but as I keep moving the cursor around I just get:

edit: editing failed

This one stumped me yesterday as well when I tried to use the Delegate's 
paint method to trigger it's editor on mouse over.


Does anybody have any ideas how to start editing on mouse over with 
delegates and list views?


Cheers,
frank



On 9/08/16 5:27 pm, Frank Rueter | OHUfx wrote:
Ok, so after some more experimenting I am fairly certain that using 
seItemWidget inside the delegate's paint event is a bad idea.
My second approach seems more promising so far: Using the custom movie 
player widget as the delegate's editor, even though I don't actually 
want to edit anything.
However, since I need the movie player to start playing on mouse over, 
I need to work out how to pop the item under the mouse into edit() 
mode (and finish editing when the mouse leaves the item).
After googling a bit it seems a few others have tried this but to no 
avail.


Any ideas on that one?

Cheers,
frank

On 8/08/16 4:28 pm, Frank Rueter | OHUfx wrote:

Hi Bo,

I have followed your advise and gone back to QListView with a delegate.
My first test was to render the custom widget I need via the delegate 
paint method. This populates a static version of the movie player 
(the custom widget I need).
Then, also in the delegate's paint method, I use setItemWidget if the 
mouse hovers over the item, to get the fully fledged and interactive 
widget.
This seems to be promising but it kinda feels wrong to set an item 
widget in the paint method. Should I worry?


Also, I can't get the rendered image to line up with the item widget 
itself. The render seems to have the correct size but the widget, 
when the mouse hovers over the item, is slightly off, causing the 
item to pop a little and leave out-of-date paint artifacts when the 
mouse leaves again.


Below is my test code for the delegate.

Now I am wondering if the below approach is acceptable (setting an 
item widget inside the delegate's paint event).
Alternatively I'm wondering if I could/should use the delegate's 
createEditor method to display the widgets of all visible items to 
achieve the same thing (which is full interactive and animated widget 
in all visible items). I have, however, not been able to figure out 
how to call the editor on mouse enter, which I need because the movie 
is supposed to play when the mouse hovers over it.


Any opinions on this?

Cheers,
frank


class DelegateOld(QtGui.QItemDelegate):

def __init__(self, parent = None):

super(Delegate, self).__init__(parent)
self.thumbnail = None

def paint(self, painter, option, index):
item = index.model().itemFromIndex(index)
self.thumbnail = MyMovie(item)

if option.state & QtGui.QStyle.State_MouseOver:
# swap render for actual widget here. So the user can 
interact with it - doesn't feel right though to do this in the paint 
event

existingThumb = self.view.indexWidget(index)
if not existingThumb:
self.view.setIndexWidget(index, self.thumbnail)
else:
self.thumbnail.render(painter, 
QtCore.QPoint(option.rect.x(), option.rect.y()))


def sizeHint(self, option, index):
return MyMovie.thumbSize

On 4/08/16 8:36 pm, Bo Thorsen wrote:

Den 04-08-2016 kl. 10:05 skrev Frank Rueter | OHUfx:

I am playing with the idea of writing a custom widget based on
QScrollArea, where widgets are created as the user scrolls.
I'm just hoping to bounce the general idea of you guys here to see if
I'm heading in the right direction:

I have a heap of custom widgets, potentially thousands, depending 
on the

contents of a database.
I'd like to show them in a grid that fits as many widgets horizontally
as will fit in the current window size (dynamic).
I would also like smooth vertical scrolling.

If I create a single parent widget with a grid layout that creates all
widgets on start up, it takes ages.
So I'm thinking if I use the child widgets' visibleRegion() to find 
the

ones currently visible in the scroll area, then figure out the indexes
of the widgets in the rows above and below to create them dynamically,
that should speed up the startup and still provide smooth scrolling.

Obviously I'd have to manually scale the scroll area based on the
maximum amount of widgets and the parent widget's width to get an
indicative scrollbar.
Not sure how tricky that will be.

Does that sound crazy or doable?

Basically I am trying to re-create the behavior of a QListView in icon
mode. I tried using QListView with delegates, but couldn't get the
delegates to provide the kind of complexity I need for the child 
widgets

which I have alr

Re: [Interest] item edit on mouse over - was: dynamic widget creation in QScrollArea

2016-08-08 Thread Frank Rueter | OHUfx
Ok, so after some more experimenting I am fairly certain that using 
seItemWidget inside the delegate's paint event is a bad idea.
My second approach seems more promising so far: Using the custom movie 
player widget as the delegate's editor, even though I don't actually 
want to edit anything.
However, since I need the movie player to start playing on mouse over, I 
need to work out how to pop the item under the mouse into edit() mode 
(and finish editing when the mouse leaves the item).

After googling a bit it seems a few others have tried this but to no avail.

Any ideas on that one?

Cheers,
frank

On 8/08/16 4:28 pm, Frank Rueter | OHUfx wrote:

Hi Bo,

I have followed your advise and gone back to QListView with a delegate.
My first test was to render the custom widget I need via the delegate 
paint method. This populates a static version of the movie player (the 
custom widget I need).
Then, also in the delegate's paint method, I use setItemWidget if the 
mouse hovers over the item, to get the fully fledged and interactive 
widget.
This seems to be promising but it kinda feels wrong to set an item 
widget in the paint method. Should I worry?


Also, I can't get the rendered image to line up with the item widget 
itself. The render seems to have the correct size but the widget, when 
the mouse hovers over the item, is slightly off, causing the item to 
pop a little and leave out-of-date paint artifacts when the mouse 
leaves again.


Below is my test code for the delegate.

Now I am wondering if the below approach is acceptable (setting an 
item widget inside the delegate's paint event).
Alternatively I'm wondering if I could/should use the delegate's 
createEditor method to display the widgets of all visible items to 
achieve the same thing (which is full interactive and animated widget 
in all visible items). I have, however, not been able to figure out 
how to call the editor on mouse enter, which I need because the movie 
is supposed to play when the mouse hovers over it.


Any opinions on this?

Cheers,
frank


class DelegateOld(QtGui.QItemDelegate):

def __init__(self, parent = None):

super(Delegate, self).__init__(parent)
self.thumbnail = None

def paint(self, painter, option, index):
item = index.model().itemFromIndex(index)
self.thumbnail = MyMovie(item)

if option.state & QtGui.QStyle.State_MouseOver:
# swap render for actual widget here. So the user can 
interact with it - doesn't feel right though to do this in the paint event

existingThumb = self.view.indexWidget(index)
if not existingThumb:
self.view.setIndexWidget(index, self.thumbnail)
else:
self.thumbnail.render(painter, 
QtCore.QPoint(option.rect.x(), option.rect.y()))


def sizeHint(self, option, index):
return MyMovie.thumbSize

On 4/08/16 8:36 pm, Bo Thorsen wrote:

Den 04-08-2016 kl. 10:05 skrev Frank Rueter | OHUfx:

I am playing with the idea of writing a custom widget based on
QScrollArea, where widgets are created as the user scrolls.
I'm just hoping to bounce the general idea of you guys here to see if
I'm heading in the right direction:

I have a heap of custom widgets, potentially thousands, depending on 
the

contents of a database.
I'd like to show them in a grid that fits as many widgets horizontally
as will fit in the current window size (dynamic).
I would also like smooth vertical scrolling.

If I create a single parent widget with a grid layout that creates all
widgets on start up, it takes ages.
So I'm thinking if I use the child widgets' visibleRegion() to find the
ones currently visible in the scroll area, then figure out the indexes
of the widgets in the rows above and below to create them dynamically,
that should speed up the startup and still provide smooth scrolling.

Obviously I'd have to manually scale the scroll area based on the
maximum amount of widgets and the parent widget's width to get an
indicative scrollbar.
Not sure how tricky that will be.

Does that sound crazy or doable?

Basically I am trying to re-create the behavior of a QListView in icon
mode. I tried using QListView with delegates, but couldn't get the
delegates to provide the kind of complexity I need for the child 
widgets

which I have already written (which are basically mini movie players
that can be drag and have playback all at once on demand).

Any thoughts on this before I dive into this little experiment?


I don't think that sounds unreasonable. If I were you, I would try 
very hard to stay with QListView instead, but other than that it 
doesn't sound hard to do. Time consuming, yes, but not difficult.


Bo Thorsen,
Director, Viking Software.



--
ohufxLogo 50x50 <http://www.ohufx.com>

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | 
*workflow customisation & consulting 
<http://ohufx.com/index.php/

Re: [Interest] dynamic widget creation in QScrollArea

2016-08-07 Thread Frank Rueter | OHUfx

Hi Bo,

I have followed your advise and gone back to QListView with a delegate.
My first test was to render the custom widget I need via the delegate 
paint method. This populates a static version of the movie player (the 
custom widget I need).
Then, also in the delegate's paint method, I use setItemWidget if the 
mouse hovers over the item, to get the fully fledged and interactive widget.
This seems to be promising but it kinda feels wrong to set an item 
widget in the paint method. Should I worry?


Also, I can't get the rendered image to line up with the item widget 
itself. The render seems to have the correct size but the widget, when 
the mouse hovers over the item, is slightly off, causing the item to pop 
a little and leave out-of-date paint artifacts when the mouse leaves again.


Below is my test code for the delegate.

Now I am wondering if the below approach is acceptable (setting an item 
widget inside the delegate's paint event).
Alternatively I'm wondering if I could/should use the delegate's 
createEditor method to display the widgets of all visible items to 
achieve the same thing (which is full interactive and animated widget in 
all visible items). I have, however, not been able to figure out how to 
call the editor on mouse enter, which I need because the movie is 
supposed to play when the mouse hovers over it.


Any opinions on this?

Cheers,
frank


class DelegateOld(QtGui.QItemDelegate):

def __init__(self, parent = None):

super(Delegate, self).__init__(parent)
self.thumbnail = None

def paint(self, painter, option, index):
item = index.model().itemFromIndex(index)
self.thumbnail = MyMovie(item)

if option.state & QtGui.QStyle.State_MouseOver:
# swap render for actual widget here. So the user can 
interact with it - doesn't feel right though to do this in the paint event

existingThumb = self.view.indexWidget(index)
if not existingThumb:
self.view.setIndexWidget(index, self.thumbnail)
else:
self.thumbnail.render(painter, 
QtCore.QPoint(option.rect.x(), option.rect.y()))


def sizeHint(self, option, index):
return MyMovie.thumbSize

On 4/08/16 8:36 pm, Bo Thorsen wrote:

Den 04-08-2016 kl. 10:05 skrev Frank Rueter | OHUfx:

I am playing with the idea of writing a custom widget based on
QScrollArea, where widgets are created as the user scrolls.
I'm just hoping to bounce the general idea of you guys here to see if
I'm heading in the right direction:

I have a heap of custom widgets, potentially thousands, depending on the
contents of a database.
I'd like to show them in a grid that fits as many widgets horizontally
as will fit in the current window size (dynamic).
I would also like smooth vertical scrolling.

If I create a single parent widget with a grid layout that creates all
widgets on start up, it takes ages.
So I'm thinking if I use the child widgets' visibleRegion() to find the
ones currently visible in the scroll area, then figure out the indexes
of the widgets in the rows above and below to create them dynamically,
that should speed up the startup and still provide smooth scrolling.

Obviously I'd have to manually scale the scroll area based on the
maximum amount of widgets and the parent widget's width to get an
indicative scrollbar.
Not sure how tricky that will be.

Does that sound crazy or doable?

Basically I am trying to re-create the behavior of a QListView in icon
mode. I tried using QListView with delegates, but couldn't get the
delegates to provide the kind of complexity I need for the child widgets
which I have already written (which are basically mini movie players
that can be drag and have playback all at once on demand).

Any thoughts on this before I dive into this little experiment?


I don't think that sounds unreasonable. If I were you, I would try 
very hard to stay with QListView instead, but other than that it 
doesn't sound hard to do. Time consuming, yes, but not difficult.


Bo Thorsen,
Director, Viking Software.



--
ohufxLogo 50x50 <http://www.ohufx.com>

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | 
*workflow customisation & consulting 
<http://ohufx.com/index.php/vfx-customising>**


*W E L L I N G T O N|N E W   Z E A L A N D *

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


Re: [Interest] dynamic widget creation in QScrollArea

2016-08-05 Thread Frank Rueter | OHUfx

Thanks Reto,

I'm not entirely certain I understand your example (I'm using Python).
I'm not quite sure yet how I would instantiate the widgets based on 
their visibility yet, but will think about it again if I can't get the 
QDelegate to work with animation.


Cheers,
frank

On 5/08/16 1:09 am, Reto Tschofenig, ODT Informatik GmbH wrote:

Hi Frank

if the children are the same type and it's like a table, I would 
recommend the following alternative:


don't inherit from it QScrollArea but instantiate as many child 
widget's as visible. bind now the child-widgets depending of the 
position of the scrollbar with the object.


> widgets horizontally
my example is vertical, but you could adapt it...

+- ListView +
| +- Viewport + +-+ |
| | +- 1. ItemView -+ | |s| |
| | + Edit Label or whatever| | |c| |
| | +---+ | |r| |
| | +- 2. ItemView -+ | |o| |
| | + Edit Label or whatever| | |l| |
| | +---+ | |l| |
| | +- 3. ItemView -+ | |b| |
| | + Edit Label or whatever| | |a| |
| | +---+ | |r| |
| | +- 4. ItemView -+ | | | |
| | + Edit Label or whatever| | | | |
| | +---+ | | | |
| +---+ +-+ |
+---+

class ListView : QWidget{
  QWidget* _viewport; // the parent for the ItemView's
  QScrollBar* _scrollbar;
  QList _items;
  int _scrollPosition;
  QList _objects;
}
class ItemView : QWidget{
  Object* _object;
  QLineEdit* _someEdits;
  void bind( Object* object );
}

> smooth vertical scrolling
Of course, the child-widgets could be also pixel accuracy moved.

> QListView in icon mode
replace the QLineEdit with a Icon-Widget or Label or paint it in 
ItemView directly.


good luck
Reto



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


--
ohufxLogo 50x50 

*vfx for storytellers *

*vfx compositing  | 
*workflow customisation & consulting 
**


*W E L L I N G T O N|N E W   Z E A L A N D *

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


Re: [Interest] dynamic widget creation in QScrollArea

2016-08-05 Thread Frank Rueter | OHUfx

Thanks bo,

I will have  a look at QListView and delegates instead. I'd love to get 
that to work as it has so many things for free that I will want to utilise.


I am having trouble though with creating a delegate that makes every 
item behave like my custom widget.
E.g. The widget/item is like a QMovie instance that plays back on mouse 
over, has it's own QSlider to scrub through the movie and can be 
dragged/dropped.


I will give it another shot and might be back for more help...

Thanks,
frank

On 4/08/16 8:36 pm, Bo Thorsen wrote:

Den 04-08-2016 kl. 10:05 skrev Frank Rueter | OHUfx:

I am playing with the idea of writing a custom widget based on
QScrollArea, where widgets are created as the user scrolls.
I'm just hoping to bounce the general idea of you guys here to see if
I'm heading in the right direction:

I have a heap of custom widgets, potentially thousands, depending on the
contents of a database.
I'd like to show them in a grid that fits as many widgets horizontally
as will fit in the current window size (dynamic).
I would also like smooth vertical scrolling.

If I create a single parent widget with a grid layout that creates all
widgets on start up, it takes ages.
So I'm thinking if I use the child widgets' visibleRegion() to find the
ones currently visible in the scroll area, then figure out the indexes
of the widgets in the rows above and below to create them dynamically,
that should speed up the startup and still provide smooth scrolling.

Obviously I'd have to manually scale the scroll area based on the
maximum amount of widgets and the parent widget's width to get an
indicative scrollbar.
Not sure how tricky that will be.

Does that sound crazy or doable?

Basically I am trying to re-create the behavior of a QListView in icon
mode. I tried using QListView with delegates, but couldn't get the
delegates to provide the kind of complexity I need for the child widgets
which I have already written (which are basically mini movie players
that can be drag and have playback all at once on demand).

Any thoughts on this before I dive into this little experiment?


I don't think that sounds unreasonable. If I were you, I would try 
very hard to stay with QListView instead, but other than that it 
doesn't sound hard to do. Time consuming, yes, but not difficult.


Bo Thorsen,
Director, Viking Software.



--
ohufxLogo 50x50 <http://www.ohufx.com>

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | 
*workflow customisation & consulting 
<http://ohufx.com/index.php/vfx-customising>**


*W E L L I N G T O N|N E W   Z E A L A N D *

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


[Interest] dynamic widget creation in QScrollArea

2016-08-04 Thread Frank Rueter | OHUfx

Hi all,

I am playing with the idea of writing a custom widget based on 
QScrollArea, where widgets are created as the user scrolls.
I'm just hoping to bounce the general idea of you guys here to see if 
I'm heading in the right direction:


I have a heap of custom widgets, potentially thousands, depending on the 
contents of a database.
I'd like to show them in a grid that fits as many widgets horizontally 
as will fit in the current window size (dynamic).

I would also like smooth vertical scrolling.

If I create a single parent widget with a grid layout that creates all 
widgets on start up, it takes ages.
So I'm thinking if I use the child widgets' visibleRegion() to find the 
ones currently visible in the scroll area, then figure out the indexes 
of the widgets in the rows above and below to create them dynamically, 
that should speed up the startup and still provide smooth scrolling.


Obviously I'd have to manually scale the scroll area based on the 
maximum amount of widgets and the parent widget's width to get an 
indicative scrollbar.

Not sure how tricky that will be.

Does that sound crazy or doable?

Basically I am trying to re-create the behavior of a QListView in icon 
mode. I tried using QListView with delegates, but couldn't get the 
delegates to provide the kind of complexity I need for the child widgets 
which I have already written (which are basically mini movie players 
that can be drag and have playback all at once on demand).


Any thoughts on this before I dive into this little experiment?

Cheers,
frank


--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


Re: [Interest] mirroring and reversing QMovie

2016-07-13 Thread Frank Rueter | OHUfx

Yeah, true.
It may not be an issue though, as this is to preview a bunch of small, 
animated thumbnails of fairly short video clips for a library interface, 
not for playing back long, high resolution, high quality movies.


However, if there are ideas on how to make this more efficient I'd be 
more than happy to learn.

This is what I got for so far:
https://gitlab.com/snippets/22447


Cheers,
frank

On 07/14/2016 12:18 PM, Thiago Macieira wrote:

Em quinta-feira, 14 de julho de 2016, às 11:41:12 PDT, Frank Rueter | OHUfx
escreveu:

Thanks.
What I'm currently exploring is using QImageReader, caching the frames
via read() and basically implementing basic play back functions with
timers in a custom paintEvent. That way I should have full control over
which image is displayed when.
Probably won't be the most efficient considering my lack of experience
with those sort of things but I will cross that bridge when I get there :)

No, it's not.

You're basically describing MJPEG, a movie format made up of a sequence of
JPEG-compressed frames. That's older than and produces movies that are less
well compressed than MPEG1, which in turn is older than MPEG 2 (used on DVDs
and most of the world's digital TV broadcasts), which is older than MPEG 4,
which in turn is not as efficient than MPEG 4 Advanced Video Codec a.k.a. H.264.
You'll get none of the improvements made over the last 20 years of video
coding.



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


Re: [Interest] mirroring and reversing QMovie

2016-07-13 Thread Frank Rueter | OHUfx

Thanks.
What I'm currently exploring is using QImageReader, caching the frames 
via read() and basically implementing basic play back functions with 
timers in a custom paintEvent. That way I should have full control over 
which image is displayed when.
Probably won't be the most efficient considering my lack of experience 
with those sort of things but I will cross that bridge when I get there :)


Cheers,
frank

On 14/07/16 3:46 am, Thiago Macieira wrote:

Em quarta-feira, 13 de julho de 2016, às 14:09:33 PDT, Frank Rueter | OHUfx
escreveu:

Yup, I know all that, but once you cache a movie you can do that though
(because it takes care of what you describe).
It's a feature I need, and it will cost memory for sure, but that's the
app I need to write.

QMovie can't do that.

You probably need to go down to the video decoder API yourself and see if it
has an API to cache hundreds of frames in some way.

It might not even be permitted by DRM on your OS.



--
ohufxLogo 50x50 <http://www.ohufx.com>

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | 
*workflow customisation & consulting 
<http://ohufx.com/index.php/vfx-customising>**


*W E L L I N G T O N|N E W   Z E A L A N D *

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


Re: [Interest] mirroring and reversing QMovie

2016-07-13 Thread Frank Rueter | OHUfx
Yup, I know all that, but once you cache a movie you can do that though 
(because it takes care of what you describe).
It's a feature I need, and it will cost memory for sure, but that's the 
app I need to write.



Cheers,
frank

On 12/07/16 5:38 pm, Thiago Macieira wrote:

On terça-feira, 12 de julho de 2016 15:48:47 PDT Frank Rueter | OHUfx wrote:

Hi all,

I am wondering how to mirror a cached QMovie object horizontally and
vertically and how to play it in reverse.
Is this even achievable with QMovie? If not could it be achieved by
manipulating the IODevice somehow?
I can't find a single thing online about this sort of thing.

Forget about playing it in reverse. Movie files are encoded in such a way that
the frame N+1 depends on the rendering of frame N. To play in reverse, you
need to render all of the non-key frames, store them in memory, then display
them.

That's why rewinding on moving players is usually choppy, while fast-forward
can be smooth: rewinding often simply displays the key frames.



--
ohufxLogo 50x50 <http://www.ohufx.com>

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | 
*workflow customisation & consulting 
<http://ohufx.com/index.php/vfx-customising>**


*W E L L I N G T O N|N E W   Z E A L A N D *

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


[Interest] mirroring and reversing QMovie

2016-07-11 Thread Frank Rueter | OHUfx

Hi all,

I am wondering how to mirror a cached QMovie object horizontally and 
vertically and how to play it in reverse.
Is this even achievable with QMovie? If not could it be achieved by 
manipulating the IODevice somehow?

I can't find a single thing online about this sort of thing.

Cheers,
frank

--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation 
and consulting * *


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


  1   2   >