MCPcopy Create free account
hub / github.com/TeXworks/texworks / PDFRuler

Method PDFRuler

modules/QtPDF/src/PDFRuler.cpp:27–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace QtPDF {
26
27PDFRuler::PDFRuler(PDFDocumentView *parent)
28 : QWidget(parent)
29{
30 connect(parent, &PDFDocumentView::updated, this, static_cast<void (PDFRuler::*)()>(&PDFRuler::update));
31
32 auto createUnitAction = [&](const Physical::Length::Unit u) {
33 QAction * action = new QAction(QString::fromUtf8(Physical::Length::unitSymbol(u)), this);
34 action->setData(u);
35 action->setCheckable(true);
36 action->setChecked(u == unit());
37 connect(action, &QAction::triggered, this, [this, u]() { setUnit(u); });
38 m_contextMenu.addAction(action);
39 m_contextMenuActionGroup->addAction(action);
40 return action;
41 };
42 m_unitActions.append(createUnitAction(Physical::Length::Centimeters));
43 m_unitActions.append(createUnitAction(Physical::Length::Inches));
44 m_unitActions.append(createUnitAction(Physical::Length::Bigpoints));
45
46 setCursor(Qt::OpenHandCursor);
47}
48
49void PDFRuler::setUnit(const Physical::Length::Unit & newUnit)
50{

Callers

nothing calls this directly

Calls 2

unitClass · 0.85
setDataMethod · 0.80

Tested by

no test coverage detected