MCPcopy Create free account
hub / github.com/YACReader/yacreader / wrappedToolbarAction

Method wrappedToolbarAction

common/yacreader_global_gui.cpp:56–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56QAction *YACReader::wrappedToolbarAction(QAction *action)
57{
58 auto a = new QAction(action->text());
59
60 a->setEnabled(action->isEnabled());
61 a->setCheckable(action->isCheckable());
62
63 a->setChecked(action->isChecked());
64
65 QObject::connect(a, &QAction::triggered, action, &QAction::triggered);
66
67 QObject::connect(action, &QAction::changed, action, [=]() {
68 a->setEnabled(action->isEnabled());
69 a->setCheckable(action->isCheckable());
70
71 a->setChecked(action->isChecked());
72 });
73 QObject::connect(a, &QAction::toggled, action, &QAction::setChecked);
74 QObject::connect(action, &QAction::toggled, a, &QAction::setChecked);
75
76 // asign a to action somehow so we can retrieve it later
77 action->setProperty("wrappedToolbarAction", QVariant::fromValue<QObject *>(a));
78
79 return a;
80}
81
82QPixmap YACReader::hdpiPixmap(const QString &file, QSize size)
83{

Callers

nothing calls this directly

Calls 2

textMethod · 0.80
isEnabledMethod · 0.80

Tested by

no test coverage detected