(11) 属性 modelColumn :
++ 给出补充知识讲解 :
++配套的范例代码 :
#include <QApplication>
#include <QComboBox>
#include <QStandardItemModel>
int main(int argc, char * argv[]) {
QApplication app(argc, argv);
QStandardItemModel model(2, 2); // 1. 创建模型并填充两列数据
model.setItem(0, 0, new QStandardItem("Apple") ); // 2行2列
model.setItem(0, 1, new QStandardItem("1001") );
model.setItem(1, 0, new QStandardItem("Banana"));
model.setItem(1, 1, new QStandardItem("1002") );
QComboBox comboBox;
comboBox.setModel( & model ); // 2. 创建组合框并绑定模型
comboBox.setModelColumn(0); // 3. 设置显示第一列(产品名称)
comboBox.show();
return app.exec();
}
(12)
(13)
++给出举例:
(14)对信号函数的逐个测试 :
++
++
++
(15)本源码来自于头文件 qcombobox . h :
#ifndef QCOMBOBOX_H
#define QCOMBOBOX_H
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qabstractitemdelegate.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qvariant.h>
#include <QtGui/qvalidator.h>
QT_REQUIRE_CONFIG(combobox);
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QLineEdit;
class QComboBoxPrivate;
class QCompleter;
/*
The QComboBox widget is a combined button and popup list.
A QComboBox提供了一种以占用最小屏幕空间的方式向用户呈现选项列表的方法。
组合框是一种选择控件,显示当前项目,并可以弹出一个可选择的项目的列表。
组合框可以是可编辑的,允许用户修改列表中的每个项目。
组合框可以包含位图以及字符串;insertltem()和setltemText()函数被适当地重载.
对于可编辑的组合框,提供了clearEditText()函数,用于清除显示的字符串而不改变组合框的内容。
如果组合框的当前项发生变化,
会发出三个信号:currentIndexChanged()、currentTextChanged()和activated()。
无论更改是通过编程还是用户交互完成的。currentIndexChanged()和currentTextChanged()都会始终发出,
而activated()仅在更改是由用户交互引起时发出。
当用户在组合框弹出列表中高亮显示一个项时,会发出highlighted()信号。
这三个信号都存在两个版本,一个带QString参数,-个带int参数。
如果用户选择或高亮显示一个位图,则仅会发出int信号。
每当可编辑组合框的文本更改时,将发出editTextChanged()信号。
当用户在可编辑的下拉列表框中输入新字符串时,该小部件可能插入也可能不插入,并且可以在多个位置插入。
默认策略是“插入到底部”,但您可以使用setInsertPolicy()来更改此设置。
可以使用 QValidator 来限制输入到可编辑的 combo框中;参见 setValidator()方法。
默认情况下,任何输入都会被接受。
可以使用插入函数,例如insertItem()和insertItems()来填充组合框。
可以使用 setItemText()来更改项目。可以使用removeItem()删除一个项目,使用clear()删除所有项目。
currentText()返回当前项目的文本,text()返回某编号项目的文本。
可以使用 setCurrentIndex()设置当前项目。
count()返回组合框中项目的数量;可以使用setMaxCount设置最大数()量。
可以使用 setEditable()允许编辑。
对于可编辑的combobox,您可以使用setCompleter()设置自动补全,
使用setDuplicatesEnabled()设置用户是否可以添加重复项。
QComboBox 使用模型/视图框架作为其弹出列表和存储其项目。
默认情况下,QStandardItemModel存储项目,而 QListView 子类显示弹出列表。
你可以直接访问模型和视图使用 model()和 view(),
但 QComboBox也提供了设置和获取项目数据的函数(例如,setltemData()和itemText())。
您还可以设置新的模型和视图(使用 setModel()和setView())。
对于组合框标签中的文本和图标,使用模型中具有 Qt::DisplayRole 和 Qt::DecorationRole 的数据。
请注意,您不能更改 view()的SelectionMode,例如,不能使用setSelectionMode()来更改。
*/
class Q_WIDGETS_EXPORT QComboBox : public QWidget
{
Q_OBJECT
//This property holds whether the combo box draws itself with a frame。
//If enabled (the default) the combo box draws itself inside a frame,
//otherwise the combo box draws itself without any frame.
Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) //默认绘制组合框的边框
//设置当未设置有效索引时显示的占位符文本 placeholderText。
//当设置无效索引时,将显示占位符文本。该文本在下拉列表中不可访问。
//当此函数在添加项目之前调用时,将显示占位符文字,
// 否则,如果您想显示占位符文字,则必须通过编程调用setCurrentIndex(-1)。
//设置空占位符文本以重置设置。
//当 QComboBox 可编辑时,请使用 QLineEdit::setPlaceholderText() 函数。
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
//这个属性持有当前文本. 如果组合框是可编辑的,则当前文本是由行编辑显示的值。
//否则,它是当前项的值,或者如果组合框为空或未设置当前项,则为空字符串。
//如果组合框是可编辑的,则setter的setCurrentText()方法会简单地调用setEditText()。
//否则如果列表中有匹配的文本,则将currentIndex设置为相应的索引。
//总计 : 对于不可编辑组合框,本属性的设置函数不起作用。
//若设置set的新文本等于另一个条目的文本,则相当于条目切换。
Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText
NOTIFY currentTextChanged USER true)
Q_PROPERTY(QVariant currentData READ currentData)
//此属性持有当前项的数据。 //该属性数据的类型是 QVariant共用体类型
//默认情况下,对于空组合框或当前未设置任何项目的组合框,此属性包含无效的 QVariant。
//总结://对于组合框里的每个条目,可以为其关联一个后台数据,就是这个 currentData。
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex
NOTIFY currentIndexChanged)
//This property holds the index of the current item in the combobox.
//The current index can change when inserting or removing items.
//By default, for an empty combo box or
//a combo box in which no current item is set, this property has a value of -1.
//This property holds the number of items in the combobox。
//By default, for an empty combo box, this property has a value of 0.
Q_PROPERTY(int count READ count) //组合框里的当前条目数
//populate兼具“人口”与“填充”之意,隐喻将“人的聚集”类比为“数据的填充”、“空间的占据”。
Q_PROPERTY(int modelColumn READ modelColumn WRITE setModelColumn) //模型与视图中的列
//此属性持有模型中可见的列。
//如果在填充组合框之前设置,则弹出视图将不受影响,并将显示第一列(使用此属性的默认值)。
//默认情况下,此属性的值为 0。 注:在可编辑的复选框中,可见的列也将成为完成列。
//This property holds the column in the model that is visible.
//If set prior to populating填充 the combo box,
//the pop-up view will not be affected and will show the first column,
// (using this property's default value).
//By default, this property has a value of 0.
//Note: In an editable combobox,
// the visible column will also become the completion column.
//在 Qt 的 QComboBox 组件中, //看看一言的解释多清楚,棒
//modelColumn 属性用于指定组合框从关联的模型(Model)中读取数据的列索引。
//当组合框与一个多列模型(如 QStandardItemModel)绑定时,
// 该属性决定了下拉列表中显示的文本内容来自模型的哪一列。
//此属性包含应适合组合框的最少字符数。本属性描述当组合框随窗口被缩小时仍应显示大约多少个字符。
Q_PROPERTY(int minimumContentsLength //本函数主要影响其父类 QWidget的图形绘制。
READ minimumContentsLength WRITE setMinimumContentsLength)
//This property holds the minimum number of characters that should fit into the
//combobox. The default value is 0. If this property is set to a positive value,
// the minimumSizeHint() and sizeHint() take it into account.
Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy //此枚举量就定义在本类
READ sizeAdjustPolicy WRITE setSizeAdjustPolicy)
//This property holds the policy describing how the
// size of the combobox changes when the content changes。
//此属性包含描述当内容更改时组合框大小如何更改的策略。
//The default value is AdjustToContentsOnFirstShow.
//当禁用可编辑状态时,验证器和补全器将被移除。
//This property holds whether the combo box can be edited by the user。
//By default, this property is false.
//The effect of editing depends on the insert policy.
//Note: When disabling the editable state, the validator and completer are removed.
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
//This property holds the maximum allowed size on screen of the combo box,
//measured in items By default, this property has a value of 10.
Q_PROPERTY(int maxVisibleItems //默认 10个,有太多条目,就提供滚动条
READ maxVisibleItems WRITE setMaxVisibleItems)
//注意:对于返回 QStyle::SH_ComboBox_Popup的样式(如 Mac 样式或 Gtk+ 样式)中的非可编辑组合框,
// 此属性将被忽略。 Note: This property is ignored for non-editable comboboxes in
//styles that returns true for QStyle::SH_ComboBox_Popup such as the
//Mac style or the Gtk+ Style.
//This property holds the maximum number of items allowed in the combobox。
//Note: If you set the maximum number to be less than the
// current amount of items in the combobox, the extra items will be truncated.
//This also applies if you have set an external model on the combobox.
//By default, this property's value is derived from the
// highest signed integer available (typically 2147483647).
Q_PROPERTY(int maxCount //多余的条目从尾部移除
READ maxCount WRITE setMaxCount)
//This property holds the policy used to determine
// where user-inserted items should appear in the combobox。
//The default value is InsertAtBottom,
//indicating that new items will appear at the bottom of the list of items.
Q_PROPERTY(InsertPolicy insertPolicy //此枚举类就定义在本类里
READ insertPolicy WRITE setInsertPolicy)
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) //图片只会被缩小,不会被放大
//This property holds the size of the icons shown in the combobox.
//Unless explicitly set, this returns the default value of the current style.
//This size is the maximum size that icons can have;
//icons of smaller size are not scaled up.
//This property holds whether the user can enter duplicate items into the combobox。
//Note that it is always possible to programmatically insert duplicate
// items into the combobox.
//By default, this property is false (duplicates are not allowed).
Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled)
protected:
QComboBox(QComboBoxPrivate &, QWidget *);
private:
Q_DECLARE_PRIVATE(QComboBox)
Q_DISABLE_COPY(QComboBox)
Q_PRIVATE_SLOT(d_func(), void _q_itemSelected(const QModelIndex &item))
Q_PRIVATE_SLOT(d_func(), void _q_emitHighlighted(const QModelIndex &))
Q_PRIVATE_SLOT(d_func(), void _q_emitCurrentIndexChanged(const QModelIndex &index))
Q_PRIVATE_SLOT(d_func(), void _q_editingFinished())
Q_PRIVATE_SLOT(d_func(), void _q_returnPressed())
Q_PRIVATE_SLOT(d_func(), void _q_resetButton())
Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &,
const QModelIndex &))
Q_PRIVATE_SLOT(d_func(), void _q_updateIndexBeforeChange())
Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex & parent,
int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved (const QModelIndex & parent,
int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_modelReset())
#if QT_CONFIG(completer) //此 if成立
Q_PRIVATE_SLOT(d_func(), void _q_completerActivated(const QModelIndex &index))
#endif
public:
//Constructs a combobox with the given parent,
// using the default model QStandardItemModel.
explicit QComboBox(QWidget *parent = nullptr);
~QComboBox();
//Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) //默认绘制组合框的边框
bool hasFrame() const;
void setFrame(bool);
//Q_PROPERTY(QString placeholderText
// READ placeholderText WRITE setPlaceholderText)
QString placeholderText() const;
void setPlaceholderText(const QString & placeholderText);
//Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText
// NOTIFY currentTextChanged USER true)
QString currentText() const;
public Q_SLOTS:
void setCurrentText (const QString & text);
Q_SIGNALS:
void currentTextChanged(const QString &);
public:
//Q_PROPERTY(QVariant currentData READ currentData)
QVariant currentData(int role = Qt::UserRole) const;
//Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex
// NOTIFY currentIndexChanged)
int currentIndex() const;
public Q_SLOTS:
void setCurrentIndex (int index);
Q_SIGNALS:
void currentIndexChanged(int index);
public:
//Q_PROPERTY(int count READ count) //组合框里的当前条目数
int count() const;
//Q_PROPERTY(int modelColumn
// READ modelColumn WRITE setModelColumn) //模型与视图中的列
int modelColumn() const;
void setModelColumn(int visibleColumn);
//Q_PROPERTY(int minimumContentsLength //本函数主要影响其父类 QWidget的图形绘制。
// READ minimumContentsLength WRITE setMinimumContentsLength)
int minimumContentsLength() const;
void setMinimumContentsLength(int characters);
enum SizeAdjustPolicy {
AdjustToContents ,
//The combobox will always adjust to the contents
AdjustToContentsOnFirstShow,
//The combobox will adjust to its contents the first time it is shown.
AdjustToMinimumContentsLengthWithIcon //对大量条目的组合框,用最后一个属性
//The combobox will adjust to minimumContentsLength plus space for an icon.
// For performance reasons use this policy on large models.
};
Q_ENUM( SizeAdjustPolicy ) //让本枚举类接入 Qt的元对象系统
//Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy //此枚举量就定义在本类
// READ sizeAdjustPolicy WRITE setSizeAdjustPolicy)
SizeAdjustPolicy sizeAdjustPolicy() const;
void setSizeAdjustPolicy(SizeAdjustPolicy policy);
//Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
bool isEditable() const;
void setEditable(bool editable);
//Q_PROPERTY(int maxVisibleItems //默认 10个,有太多条目,就提供滚动条
// READ maxVisibleItems WRITE setMaxVisibleItems)
int maxVisibleItems() const ;
void setMaxVisibleItems(int maxItems);
//Q_PROPERTY(int maxCount //多余的条目从尾部移除
// READ maxCount WRITE setMaxCount)
int maxCount() const;
void setMaxCount(int max);
enum InsertPolicy {
NoInsert ,
InsertAtTop ,
InsertAtCurrent , //此一项相当于条目替换。其他选项除了第一项都会造成条目增多
InsertAtBottom ,
InsertAfterCurrent ,
InsertBeforeCurrent,
InsertAlphabetically //按 abc的字母顺序
};
Q_ENUM( InsertPolicy )
//Q_PROPERTY(InsertPolicy insertPolicy //此枚举类就定义在本类里
// READ insertPolicy WRITE setInsertPolicy)
InsertPolicy insertPolicy() const;
void setInsertPolicy(InsertPolicy policy);
//Q_PROPERTY(QSize iconSize
// READ iconSize WRITE setIconSize) //图片只会被缩小,不会被放大
QSize iconSize() const;
void setIconSize(const QSize & size);
//Q_PROPERTY(bool duplicatesEnabled
// READ duplicatesEnabled WRITE setDuplicatesEnabled)
bool duplicatesEnabled() const;
void setDuplicatesEnabled(bool enable);
//Returns the line edit used to edit items in the combobox,
//or nullptr if there is no line edit. Only editable combo boxes have a line edit.
QLineEdit * lineEdit() const;
void setLineEdit(QLineEdit * edit);
//Sets the line edit to use instead of the current line edit widget.
//The combo box takes ownership of the line edit.
//Note: Since the combobox's line edit owns the QCompleter,
//any previous call to setCompleter() will no longer have any effect.
//Returns the validator that is used to constrain text input for the combobox.
const QValidator * validator() const;
void setValidator(const QValidator * v);
//Sets the validator to use instead of the current validator.
//Note: The validator is removed when the editable property becomes false.
//Returns the completer that is used to auto complete text input for the combobox.
QCompleter * completer() const; //这部分不是太清楚,等学习了 plainText再学习它
void setCompleter(QCompleter *c);
//设置要使用的补全器,以代替当前补全器。如果补全器为 nullptr,则自动补全功能将被禁用。
//默认情况下,对于可编辑的组合框,会自动创建一个不区分大小写的内联补全QCompleter。
//注意:当可编辑属性变为false时,或者当行编辑 Linedit被 setLinedit()调用替换时,补全器将被移除。
//在不可编辑的QComboBox上设置补全器将被忽略。
//Returns the item delegate used by the popup list view.
QAbstractItemDelegate * itemDelegate() const;
void setItemDelegate(QAbstractItemDelegate * delegate);
//设置弹出式列表视图的项委托。组合框拥有委托。
//任何现有的委托将被移除,但不会删除。QComboBox不会拥有委托的所有权。
//警告:您不应在组合框、小部件映射器或视图之间共享同一个委托实例。
//这样做可能会导致不正确或不直观的编辑行为, 因为连接到给定委托的每个视图
//都可能接收到 closeEditor()信号,并尝试访问、修改或关闭一个已经关闭的编辑器。
//Returns the model used by the combobox.
QAbstractItemModel * model() const;
virtual void setModel(QAbstractItemModel * model);
//Sets the model to be model. model must not be nullptr.
//If you want to clear the contents of a model, call clear(). //clear()会清除 model
//Note: If the combobox is editable, then the model will also be set on the
// completer of the line edit.
//Returns the root model item index for the items in the combobox.
QModelIndex rootModelIndex() const;
void setRootModelIndex(const QModelIndex & index);
//Sets the root model item index for the items in the combobox.
//Returns the list view used for the combobox popup.
QAbstractItemView * view() const;
void setView(QAbstractItemView * itemView);
//将组合框弹出窗口中使用的视图设置为给定的itemView。组合框拥有该视图。
//注:如果您想使用便捷视图(如QListWidget、QTableWidget或QTreeWidget),
//请在调用此函数之前,确保在带有便捷视图模型的组合框上调用setModel()函数。
//Returns the text for the given index in the combobox.
QString itemText(int index) const;
void setItemText(int index, const QString & text);
//Sets the text for the item on the given index in the combobox.
//Returns the icon for the given index in the combobox.
QIcon itemIcon(int index) const;
void setItemIcon(int index, const QIcon & icon);
//Sets the icon for the item on the given index in the combobox.
//enum Qt::ItemDataRole { ... , UserRole };
// UserRole: The first role that can be used for application-specific purposes.
QVariant itemData(int index, int role = Qt::UserRole) const;
//Returns the data for the given role in the given index in the combobox,
// or an invalid QVariant if there is no data for this role.
void setItemData(int index, const QVariant & value, int role = Qt::UserRole);
//Sets the data role for the item on the
// given index in the combobox to the specified value.
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
//显示组合框中的项目列表。如果列表为空,则不会显示任何项目。
//如果您重新实现此函数以显示自定义弹出窗口,请确保调用hidePopup()以重置内部状态。
virtual void showPopup();
virtual void hidePopup();
//如果组合框中的项目列表当前可见,
//则将其隐藏并重置内部状态,以便如果自定义弹出窗口在重新实现的showPopup()中显示,
//则还需要重新实现hidePopup()函数来隐藏自定义弹出窗口,
//并在每次自定义弹出窗口控件隐藏时调用基类实现以重置内部状态。
//Returns the index of the item containing the given data for the given role;
// otherwise returns -1. //本函返回的是组合框里条目的下标
//The flags specify how the items in the combobox are searched.
int findData(const QVariant & data, int role = Qt::UserRole,
Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(
Qt::MatchExactly|Qt::MatchCaseSensitive)) const;
//MatchFlags = QFlags<MatchFlag>
inline int findText(const QString & text,
Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(
Qt::MatchExactly|Qt::MatchCaseSensitive)
) const
{ return findData(text, Qt::DisplayRole, flags); }
//Returns the index of the item containing the given text; otherwise returns -1.
//The flags specify how the items in the combobox are searched.
//Inserts the text and userData (stored in the Qt::UserRole) into the
// combobox at the given index.
//If the index is equal to or higher than the total number of items,
// the new item is appended to the list of existing items.
//If the index is zero or negative, the new item is prepended to the
// list of existing items.
inline void insertItem(int index,
const QString & text,
const QVariant & userData = QVariant())
{ insertItem(aindex, QIcon(), atext, auserData); }
void insertItem(int index,
const QIcon & icon,
const QString & text,
const QVariant & userData = QVariant());
//Inserts the icon, text and userData (stored in the Qt::UserRole) into the
// combobox at the given index.
void insertItems(int index, const QStringList & texts);
//QStringList=QList<QString>
//Inserts the strings from the list into the combobox as separate items,
//starting at the index specified.
void insertSeparator(int index);
//Inserts a separator item into the combobox at the given index.
//Adds an item to the combobox with the given text, and containing the
//specified userData (stored in the Qt::UserRole).
//The item is appended to the list of existing items.
inline void addItem(const QString & text,
const QVariant & userData = QVariant())
{ insertItem(count(), atext, auserData); }
inline void addItem(const QIcon & icon,
const QString & text,
const QVariant & userData = QVariant())
{ insertItem(count(), aicon, atext, auserData); }
//Adds an item to the combobox with the given icon and text,
//and containing the specified userData (stored in the Qt::UserRole).
inline void addItems(const QStringList & texts)
{ insertItems(count(), texts); }
void removeItem(int index);
//Removes the item at the given index from the combobox.
//This will update the current index if the index is removed.
//This function does nothing if index is out of range.
bool event(QEvent * event) override;
//enum Qt::InputMethodQuery { ImEnabled, ImCursorPosition.... };
QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
//继承自父类 QWidget::inputMethodQuery(Qt::InputMethodQuery query) const.
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query,
const QVariant & argument) const;
public Q_SLOTS:
//Clears the combobox, removing all items.
//Note: If you have set an external model on the combobox ,
// this model will still be cleared when calling this function.
void clear();
void clearEditText();
//Clears the contents of the line edit used for editing in the combobox.
//Sets the text in the combobox's text edit.
void setEditText(const QString & text);
//void setCurrentIndex(int index); //这是个函数
//void setCurrentText(const QString & text); //这是个函数
//The setter setCurrentText() simply calls setEditText() if the
// combo box is editable. Otherwise, if there is a matching text in the list,
//currentIndex is set to the corresponding index.
Q_SIGNALS:
//This signal is sent whenever the currentIndex in the
//combobox changes either through user interaction or programmatically.
//The item's index is passed or //这俩函数的形参都是新条目的信息
// -1 if the combobox becomes empty or the currentIndex was reset.
//void currentIndexChanged(int index); //这是个函数
//void currentTextChanged (const QString &); //这是个函数
//This signal is sent whenever currentText changes.
//The new value is passed as text.
//This signal is emitted when the
// text in the combobox's line edit widget is changed.
//The new text is specified by text.
void editTextChanged(const QString & text);
//This signal is sent when the user chooses an item in the combobox.
//The item's index is passed.
//Note that this signal is sent even when the choice is not changed.
//If you need to know when the choice actually changes,
// use signal currentIndexChanged() or currentTextChanged().
void activated(int index);
void textActivated(const QString &);
//This signal is sent when the user chooses an item in the combobox.
//The item's text is passed.
//This signal is sent when an item in the combobox popup list is
// highlighted by the user. The item's index is passed.
void highlighted(int index);
void textHighlighted(const QString &);
//This signal is sent when an item in the combobox popup list is
// highlighted by the user. The item's text is passed.
protected:
virtual void initStyleOption(QStyleOptionComboBox *option) const;
void focusInEvent(QFocusEvent * e) override;
void focusOutEvent(QFocusEvent * e) override;
void changeEvent(QEvent * e) override;
void resizeEvent(QResizeEvent * e) override;
void paintEvent(QPaintEvent * e) override;
void showEvent(QShowEvent * e) override;
void hideEvent(QHideEvent * e) override;
void mousePressEvent(QMouseEvent * e) override;
void mouseReleaseEvent(QMouseEvent * e) override;
void wheelEvent(QWheelEvent * e) override;
void contextMenuEvent(QContextMenuEvent * e) override;
void keyPressEvent(QKeyEvent * e) override;
void keyReleaseEvent(QKeyEvent * e) override;
void inputMethodEvent(QInputMethodEvent * ) override;
}; //完结 class QComboBox : public QWidget
QT_END_NAMESPACE
#endif // QCOMBOBOX_H
(16)
谢谢