MCPcopy Create free account
hub / github.com/KDE/labplot / charMenu

Method charMenu

src/frontend/widgets/LabelWidget.cpp:869–886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

867}
868
869void LabelWidget::charMenu() {
870 QMenu menu;
871 KCharSelect selection(this, nullptr, KCharSelect::SearchLine | KCharSelect::CharacterTable | KCharSelect::BlockCombos | KCharSelect::HistoryButtons);
872 QFont font = ui.teLabel->currentFont();
873 // use the system default size, otherwise the symbols might be hard to read
874 // if the current label font size is too small
875 font.setPointSize(QFont().pointSize());
876 selection.setCurrentFont(font);
877 connect(&selection, &KCharSelect::charSelected, this, &LabelWidget::insertChar);
878 connect(&selection, &KCharSelect::charSelected, &menu, &LabelWidget::close);
879
880 auto* widgetAction = new QWidgetAction(this);
881 widgetAction->setDefaultWidget(&selection);
882 menu.addAction(widgetAction);
883
884 QPoint pos(-menu.sizeHint().width() + ui.tbSymbols->width(), -menu.sizeHint().height());
885 menu.exec(ui.tbSymbols->mapToGlobal(pos));
886}
887
888void LabelWidget::insertChar(QChar c) {
889 ui.teLabel->insertPlainText(QString(c));

Callers

nothing calls this directly

Calls 5

heightMethod · 0.80
execMethod · 0.80
QFontClass · 0.50
widthMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected