[Gui] modernize some connect() settings

- addresses #6166
This commit is contained in:
Uwe
2023-01-12 02:01:35 +01:00
committed by wwmayer
parent 92398f94e3
commit ed995b5a15
17 changed files with 73 additions and 87 deletions

View File

@@ -87,8 +87,7 @@ CallTipsList::CallTipsList(QPlainTextEdit* parent)
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
parent->setPalette( pal );
connect(this, SIGNAL(itemActivated(QListWidgetItem *)),
this, SLOT(callTipItemActivated(QListWidgetItem *)));
connect(this, &Gui::CallTipsList::itemActivated, this, &CallTipsList::callTipItemActivated);
hideKeys.append(Qt::Key_Space);
hideKeys.append(Qt::Key_Exclam);

View File

@@ -302,8 +302,7 @@ void ButtonModel::loadConfig(const char *RequiredDeviceName)
CommandView::CommandView(QWidget *parent) : QTreeView(parent)
{
this->setEnabled(false);
connect(this, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(goClicked(const QModelIndex&)));
connect(this, &Gui::Dialog::CommandView::clicked, this, &CommandView::goClicked);
}
void CommandView::goChangeCommandSelection(const QString& commandName)

View File

@@ -93,7 +93,7 @@ void DlgObjectSelection::init(const std::vector<App::DocumentObject*> &objs,
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General");
ui->checkBoxAutoDeps->setChecked(hGrp->GetBool("ObjectSelectionAutoDeps", true));
connect(ui->checkBoxAutoDeps, SIGNAL(toggled(bool)), this, SLOT(onAutoDeps(bool)));
connect(ui->checkBoxAutoDeps, &QCheckBox::toggled, this, &DlgObjectSelection::onAutoDeps);
ui->checkBoxShowDeps->setChecked(hGrp->GetBool("ObjectSelectionShowDeps", false));
QObject::connect(ui->checkBoxShowDeps, &QCheckBox::toggled,

View File

@@ -44,7 +44,7 @@ using namespace Gui::Dialog;
UndoDialog::UndoDialog( QWidget* parent )
: QMenu( parent )
{
connect(this, SIGNAL(aboutToShow()), this, SLOT(onFetchInfo()));
connect(this, &Gui::Dialog::UndoDialog::aboutToShow, this, &UndoDialog::onFetchInfo);
}
/**
@@ -92,7 +92,7 @@ void UndoDialog::onSelected()
RedoDialog::RedoDialog( QWidget* parent )
: QMenu( parent )
{
connect(this, SIGNAL(aboutToShow()), this, SLOT(onFetchInfo()));
connect(this, &Gui::Dialog::RedoDialog::aboutToShow, this, &RedoDialog::onFetchInfo);
}
/**

View File

@@ -574,7 +574,7 @@ ExpressionLineEdit::ExpressionLineEdit(QWidget *parent, bool noProperty, char ch
, checkInList(checkInList)
, checkPrefix(checkPrefix)
{
connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(slotTextChanged(const QString&)));
connect(this, &Gui::ExpressionLineEdit::textEdited, this, &ExpressionLineEdit::slotTextChanged);
}
void ExpressionLineEdit::setPrefix(char prefix) {
@@ -596,7 +596,7 @@ void ExpressionLineEdit::setDocumentObject(const App::DocumentObject * currentDo
completer->setFilterMode(Qt::MatchContains);
connect(completer, SIGNAL(activated(QString)), this, SLOT(slotCompleteText(QString)));
connect(completer, SIGNAL(highlighted(QString)), this, SLOT(slotCompleteText(QString)));
connect(this, SIGNAL(textChanged2(QString,int)), completer, SLOT(slotUpdate(QString,int)));
connect(this, SIGNAL(textChanged2(QString, int)), completer, SLOT(slotUpdate(QString, int)));
}
}
@@ -685,7 +685,8 @@ ExpressionTextEdit::ExpressionTextEdit(QWidget *parent)
, block(true)
, exactMatch(false)
{
connect(this, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
connect(this, &Gui::ExpressionTextEdit::textChanged,
this, &ExpressionTextEdit::slotTextChanged);
}
void ExpressionTextEdit::setExactMatch(bool enabled) {

View File

@@ -77,8 +77,7 @@ bool DialogOptions::dontUseNativeColorDialog()
FileDialog::FileDialog(QWidget * parent)
: QFileDialog(parent)
{
connect(this, SIGNAL(filterSelected(const QString&)),
this, SLOT(onSelectedFilter(const QString&)));
connect(this, &Gui::FileDialog::filterSelected, this, &FileDialog::onSelectedFilter);
}
FileDialog::~FileDialog()
@@ -675,10 +674,8 @@ FileChooser::FileChooser ( QWidget * parent )
layout->addWidget( lineEdit );
connect(lineEdit, SIGNAL(textChanged(const QString &)),
this, SIGNAL(fileNameChanged(const QString &)));
connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(editingFinished()));
connect(lineEdit, &QLineEdit::textChanged, this, &FileChooser::fileNameChanged);
connect(lineEdit, &QLineEdit::editingFinished, this, &FileChooser::editingFinished);
button = new QPushButton(QLatin1String("..."), this);

View File

@@ -91,7 +91,7 @@ InputField::InputField(QWidget * parent)
iconLabel->setPixmap(pixmap);
iconLabel->setStyleSheet(QString::fromLatin1("QLabel { border: none; padding: 0px; }"));
iconLabel->hide();
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateIconLabel(const QString&)));
connect(this, &Gui::InputField::textChanged, this, &InputField::updateIconLabel);
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
QSize msz = minimumSizeHint();
@@ -100,8 +100,7 @@ InputField::InputField(QWidget * parent)
this->setContextMenuPolicy(Qt::DefaultContextMenu);
QObject::connect(this, SIGNAL(textChanged(QString)),
this, SLOT(newInput(QString)));
connect(this, &Gui::InputField::textChanged, this, &InputField::newInput);
}
InputField::~InputField()

View File

@@ -36,7 +36,6 @@
using namespace Gui;
namespace Gui {
struct SequencerDialogPrivate
{
@@ -49,7 +48,6 @@ struct SequencerDialogPrivate
};
}
SequencerDialog* SequencerDialog::_pclSingleton = nullptr;
SequencerDialog* SequencerDialog::instance()
@@ -305,7 +303,7 @@ ProgressDialog::ProgressDialog (SequencerDialog* s, QWidget * parent)
m_taskbarButton = nullptr;
m_taskbarButton = nullptr;
#endif
connect(this, SIGNAL(canceled()), this, SLOT(onCancel()));
connect(this, &Gui::ProgressDialog::canceled, this, &ProgressDialog::onCancel);
}
ProgressDialog::~ProgressDialog ()

View File

@@ -324,8 +324,7 @@ UIntSpinBox::UIntSpinBox (QWidget* parent)
{
d = new UIntSpinBoxPrivate;
d->mValidator = new UnsignedValidator(this->minimum(), this->maximum(), this);
connect(this, SIGNAL(valueChanged(int)),
this, SLOT(valueChange(int)));
connect(this, &Gui::UIntSpinBox::valueChanged, this, &UIntSpinBox::valueChange);
setRange(0, 99);
setValue(0);
updateValidator();

View File

@@ -50,22 +50,22 @@ TextEdit::TextEdit(QWidget* parent)
auto shortcut = new QShortcut(this);
shortcut->setKey(QKeySequence(QString::fromLatin1("CTRL+Space")));
shortcut->setContext(Qt::WidgetShortcut);
connect(shortcut, SIGNAL(activated()), this, SLOT(complete()));
connect(shortcut, &QShortcut::activated, this, &TextEdit::complete);
auto shortcutFind = new QShortcut(this);
shortcutFind->setKey(QKeySequence::Find);
shortcutFind->setContext(Qt::WidgetShortcut);
connect(shortcutFind, SIGNAL(activated()), this, SIGNAL(showSearchBar()));
connect(shortcutFind, &QShortcut::activated, this, &TextEdit::showSearchBar);
auto shortcutNext = new QShortcut(this);
shortcutNext->setKey(QKeySequence::FindNext);
shortcutNext->setContext(Qt::WidgetShortcut);
connect(shortcutNext, SIGNAL(activated()), this, SIGNAL(findNext()));
connect(shortcutNext, &QShortcut::activated, this, &TextEdit::findNext);
auto shortcutPrev = new QShortcut(this);
shortcutPrev->setKey(QKeySequence::FindPrevious);
shortcutPrev->setContext(Qt::WidgetShortcut);
connect(shortcutPrev, SIGNAL(activated()), this, SIGNAL(findPrevious()));
connect(shortcutPrev, &QShortcut::activated, this, &TextEdit::findPrevious);
}
/** Destroys the object and frees any allocated resources */
@@ -236,12 +236,12 @@ TextEditor::TextEditor(QWidget* parent)
// set colors and font
hPrefGrp->NotifyAll();
connect(this, SIGNAL(cursorPositionChanged()),
this, SLOT(highlightCurrentLine()));
connect(this, SIGNAL(blockCountChanged(int)),
this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(const QRect &, int)),
this, SLOT(updateLineNumberArea(const QRect &, int)));
connect(this, &Gui::TextEditor::cursorPositionChanged,
this, &TextEditor::highlightCurrentLine);
connect(this, &Gui::TextEditor::blockCountChanged,
this, &TextEditor::updateLineNumberAreaWidth);
connect(this, &Gui::TextEditor::updateRequest,
this, &TextEditor::updateLineNumberArea);
updateLineNumberAreaWidth(0);
highlightCurrentLine();

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QEvent>
@@ -30,8 +29,8 @@
#include "ToolBox.h"
using namespace Gui::DockWnd;
using namespace Gui::DockWnd;
/**
* Constructs a toolbox called \a name with parent \a parent and flags \a f.
@@ -40,7 +39,7 @@ ToolBox::ToolBox( QWidget *parent )
: QWidget(parent)
{
_pToolBox = new QToolBox( this );
connect( _pToolBox, SIGNAL( currentChanged(int) ), this, SIGNAL( currentChanged(int) ) );
connect(_pToolBox, &QToolBox::currentChanged, this, &ToolBox::currentChanged);
auto pGrid = new QGridLayout(this);
pGrid->addWidget(_pToolBox, 0, 0);

View File

@@ -503,22 +503,15 @@ TreeWidget::TreeWidget(const char* name, QWidget* parent)
this->selectTimer = new QTimer(this);
this->selectTimer->setSingleShot(true);
connect(this->statusTimer, SIGNAL(timeout()),
this, SLOT(onUpdateStatus()));
connect(this, SIGNAL(itemEntered(QTreeWidgetItem*, int)),
this, SLOT(onItemEntered(QTreeWidgetItem*)));
connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)),
this, SLOT(onItemCollapsed(QTreeWidgetItem*)));
connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)),
this, SLOT(onItemExpanded(QTreeWidgetItem*)));
connect(this, SIGNAL(itemSelectionChanged()),
this, SLOT(onItemSelectionChanged()));
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
this, SLOT(onItemChanged(QTreeWidgetItem*, int)));
connect(this->preselectTimer, SIGNAL(timeout()),
this, SLOT(onPreSelectTimer()));
connect(this->selectTimer, SIGNAL(timeout()),
this, SLOT(onSelectTimer()));
connect(this->statusTimer, &QTimer::timeout, this, &TreeWidget::onUpdateStatus);
connect(this, &Gui::TreeWidget::itemEntered, this, &TreeWidget::onItemEntered);
connect(this, &Gui::TreeWidget::itemCollapsed, this, &TreeWidget::onItemCollapsed);
connect(this, &Gui::TreeWidget::itemExpanded, this, &TreeWidget::onItemExpanded);
connect(this, &Gui::TreeWidget::itemSelectionChanged,
this, &TreeWidget::onItemSelectionChanged);
connect(this, &Gui::TreeWidget::itemChanged, this, &TreeWidget::onItemChanged);
connect(this->preselectTimer, &QTimer::timeout, this, &TreeWidget::onPreSelectTimer);
connect(this->selectTimer, &QTimer::timeout, this, &TreeWidget::onSelectTimer);
preselectTime.start();
setupText();

View File

@@ -531,9 +531,8 @@ ClearLineEdit::ClearLineEdit (QWidget * parent)
{
clearAction = this->addAction(QIcon(QString::fromLatin1(":/icons/edit-cleartext.svg")),
QLineEdit::TrailingPosition);
connect(clearAction, SIGNAL(triggered()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)),
this, SLOT(updateClearButton(const QString&)));
connect(clearAction, &QAction::triggered, this, &ClearLineEdit::clear);
connect(this, &Gui::ClearLineEdit::textChanged, this, &ClearLineEdit::updateClearButton);
}
void ClearLineEdit::resizeEvent(QResizeEvent *e)
@@ -1094,8 +1093,8 @@ LabelButton::LabelButton (QWidget * parent)
#endif
layout->addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(browse()));
connect(button, SIGNAL(clicked()), this, SIGNAL(buttonClicked()));
connect(button, &QPushButton::clicked, this, &LabelButton::browse);
connect(button, &QPushButton::clicked, this, &LabelButton::buttonClicked);
}
LabelButton::~LabelButton()
@@ -1301,12 +1300,12 @@ PropertyListEditor::PropertyListEditor(QWidget *parent) : QPlainTextEdit(parent)
{
lineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)),
this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)),
this, SLOT(updateLineNumberArea(QRect,int)));
connect(this, SIGNAL(cursorPositionChanged()),
this, SLOT(highlightCurrentLine()));
connect(this, &Gui::PropertyListEditor::blockCountChanged,
this, &PropertyListEditor::updateLineNumberAreaWidth);
connect(this, &Gui::PropertyListEditor::updateRequest,
this, &PropertyListEditor::updateLineNumberArea);
connect(this, &Gui::PropertyListEditor::cursorPositionChanged,
this, &PropertyListEditor::highlightCurrentLine);
updateLineNumberAreaWidth(0);
highlightCurrentLine();

View File

@@ -85,14 +85,18 @@ PropertyEditor::PropertyEditor(QWidget *parent)
this->setSelectionMode(QAbstractItemView::ExtendedSelection);
connect(this, SIGNAL(activated(const QModelIndex &)), this, SLOT(onItemActivated(const QModelIndex &)));
connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(onItemActivated(const QModelIndex &)));
connect(this, SIGNAL(expanded(const QModelIndex &)), this, SLOT(onItemExpanded(const QModelIndex &)));
connect(this, SIGNAL(collapsed(const QModelIndex &)), this, SLOT(onItemCollapsed(const QModelIndex &)));
connect(propertyModel, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
this, SLOT(onRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
connect(propertyModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
this, SLOT(onRowsRemoved(const QModelIndex &, int, int)));
connect(this, &Gui::PropertyEditor::PropertyEditor::activated,
this, &PropertyEditor::onItemActivated);
connect(this, &Gui::PropertyEditor::PropertyEditor::clicked,
this, &PropertyEditor::onItemActivated);
connect(this, &Gui::PropertyEditor::PropertyEditor::expanded,
this, &PropertyEditor::onItemExpanded);
connect(this, &Gui::PropertyEditor::PropertyEditor::collapsed,
this, &PropertyEditor::onItemCollapsed);
connect(propertyModel, &Gui::PropertyEditor::PropertyModel::rowsMoved,
this, &PropertyEditor::onRowsMoved);
connect(propertyModel, &Gui::PropertyEditor::PropertyModel::rowsRemoved,
this, &PropertyEditor::onRowsRemoved);
}
PropertyEditor::~PropertyEditor()

View File

@@ -1522,7 +1522,7 @@ PropertyEditorWidget::PropertyEditorWidget (QWidget * parent)
#endif
layout->addWidget(button);
connect(button, SIGNAL(clicked()), this, SIGNAL(buttonClick()));
connect(button, &QPushButton::clicked, this, &PropertyEditorWidget::buttonClick);
// QAbstractItemView will call selectAll() if a QLineEdit is the focus
// proxy. Since the QLineEdit here is read-only and not meant for editing,

View File

@@ -45,16 +45,16 @@ SketcherGeneralWidget::SketcherGeneralWidget(QWidget *parent)
ui->renderingOrder->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
// connecting the needed signals
connect(ui->checkBoxShowGrid, SIGNAL(toggled(bool)),
this, SIGNAL(emitToggleGridView(bool)));
connect(ui->checkBoxGridSnap, SIGNAL(toggled(bool)),
this, SIGNAL(emitToggleGridSnap(bool)));
connect(ui->gridSize, SIGNAL(valueChanged(double)),
this, SIGNAL(emitSetGridSize(double)));
connect(ui->checkBoxAutoconstraints, SIGNAL(toggled(bool)),
this, SIGNAL(emitToggleAutoconstraints(bool)));
connect(ui->checkBoxRedundantAutoconstraints, SIGNAL(toggled(bool)),
this, SIGNAL(emitToggleAvoidRedundant(bool)));
connect(ui->checkBoxShowGrid, &Gui::PrefCheckBox::toggled,
this, &SketcherGeneralWidget::emitToggleGridView);
connect(ui->checkBoxGridSnap, &Gui::PrefCheckBox::toggled,
this, &SketcherGeneralWidget::emitToggleGridSnap);
connect(ui->gridSize, qOverload<double>(&Gui::PrefQuantitySpinBox::valueChanged),
this, &SketcherGeneralWidget::emitSetGridSize);
connect(ui->checkBoxAutoconstraints, &Gui::PrefCheckBox::toggled,
this, &SketcherGeneralWidget::emitToggleAutoconstraints);
connect(ui->checkBoxRedundantAutoconstraints,
&Gui::PrefCheckBox::toggled, this, &SketcherGeneralWidget::emitToggleAvoidRedundant);
ui->renderingOrder->installEventFilter(this);
}

View File

@@ -292,12 +292,11 @@ QtColorPicker::QtColorPicker(QWidget *parent,
// Create color grid popup and connect to it.
popup = new ColorPickerPopup(cols, withColorDialog, this);
connect(popup, SIGNAL(selected(const QColor &)),
SLOT(setCurrentColor(const QColor &)));
connect(popup, SIGNAL(hid()), SLOT(popupClosed()));
connect(popup, &ColorPickerPopup::selected, this, &QtColorPicker::setCurrentColor);
connect(popup, &ColorPickerPopup::hid, this, &QtColorPicker::popupClosed);
// Connect this push button's pressed() signal.
connect(this, SIGNAL(toggled(bool)), SLOT(buttonPressed(bool)));
connect(this, &QtColorPicker::toggled, this, &QtColorPicker::buttonPressed);
}
/*!