Skip to content

Commit

Permalink
QTableWidget: Fix -Wdeprecated-copy warning
Browse files Browse the repository at this point in the history
In file included from ../../include/QtCore/qlist.h:1,
                 from ../../include/QtCore/../../../qtbase_dev_de_verdad/src/corelib/kernel/qobject.h:49,
                 from ../../include/QtCore/qobject.h:1,
                 from ../../include/QtCore/../../../qtbase_dev_de_verdad/src/corelib/kernel/qcoreapplication.h:46,
                 from ../../include/QtCore/qcoreapplication.h:1,
                 from /src/widgets/kernel/../../gui/kernel/../../corelib/global/qt_pch.h:66,
                 from /src/widgets/kernel/../../gui/kernel/qt_gui_pch.h:48,
                 from /src/widgets/kernel/qt_widgets_pch.h:48:
../../include/QtCore/../../../qtbase_dev_de_verdad/src/corelib/tools/qlist.h: In instantiation of ‘void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = QTableWidgetSelectionRange]’:
../../include/QtCore/../../../qtbase_dev_de_verdad/src/corelib/tools/qlist.h:614:13:   required from ‘void QList<T>::append(const T&) [with T = QTableWidgetSelectionRange]’
/src/widgets/itemviews/qtablewidget.cpp:2416:71:   required from here
../../include/QtCore/../../../qtbase_dev_de_verdad/src/corelib/tools/qlist.h:471:35: warning: implicitly-declared ‘constexpr QTableWidgetSelectionRange& QTableWidgetSelectionRange::operator=(const QTableWidgetSelectionRange&)’ is deprecated [-Wdeprecated-copy]
  471 |     else *reinterpret_cast<T*>(n) = t;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /src/widgets/itemviews/qtablewidget.cpp:40:
/src/widgets/itemviews/qtablewidget.h:52:24: note: because ‘QTableWidgetSelectionRange’ has user-provided ‘QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange&)’
   52 | class Q_WIDGETS_EXPORT QTableWidgetSelectionRange
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I72ca2dbf1d46a0f51a6fc7b7df80c79f937657de
Reviewed-by: Christian Ehrlicher <[email protected]>
Reviewed-by: Friedemann Kleint <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
albert-astals-cid-kdab committed Oct 3, 2019
1 parent 0392a74 commit 127ed7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/widgets/itemviews/qtablewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,8 @@ QTableWidgetSelectionRange::QTableWidgetSelectionRange(int top, int left, int bo
Constructs a the table selection range by copying the given \a
other table selection range.
*/
QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other)
: top(other.top), left(other.left), bottom(other.bottom), right(other.right)
{
}
QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other) = default;
QTableWidgetSelectionRange &QTableWidgetSelectionRange::operator=(const QTableWidgetSelectionRange &other) = default;

/*!
Destroys the table selection range.
Expand Down
5 changes: 4 additions & 1 deletion src/widgets/itemviews/qtablewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ QT_REQUIRE_CONFIG(tablewidget);

QT_BEGIN_NAMESPACE

// ### Qt6 unexport the class, remove the user-defined special 3 and make it a literal type.
class Q_WIDGETS_EXPORT QTableWidgetSelectionRange
{
public:
QTableWidgetSelectionRange();
QTableWidgetSelectionRange(int top, int left, int bottom, int right);
QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other);
~QTableWidgetSelectionRange();

QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other);
QTableWidgetSelectionRange &operator=(const QTableWidgetSelectionRange &other);

inline int topRow() const { return top; }
inline int bottomRow() const { return bottom; }
inline int leftColumn() const { return left; }
Expand Down

0 comments on commit 127ed7e

Please sign in to comment.