freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype-demos][gsoc-2022-chariri] * src/ftinspect/maingu


From: Charlie Jiang (@cqjjjzr)
Subject: [Git][freetype/freetype-demos][gsoc-2022-chariri] * src/ftinspect/maingui.cpp: Use new signal/slots syntax.
Date: Wed, 06 Jul 2022 08:38:58 +0000

Charlie Jiang pushed to branch gsoc-2022-chariri at FreeType / FreeType Demo Programs

Commits:

  • 83b6bbb3
    by Charlie Jiang at 2022-07-06T16:35:38+08:00
    * src/ftinspect/maingui.cpp: Use new signal/slots syntax.
    
    Prefer new member-pointer based connection syntax over the old string-based
    one, because it provides compile-time check of the signal/slots, and can even
    connect to non-slot functions `std::function`s, or lambdas.
    
    However, to deal with overloads, we have to use `QOverload` struct to specify
    which overload to use.
    

1 changed file:

Changes:

  • src/ftinspect/maingui.cpp
    ... ... @@ -793,45 +793,45 @@ MainGUI::createLayout()
    793 793
     void
    
    794 794
     MainGUI::createConnections()
    
    795 795
     {
    
    796
    -  connect(settingPanel_, SIGNAL(fontReloadNeeded()),
    
    797
    -          SLOT(showFont()));
    
    798
    -  connect(settingPanel_, SIGNAL(repaintNeeded()),
    
    799
    -          SLOT(drawGlyph()));
    
    800
    -  connect(indexSelector_, SIGNAL(currentIndexChanged(int)), 
    
    801
    -      this, SLOT(setGlyphIndex(int)));
    
    802
    -  connect(sizeDoubleSpinBox_, SIGNAL(valueChanged(double)),
    
    803
    -          SLOT(drawGlyph()));
    
    804
    -  connect(unitsComboBox_, SIGNAL(currentIndexChanged(int)),
    
    805
    -          SLOT(checkUnits()));
    
    806
    -  connect(dpiSpinBox_, SIGNAL(valueChanged(int)),
    
    807
    -          SLOT(drawGlyph()));
    
    808
    -
    
    809
    -  connect(zoomSpinBox_, SIGNAL(valueChanged(int)),
    
    810
    -          SLOT(zoom()));
    
    811
    -  connect(glyphView_, SIGNAL(shiftWheelEvent(QWheelEvent*)), 
    
    812
    -          SLOT(wheelResize(QWheelEvent*)));
    
    813
    -  connect(glyphView_, SIGNAL(ctrlWheelEvent(QWheelEvent*)), 
    
    814
    -          SLOT(wheelZoom(QWheelEvent*)));
    
    796
    +  connect(settingPanel_, &SettingPanel::fontReloadNeeded,
    
    797
    +          this, &MainGUI::showFont);
    
    798
    +  connect(settingPanel_, &SettingPanel::repaintNeeded,
    
    799
    +          this, &MainGUI::drawGlyph);
    
    800
    +  connect(indexSelector_, &GlyphIndexSelector::currentIndexChanged, 
    
    801
    +          this, &MainGUI::setGlyphIndex);
    
    802
    +  connect(sizeDoubleSpinBox_, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
    
    803
    +          this, &MainGUI::drawGlyph);
    
    804
    +  connect(unitsComboBox_, QOverload<int>::of(&QComboBox::currentIndexChanged),
    
    805
    +          this, &MainGUI::checkUnits);
    
    806
    +  connect(dpiSpinBox_, QOverload<int>::of(&QSpinBox::valueChanged),
    
    807
    +          this, &MainGUI::drawGlyph);
    
    808
    +
    
    809
    +  connect(zoomSpinBox_, QOverload<int>::of(&QSpinBox::valueChanged),
    
    810
    +          this, &MainGUI::zoom);
    
    811
    +  connect(glyphView_, &QGraphicsViewx::shiftWheelEvent, 
    
    812
    +          this, &MainGUI::wheelResize);
    
    813
    +  connect(glyphView_, &QGraphicsViewx::ctrlWheelEvent, 
    
    814
    +          this, &MainGUI::wheelZoom);
    
    815 815
       connect(glyphView_->horizontalScrollBar(), &QScrollBar::valueChanged,
    
    816 816
               this, &MainGUI::updateGrid);
    
    817
    -  connect(glyphView_->verticalScrollBar(), &QScrollBar::valueChanged, this,
    
    818
    -          &MainGUI::updateGrid);
    
    819
    -
    
    820
    -  connect(centerGridButton_, SIGNAL(clicked()),
    
    821
    -          SLOT(backToCenter()));
    
    822
    -
    
    823
    -  connect(previousFontButton_, SIGNAL(clicked()),
    
    824
    -          SLOT(previousFont()));
    
    825
    -  connect(nextFontButton_, SIGNAL(clicked()),
    
    826
    -          SLOT(nextFont()));
    
    827
    -  connect(previousFaceButton_, SIGNAL(clicked()),
    
    828
    -          SLOT(previousFace()));
    
    829
    -  connect(nextFaceButton_, SIGNAL(clicked()),
    
    830
    -          SLOT(nextFace()));
    
    831
    -  connect(previousNamedInstanceButton_, SIGNAL(clicked()),
    
    832
    -          SLOT(previousNamedInstance()));
    
    833
    -  connect(nextNamedInstanceButton_, SIGNAL(clicked()),
    
    834
    -          SLOT(nextNamedInstance()));
    
    817
    +  connect(glyphView_->verticalScrollBar(), &QScrollBar::valueChanged, 
    
    818
    +          this, &MainGUI::updateGrid);
    
    819
    +
    
    820
    +  connect(centerGridButton_, &QPushButton::clicked,
    
    821
    +          this, &MainGUI::backToCenter);
    
    822
    +
    
    823
    +  connect(previousFontButton_, &QPushButton::clicked,
    
    824
    +          this, &MainGUI::previousFont);
    
    825
    +  connect(nextFontButton_, &QPushButton::clicked,
    
    826
    +          this, &MainGUI::nextFont);
    
    827
    +  connect(previousFaceButton_, &QPushButton::clicked,
    
    828
    +          this, &MainGUI::previousFace);
    
    829
    +  connect(nextFaceButton_, &QPushButton::clicked,
    
    830
    +          this, &MainGUI::nextFace);
    
    831
    +  connect(previousNamedInstanceButton_, &QPushButton::clicked,
    
    832
    +          this, &MainGUI::previousNamedInstance);
    
    833
    +  connect(nextNamedInstanceButton_, &QPushButton::clicked,
    
    834
    +          this, &MainGUI::nextNamedInstance);
    
    835 835
     
    
    836 836
       connect(&engine_->fontFileManager(), &FontFileManager::currentFileChanged,
    
    837 837
               this, &MainGUI::watchCurrentFont);
    
    ... ... @@ -843,21 +843,21 @@ MainGUI::createActions()
    843 843
     {
    
    844 844
       loadFontsAct_ = new QAction(tr("&Load Fonts"), this);
    
    845 845
       loadFontsAct_->setShortcuts(QKeySequence::Open);
    
    846
    -  connect(loadFontsAct_, SIGNAL(triggered()), SLOT(loadFonts()));
    
    846
    +  connect(loadFontsAct_, &QAction::triggered, this, &MainGUI::loadFonts);
    
    847 847
     
    
    848 848
       closeFontAct_ = new QAction(tr("&Close Font"), this);
    
    849 849
       closeFontAct_->setShortcuts(QKeySequence::Close);
    
    850
    -  connect(closeFontAct_, SIGNAL(triggered()), SLOT(closeFont()));
    
    850
    +  connect(closeFontAct_, &QAction::triggered, this, &MainGUI::closeFont);
    
    851 851
     
    
    852 852
       exitAct_ = new QAction(tr("E&xit"), this);
    
    853 853
       exitAct_->setShortcuts(QKeySequence::Quit);
    
    854
    -  connect(exitAct_, SIGNAL(triggered()), SLOT(close()));
    
    854
    +  connect(exitAct_, &QAction::triggered, this, &MainGUI::close);
    
    855 855
     
    
    856 856
       aboutAct_ = new QAction(tr("&About"), this);
    
    857
    -  connect(aboutAct_, SIGNAL(triggered()), SLOT(about()));
    
    857
    +  connect(aboutAct_, &QAction::triggered, this, &MainGUI::about);
    
    858 858
     
    
    859 859
       aboutQtAct_ = new QAction(tr("About &Qt"), this);
    
    860
    -  connect(aboutQtAct_, SIGNAL(triggered()), SLOT(aboutQt()));
    
    860
    +  connect(aboutQtAct_, &QAction::triggered, this, &MainGUI::aboutQt);
    
    861 861
     }
    
    862 862
     
    
    863 863
     
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]