Fix compilation of findfiles examples with QT_NO_CLIPBOARD

Amends change d1a30be5ab.

Task-number: QTBUG-55661
Change-Id: Ib7b1b4afd71b3c35493c15c8bf3e2570e321c986
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Friedemann Kleint 2016-09-02 15:42:53 +02:00 committed by Jani Heikkinen
parent 5971b88ecd
commit 75ef5859b6

View File

@ -294,15 +294,19 @@ void Window::contextMenu(const QPoint &pos)
if (!item)
return;
QMenu menu;
#ifndef QT_NO_CLIPBOARD
QAction *copyAction = menu.addAction("Copy Name");
#endif
QAction *openAction = menu.addAction("Open");
QAction *action = menu.exec(filesTable->mapToGlobal(pos));
if (!action)
return;
const QString fileName = fileNameOfItem(item);
if (action == copyAction)
QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
else if (action == openAction)
if (action == openAction)
openFile(fileName);
#ifndef QT_NO_CLIPBOARD
else if (action == copyAction)
QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
#endif
}
//! [16]