lib_ui/ui/widgets/menu/menu_common.cpp
Ilya Fedin 8e5d35229a Simple replacements for Qt 6
QStringRef -> QStringView
QTextCursor constructor accepts a QTextDocument only
Some headers are moved, so paths are removed
QMatrix -> QTransform
Methods returning qsizetype are wrapped to int()s to allow compiler to deduce the type
2021-10-19 17:06:25 +04:00

27 lines
625 B
C++

// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/blob/master/LEGAL
//
#include "ui/widgets/menu/menu_common.h"
#include <QAction>
namespace Ui::Menu {
not_null<QAction*> CreateAction(
QWidget *parent,
const QString &text,
Fn<void()> &&callback) {
const auto action = new QAction(text, parent);
parent->connect(
action,
&QAction::triggered,
action,
std::move(callback),
Qt::QueuedConnection);
return action;
}
} // namespace Ui::Menu