Suppress -Woverloaded-virtual in QAbstractEventDispatcherV2 hierarchy

Says GCC (e.g.):

  qabstracteventdispatcher.h:122:9:
  warning: ‘virtual int QAbstractEventDispatcherV2::remainingTime(int)’ was
  hidden [-Woverloaded-virtual]

    122 |     int remainingTime(int timerId) final;
        |         ^~~~~~~~~~~~~

  qeventdispatcher_glib_p.h:47:14:
  warning: by ‘virtual QAbstractEventDispatcher::Duration
  QEventDispatcherGlib::remainingTime(Qt::TimerId) const’
  [-Woverloaded-virtual]

     47 |     Duration remainingTime(Qt::TimerId timerId) const override final;
        |              ^~~~~~~~~~~~~

The usual way to fix this warning, adding `using base::func;`, doesn't
work here, because (the int overloads of) the functions in question
are made private in QAbstractEventDispatcherV2, so the `using` fails
with "is private in this context" errors.

Since this situation is temporary (until Qt 7, when the overloading
stops), simply suppress the warnings manually.

Found that the Windows dispatcher doesn't inherit from V2, yet, and
created QTBUG-129170 to track the issue.

Amends f8da484d5741d1191504eefddf5134fd7009e16a.

Task-number: QTBUG-126219
Change-Id: I0da821f08364f97fb7a17c9019586064ae58b0b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 222cf3145ede99d1919fe7f388a9101f2c576255)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-09-20 13:48:51 +02:00 committed by Qt Cherry-pick Bot
parent 1ff68ff3fd
commit c29f10a0b0

View File

@ -114,12 +114,16 @@ protected:
QAbstractEventDispatcherV2(QAbstractEventDispatcherPrivate &, QObject *parent);
private:
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Woverloaded-virtual")
QT_WARNING_DISABLE_CLANG("-Woverloaded-virtual")
// final overrides from V1
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType,
QObject *object) final;
bool unregisterTimer(int timerId) final;
QList<TimerInfo> registeredTimers(QObject *object) const final;
int remainingTime(int timerId) final;
QT_WARNING_POP
};
#else
using QAbstractEventDispatcherV2 = QAbstractEventDispatcher;