LCOV - code coverage report
Current view: top level - src/notationscene/widgets - fontStyleSelect.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 32 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #include "fontStyleSelect.h"
      24              : 
      25              : #include "ui/view/widgetutils.h"
      26              : 
      27              : using namespace mu::notation;
      28              : using namespace muse::ui;
      29              : 
      30              : using mu::engraving::FontStyle;
      31              : 
      32            0 : FontStyleSelect::FontStyleSelect(QWidget* parent)
      33            0 :     : QWidget(parent), muse::Contextable(muse::iocCtxForQWidget(this))
      34              : {
      35            0 :     setupUi(this);
      36              : 
      37            0 :     WidgetUtils::setWidgetIcon(bold, IconCode::Code::TEXT_BOLD);
      38            0 :     WidgetUtils::setWidgetIcon(italic, IconCode::Code::TEXT_ITALIC);
      39            0 :     WidgetUtils::setWidgetIcon(underline, IconCode::Code::TEXT_UNDERLINE);
      40            0 :     WidgetUtils::setWidgetIcon(strike, IconCode::Code::TEXT_STRIKE);
      41              : 
      42            0 :     connect(bold, &QPushButton::toggled, this, &FontStyleSelect::onFontStyleChanged);
      43            0 :     connect(italic, &QPushButton::toggled, this, &FontStyleSelect::onFontStyleChanged);
      44            0 :     connect(underline, &QPushButton::toggled, this, &FontStyleSelect::onFontStyleChanged);
      45            0 :     connect(strike, &QPushButton::toggled, this, &FontStyleSelect::onFontStyleChanged);
      46            0 : }
      47              : 
      48            0 : void FontStyleSelect::onFontStyleChanged()
      49              : {
      50            0 :     emit fontStyleChanged(fontStyle());
      51            0 : }
      52              : 
      53            0 : FontStyle FontStyleSelect::fontStyle() const
      54              : {
      55            0 :     FontStyle fs = FontStyle::Normal;
      56              : 
      57            0 :     if (bold->isChecked()) {
      58            0 :         fs = fs + FontStyle::Bold;
      59              :     }
      60            0 :     if (italic->isChecked()) {
      61            0 :         fs = fs + FontStyle::Italic;
      62              :     }
      63            0 :     if (underline->isChecked()) {
      64            0 :         fs = fs + FontStyle::Underline;
      65              :     }
      66            0 :     if (strike->isChecked()) {
      67            0 :         fs = fs + FontStyle::Strike;
      68              :     }
      69              : 
      70            0 :     return fs;
      71              : }
      72              : 
      73            0 : void FontStyleSelect::setFontStyle(FontStyle fs)
      74              : {
      75            0 :     bold->setChecked(fs & FontStyle::Bold);
      76            0 :     italic->setChecked(fs & FontStyle::Italic);
      77            0 :     underline->setChecked(fs & FontStyle::Underline);
      78            0 :     strike->setChecked(fs & FontStyle::Strike);
      79            0 : }
        

Generated by: LCOV version 2.0-1