gpt4 book ai didi

c++ - 隐藏的重载虚函数 OSX QT4

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:43:44 24 4
gpt4 key购买 nike

编译时我的 mac 上的 QT4 有问题

In file included from playlistWidget.cpp:16: ./playlistWidget.h:121:16: warning: 'NPlaylistWidget::mimeData' hides overloaded virtual function [-Woverloaded-virtual] QMimeData *mimeData(const QList items) const; ^ /opt/local/libexec/qt4/Library/Frameworks/QtGui.framework/Versions/4/Headers/qlistwidget.h:280:24: note: hidden overloaded virtual function 'QListWidget::mimeData' declared here: type mismatch at 1st parameter ('const QList' vs 'const QList') virtual QMimeData *mimeData(const QList items) const; ^

我的代码:

private:
QPointer<QDrag> m_itemDrag;
bool m_fileDrop;
QList<QUrl> m_mimeDataUrls;
QStringList mimeTypes() const;
QMimeData *mimeData(const QList<NPlaylistWidgetItem *> items) const;
bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
#ifdef Q_WS_MAC
Qt::DropActions supportedDropActions() const;
#endif
protected:
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void mouseMoveEvent(QMouseEvent *event);

我该如何解决?

最佳答案

函数签名是: QMimeData *mimeData(const QList<QListWidgetItem *> items) const

您的 QList 由 NPlaylistWidgetItem * 参数化,用于签名:
QMimeData *mimeData(const QList<NPlaylistWidgetItem *> items) const

将参数更改为 QListWidgetItem * 应该没问题。通常建议至少使用 -Wall -Wextra -Werror 进行编译

关于c++ - 隐藏的重载虚函数 OSX QT4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43735547/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com