VirtualBox

Changeset 64162 in vbox for trunk/src


Ignore:
Timestamp:
Oct 6, 2016 12:29:30 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 74): Make data commits listener of QIStyledItemDelegate optional.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStyledItemDelegate.h

    r64161 r64162  
    3838    QIStyledItemDelegate(QObject *pParent)
    3939        : QStyledItemDelegate(pParent)
     40        , m_fWatchForEditorDataCommits(false)
    4041        , m_fWatchForEditorEnterKeyTriggering(false)
    4142    {}
    4243
     44    /** Defines whether delegate should watch for the editor's data commits. */
     45    void setWatchForEditorDataCommits(bool fWatch) { m_fWatchForEditorDataCommits = fWatch; }
    4346    /** Defines whether delegate should watch for the editor's Enter key triggering. */
    4447    void setWatchForEditorEnterKeyTriggering(bool fWatch) { m_fWatchForEditorEnterKeyTriggering = fWatch; }
    4548
    46 private:
     49protected:
    4750
    4851    /** Returns the widget used to edit the item specified by @a index.
    4952      * The @a pParent widget and style @a option are used to control how the editor widget appears. */
    50     QWidget* createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const
     53    virtual QWidget *createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const /* override */
    5154    {
    5255        /* Call to base-class to get actual editor created: */
    5356        QWidget *pEditor = QStyledItemDelegate::createEditor(pParent, option, index);
    5457
    55         connect(pEditor, SIGNAL(sigCommitData(QWidget*)), this, SIGNAL(commitData(QWidget*)));
     58        /* Watch for editor data commits, redirect to listeners: */
     59        if (m_fWatchForEditorDataCommits)
     60            connect(pEditor, SIGNAL(sigCommitData(QWidget *)), this, SIGNAL(commitData(QWidget *)));
    5661
    5762        /* Watch for editor Enter key triggering, redirect to listeners: */
     
    6368    }
    6469
     70private:
     71
     72    /** Holds whether delegate should watch for the editor's data commits. */
     73    bool m_fWatchForEditorDataCommits : 1;
    6574    /** Holds whether delegate should watch for the editor's Enter key triggering. */
    66     bool m_fWatchForEditorEnterKeyTriggering;
     75    bool m_fWatchForEditorEnterKeyTriggering : 1;
    6776};
    6877
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp

    r62493 r64162  
    408408        setItemDelegate(pStyledItemDelegate);
    409409        /* Configure item delegate: */
     410        pStyledItemDelegate->setWatchForEditorDataCommits(true);
    410411        pStyledItemDelegate->setWatchForEditorEnterKeyTriggering(true);
    411412        connect(pStyledItemDelegate, SIGNAL(sigEditorEnterKeyTriggered()),
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp

    r62493 r64162  
    603603    /* Set configured item editor factory for table delegate: */
    604604    pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
     605
     606    /* Configure item delegate: */
     607    pStyledItemDelegate->setWatchForEditorDataCommits(true);
    605608}
    606609
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette