Changeset 71874 in vbox for trunk/src/VBox
- Timestamp:
- Apr 17, 2018 1:49:21 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r71871 r71874 443 443 src/extensions/QIMenu.h \ 444 444 src/extensions/QIStatusBar.h \ 445 src/extensions/QIStyledItemDelegate.h \446 445 src/extensions/QITabWidget.h \ 447 446 src/extensions/QITableView.h \ … … 666 665 src/extensions/QISplitter.h \ 667 666 src/extensions/QIStatusBarIndicator.h \ 667 src/extensions/QIStyledItemDelegate.h \ 668 668 src/extensions/QIToolButton.h \ 669 669 src/extensions/QIWidgetValidator.h \ … … 744 744 src/extensions/QISplitter.h \ 745 745 src/extensions/QIStatusBarIndicator.h \ 746 src/extensions/QIStyledItemDelegate.h \ 746 747 src/extensions/QIToolButton.h \ 747 748 src/extensions/QIWidgetValidator.h \ … … 1168 1169 src/extensions/QISplitter.cpp \ 1169 1170 src/extensions/QIStatusBarIndicator.cpp \ 1171 src/extensions/QIStyledItemDelegate.cpp \ 1170 1172 src/extensions/QIToolButton.cpp \ 1171 1173 src/extensions/QIWidgetValidator.cpp \ … … 1273 1275 src/extensions/QISplitter.cpp \ 1274 1276 src/extensions/QIStatusBarIndicator.cpp \ 1277 src/extensions/QIStyledItemDelegate.cpp \ 1275 1278 src/extensions/QIToolButton.cpp \ 1276 1279 src/extensions/QIWidgetValidator.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStyledItemDelegate.cpp
r71850 r71874 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - Q IStyledItemDelegate class declaration.3 * VBox Qt GUI - Qt extensions: QIStyledItemDelegate class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef ___QIStyledItemDelegate_h___ 19 #define ___QIStyledItemDelegate_h___ 20 21 /* Qt includes: */ 22 # include <QStyledItemDelegate> 18 /* GUI includes: */ 19 #include "QIStyledItemDelegate.h" 23 20 24 21 25 /** QStyledItemDelegate subclass extending standard functionality. */ 26 class QIStyledItemDelegate : public QStyledItemDelegate 22 QIStyledItemDelegate::QIStyledItemDelegate(QObject *pParent) 23 : QStyledItemDelegate(pParent) 24 , m_fWatchForEditorDataCommits(false) 25 , m_fWatchForEditorEnterKeyTriggering(false) 27 26 { 28 Q_OBJECT; 27 } 29 28 30 signals: 29 void QIStyledItemDelegate::setWatchForEditorDataCommits(bool fWatch) 30 { 31 m_fWatchForEditorDataCommits = fWatch; 32 } 31 33 32 /** Notifies listeners about @a pEditor created for particular model @a index. */ 33 void sigEditorCreated(QWidget *pEditor, const QModelIndex &index) const; 34 void QIStyledItemDelegate::setWatchForEditorEnterKeyTriggering(bool fWatch) 35 { 36 m_fWatchForEditorEnterKeyTriggering = fWatch; 37 } 34 38 35 /** Notifies listeners about editor's Enter key triggering. */ 36 void sigEditorEnterKeyTriggered(); 39 QWidget *QIStyledItemDelegate::createEditor(QWidget *pParent, 40 const QStyleOptionViewItem &option, 41 const QModelIndex &index) const 42 { 43 /* Call to base-class to get actual editor created: */ 44 QWidget *pEditor = QStyledItemDelegate::createEditor(pParent, option, index); 37 45 38 public: 46 /* Watch for editor data commits, redirect to listeners: */ 47 if (m_fWatchForEditorDataCommits) 48 connect(pEditor, SIGNAL(sigCommitData(QWidget *)), this, SIGNAL(commitData(QWidget *))); 39 49 40 /** Constructs delegate passing @a pParent to the base-class. */ 41 QIStyledItemDelegate(QObject *pParent) 42 : QStyledItemDelegate(pParent) 43 , m_fWatchForEditorDataCommits(false) 44 , m_fWatchForEditorEnterKeyTriggering(false) 45 {} 50 /* Watch for editor Enter key triggering, redirect to listeners: */ 51 if (m_fWatchForEditorEnterKeyTriggering) 52 connect(pEditor, SIGNAL(sigEnterKeyTriggered()), this, SIGNAL(sigEditorEnterKeyTriggered())); 46 53 47 /** Defines whether delegate should watch for the editor's data commits. */ 48 void setWatchForEditorDataCommits(bool fWatch) { m_fWatchForEditorDataCommits = fWatch; } 49 /** Defines whether delegate should watch for the editor's Enter key triggering. */ 50 void setWatchForEditorEnterKeyTriggering(bool fWatch) { m_fWatchForEditorEnterKeyTriggering = fWatch; } 54 /* Notify listeners about editor created: */ 55 emit sigEditorCreated(pEditor, index); 51 56 52 protected: 53 54 /** Returns the widget used to edit the item specified by @a index. 55 * The @a pParent widget and style @a option are used to control how the editor widget appears. */ 56 virtual QWidget *createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const /* override */ 57 { 58 /* Call to base-class to get actual editor created: */ 59 QWidget *pEditor = QStyledItemDelegate::createEditor(pParent, option, index); 60 61 /* Watch for editor data commits, redirect to listeners: */ 62 if (m_fWatchForEditorDataCommits) 63 connect(pEditor, SIGNAL(sigCommitData(QWidget *)), this, SIGNAL(commitData(QWidget *))); 64 65 /* Watch for editor Enter key triggering, redirect to listeners: */ 66 if (m_fWatchForEditorEnterKeyTriggering) 67 connect(pEditor, SIGNAL(sigEnterKeyTriggered()), this, SIGNAL(sigEditorEnterKeyTriggered())); 68 69 /* Notify listeners about editor created: */ 70 emit sigEditorCreated(pEditor, index); 71 72 /* Return actual editor: */ 73 return pEditor; 74 } 75 76 private: 77 78 /** Holds whether delegate should watch for the editor's data commits. */ 79 bool m_fWatchForEditorDataCommits : 1; 80 /** Holds whether delegate should watch for the editor's Enter key triggering. */ 81 bool m_fWatchForEditorEnterKeyTriggering : 1; 82 }; 83 84 #endif /* !___QIStyledItemDelegate_h___ */ 85 57 /* Return actual editor: */ 58 return pEditor; 59 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStyledItemDelegate.h
r71027 r71874 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - Q IStyledItemDelegate class declaration.3 * VBox Qt GUI - Qt extensions: QIStyledItemDelegate class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 21 21 /* Qt includes: */ 22 # 22 #include <QStyledItemDelegate> 23 23 24 /* GUI includes: */ 25 #include "UILibraryDefs.h" 24 26 25 27 /** QStyledItemDelegate subclass extending standard functionality. */ 26 class QIStyledItemDelegate : public QStyledItemDelegate28 class SHARED_LIBRARY_STUFF QIStyledItemDelegate : public QStyledItemDelegate 27 29 { 28 30 Q_OBJECT; … … 39 41 40 42 /** Constructs delegate passing @a pParent to the base-class. */ 41 QIStyledItemDelegate(QObject *pParent) 42 : QStyledItemDelegate(pParent) 43 , m_fWatchForEditorDataCommits(false) 44 , m_fWatchForEditorEnterKeyTriggering(false) 45 {} 43 QIStyledItemDelegate(QObject *pParent); 46 44 47 45 /** Defines whether delegate should watch for the editor's data commits. */ 48 void setWatchForEditorDataCommits(bool fWatch) { m_fWatchForEditorDataCommits = fWatch; }46 void setWatchForEditorDataCommits(bool fWatch); 49 47 /** Defines whether delegate should watch for the editor's Enter key triggering. */ 50 void setWatchForEditorEnterKeyTriggering(bool fWatch) { m_fWatchForEditorEnterKeyTriggering = fWatch; }48 void setWatchForEditorEnterKeyTriggering(bool fWatch); 51 49 52 50 protected: … … 54 52 /** Returns the widget used to edit the item specified by @a index. 55 53 * The @a pParent widget and style @a option are used to control how the editor widget appears. */ 56 virtual QWidget *createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const /* override */ 57 { 58 /* Call to base-class to get actual editor created: */ 59 QWidget *pEditor = QStyledItemDelegate::createEditor(pParent, option, index); 60 61 /* Watch for editor data commits, redirect to listeners: */ 62 if (m_fWatchForEditorDataCommits) 63 connect(pEditor, SIGNAL(sigCommitData(QWidget *)), this, SIGNAL(commitData(QWidget *))); 64 65 /* Watch for editor Enter key triggering, redirect to listeners: */ 66 if (m_fWatchForEditorEnterKeyTriggering) 67 connect(pEditor, SIGNAL(sigEnterKeyTriggered()), this, SIGNAL(sigEditorEnterKeyTriggered())); 68 69 /* Notify listeners about editor created: */ 70 emit sigEditorCreated(pEditor, index); 71 72 /* Return actual editor: */ 73 return pEditor; 74 } 54 virtual QWidget *createEditor(QWidget *pParent, 55 const QStyleOptionViewItem &option, 56 const QModelIndex &index) const /* override */; 75 57 76 58 private: … … 83 65 84 66 #endif /* !___QIStyledItemDelegate_h___ */ 85
Note:
See TracChangeset
for help on using the changeset viewer.