Thanks Matthieu, much appreciated!
That seems so obvious now that I see it :-D

I have to admit that I am now considering using the context menu and customising that, since it already displays the behaviour I am after (single click to open and close when you click off).

Good to have both options though, so thanks again!

Cheers,
frank

On 3/05/18 8:09 PM, Matthieu Cadet wrote:

Oups forgot the markdown highlight :P

Don’t know if it’s the right way but I got it work using this:

|else: # Can't get this to work. I want to close the editor here (without committing any data). print "\tclicked off - I want to close teh editor now if it's open" self.closeEditor(self.itemDelegate().current_editor, QtWidgets.QAbstractItemDelegate.NoHint) | |def createEditor(self, parent, option, index): '''Creates a combo box to chose the version to sync in case tehre are mote than one used in a sequence. Only show the editor if the mouse click ocurrs in the area where the editor lives. ''' self.current_editor = QtWidgets.QComboBox(parent) self.current_editor.setMaximumHeight(self.editorHeight) return self.current_editor |
On Thu, May 3, 2018 at 10:09 AM, Matthieu Cadet <[email protected] <mailto:[email protected]>> wrote:

    Don't know if it's the right way but I got it work using this:

    ```python
            else:
                # Can't get this to work. I want to close the editor
    here (without committing any data).
                print "\tclicked off - I want to close teh editor now
    if it's open"
                self.closeEditor(self.itemDelegate().current_editor,
                                 QtWidgets.QAbstractItemDelegate.NoHint)
    ```

    ```python
        def createEditor(self, parent, option, index):
            '''Creates a combo box to chose the version to sync in
    case tehre are mote than one used in a sequence.
            Only show the editor if the mouse click ocurrs in the area
    where the editor lives.
            '''
            self.current_editor = QtWidgets.QComboBox(parent)
            self.current_editor.setMaximumHeight(self.editorHeight)
            return self.current_editor
    ```

    On Thu, May 3, 2018 at 10:06 AM, Matthieu Cadet
    <[email protected] <mailto:[email protected]>> wrote:

        Ah ok I miss read your problem... I got the same behaviour if
        I click the Edit zone and then click again the edit zone on
        the same Cell,
        clicking outside of the edited cell close the Editor.

        On Thu, May 3, 2018 at 9:59 AM, Matthieu Cadet
        <[email protected] <mailto:[email protected]>>
        wrote:

            Hi Frank!

            I've tried your sample code and I don't see this behaviour
            on Linux Centos, I can click to open the editor, choose an
            item inside
            then when I click outside of it, it close normally.

            Maybe try to remove the line `editor.showPopup()` in the
            `def setEditorData(self, editor, index):`
            as you call
            ```
                    if editorArea.contains(cursorPos):
                        # Click was inside of editor area so open it
            for the index
            self.setCurrentIndex(index)
                        self.edit(index)
            ```

            you don't have to .showPopup() normally... or maybe it is
            macos bug :P

            On Wed, May 2, 2018 at 11:34 PM, Frank Rueter | OHUfx
            <[email protected] <mailto:[email protected]>> wrote:

                anyone?


                On 2/05/18 6:32 PM, Frank Rueter | OHUfx wrote:
                Hi all,

                I think I need some MVC help once again:

                I am using a custom item delegate that uses the
                bottom 20 pixels of a cell in a table view for a
                QComboBox (the rest will be static content).
                I can create the editor in the right spot etc, but I
                can't figure out how to close it again when the user
                clicks into the upper part of the cell.
                I tried all sorts of events and signals in the view,
                the delegate and the editor itself but to no avail.
                This is the state of things:

                The initial table:


                The table with the open editor after clicking into
                the bottom 20 pixels of a cell:


                The table after I click away from the editor but into
                the same cell, in which case I'd like to close it and
                show the initial state as seen above, but I just
                can't figure out how to.


                Attached is the working code to produce the above images.

                Any help would be greatly appreciated!

                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>



                _______________________________________________
                PySide mailing list
                [email protected] <mailto:[email protected]>
                http://lists.qt-project.org/mailman/listinfo/pyside
                <http://lists.qt-project.org/mailman/listinfo/pyside>


                _______________________________________________
                PySide mailing list
                [email protected] <mailto:[email protected]>
                http://lists.qt-project.org/mailman/listinfo/pyside
                <http://lists.qt-project.org/mailman/listinfo/pyside>




-- Matthieu Cadet
            Compositor Artist & TD,
            nWave Digital
            [email protected] <mailto:[email protected]>




-- Matthieu Cadet
        Compositor Artist & TD,
        nWave Digital
        [email protected] <mailto:[email protected]>




-- Matthieu Cadet
    Compositor Artist & TD,
    nWave Digital
    [email protected] <mailto:[email protected]>




--
Matthieu Cadet
Compositor Artist & TD,
nWave Digital
[email protected] <mailto:[email protected]>

_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to