Bug 376247

Summary: Compilation error: /heaptrack/src/analyze/gui/mainwindow.cpp:83:110: error: no matching function for call to 'QAction::QAction(QIcon, QString)'
Product: [Applications] Heaptrack Reporter: Péter Szabados <kangirigungi>
Component: generalAssignee: Milian Wolff <mail>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Péter Szabados 2017-02-09 16:51:17 UTC
Using the development packages from Ubuntu Xenial, I get the following compilation error when trying to compile the latest version on the master branch:

/heaptrack/src/analyze/gui/mainwindow.cpp: In lambda function:
/heaptrack/src/analyze/gui/mainwindow.cpp:83:110: error: no matching function for call to 'QAction::QAction(QIcon, QString)'
             new QAction(QIcon::fromTheme(QStringLiteral("document-open")), QObject::tr("Open file in editor"));
                                                                                                              ^
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QAction:1:0,
                 from /heaptrack/build/src/analyze/gui/ui_mainwindow.h:15,
                 from /heaptrack/src/analyze/gui/mainwindow.cpp:22:
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:174:5: note: candidate: QAction::QAction(QActionPrivate&, QObject*)
     QAction(QActionPrivate &dd, QObject *parent);
     ^
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:174:5: note:   no known conversion for argument 1 from 'QIcon' to 'QActionPrivate&'
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:89:5: note: candidate: QAction::QAction(const QIcon&, const QString&, QObject*)
     QAction(const QIcon &icon, const QString &text, QObject* parent);
     ^
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:89:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:88:5: note: candidate: QAction::QAction(const QString&, QObject*)
     QAction(const QString &text, QObject* parent);
     ^
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:88:5: note:   no known conversion for argument 1 from 'QIcon' to 'const QString&'
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:87:14: note: candidate: QAction::QAction(QObject*)
     explicit QAction(QObject* parent);
              ^
/usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:87:14: note:   candidate expects 1 argument, 2 provided
Comment 1 Christoph Feck 2017-02-09 18:29:45 UTC
What compiler and what Qt version? The constructor is valid, see http://doc-snapshots.qt.io/qt5-dev/qaction.html#QAction-2
Comment 2 Péter Szabados 2017-02-10 09:05:04 UTC
I was building in a Docker container with the following Dockerfile:

FROM ubuntu:xenial

RUN apt-get update
RUN apt-get install -y git cmake build-essential qtbase5-dev qttools5-dev-tools libqt5svg5-dev libboost-all-dev libkf5coreaddons-dev libkf5i18n-dev libkf5itemmodels-dev libkf5threadweaver-dev libkf5configwidgets-dev kio-dev libdwarf-dev gettext libunwind-dev libsparsehash-dev libunwind8 libkf5itemmodels5 libqt5svg5 libkf5configwidgets5 libkf5threadweaver5 libboost-iostreams1.58.0 libboost-program-options1.58.0 kio gdb
RUN git clone https://github.com/KDE/extra-cmake-modules
RUN cd extra-cmake-modules && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make install -j4 && \
    cd ../.. && \
    rm -rf extra-cmake-modules
RUN git clone https://github.com/KDE/kdiagram && \
    cd kdiagram && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make install -j4 && \
    cd ../.. && \
    rm -rf kdiagram
RUN git clone https://github.com/KDE/heaptrack && \
    cd heaptrack && \
    mkdir build && \
    cd build && \
    cmake .. -DCMAKE_BUILD_TYPE=Release && \
    make install -j4 && \
    cd ../.. && \
    rm -rf heaptrack
RUN apt-get purge -y git cmake build-essential qtbase5-dev qttools5-dev-tools libqt5svg5-dev libboost-all-dev libkf5coreaddons-dev libkf5i18n-dev libkf5itemmodels-dev libkf5threadweaver-dev libkf5configwidgets-dev kio-dev libdwarf-dev gettext libunwind-dev libsparsehash-dev && \
    apt-get autoremove -y && \
    apt-get clean && \
    apt-get autoclean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Comment 3 Milian Wolff 2017-02-12 12:31:57 UTC
Git commit d46be16155456af6cdc99d5b1e9cb20415a11ea1 by Milian Wolff.
Committed on 12/02/2017 at 12:31.
Pushed by mwolff into branch 'master'.

Pass explicit parent to QAction ctor, fixes build on Ubuntu Xenial.

Seems like the default of `= nullptr` has been added recently to Qt.

M  +1    -1    src/analyze/gui/mainwindow.cpp

https://commits.kde.org/heaptrack/d46be16155456af6cdc99d5b1e9cb20415a11ea1