Gui: fix possible problems with new style connect

* In UIntSpinBox rename the signal to not overwrite the signal of the base class
* In UIntSpinBox use the (ambiguous) signal 'valueChanged' of the base class QSpinBox
* To avoid that connect() fails use the function pointer of the Qt class where the signal is defined
This commit is contained in:
wmayer
2023-01-12 17:02:59 +01:00
parent 19d624396f
commit 103de43a4e
14 changed files with 43 additions and 50 deletions

View File

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

View File

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

View File

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

View File

@@ -574,7 +574,7 @@ ExpressionLineEdit::ExpressionLineEdit(QWidget *parent, bool noProperty, char ch
, checkInList(checkInList)
, checkPrefix(checkPrefix)
{
connect(this, &Gui::ExpressionLineEdit::textEdited, this, &ExpressionLineEdit::slotTextChanged);
connect(this, &QLineEdit::textEdited, this, &ExpressionLineEdit::slotTextChanged);
}
void ExpressionLineEdit::setPrefix(char prefix) {
@@ -685,8 +685,7 @@ ExpressionTextEdit::ExpressionTextEdit(QWidget *parent)
, block(true)
, exactMatch(false)
{
connect(this, &Gui::ExpressionTextEdit::textChanged,
this, &ExpressionTextEdit::slotTextChanged);
connect(this, &QPlainTextEdit::textChanged, this, &ExpressionTextEdit::slotTextChanged);
}
void ExpressionTextEdit::setExactMatch(bool enabled) {

View File

@@ -77,7 +77,7 @@ bool DialogOptions::dontUseNativeColorDialog()
FileDialog::FileDialog(QWidget * parent)
: QFileDialog(parent)
{
connect(this, &Gui::FileDialog::filterSelected, this, &FileDialog::onSelectedFilter);
connect(this, &QFileDialog::filterSelected, this, &FileDialog::onSelectedFilter);
}
FileDialog::~FileDialog()

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, &Gui::InputField::textChanged, this, &InputField::updateIconLabel);
connect(this, &QLineEdit::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,7 +100,7 @@ InputField::InputField(QWidget * parent)
this->setContextMenuPolicy(Qt::DefaultContextMenu);
connect(this, &Gui::InputField::textChanged, this, &InputField::newInput);
connect(this, &QLineEdit::textChanged, this, &InputField::newInput);
}
InputField::~InputField()

View File

@@ -303,7 +303,7 @@ ProgressDialog::ProgressDialog (SequencerDialog* s, QWidget * parent)
m_taskbarButton = nullptr;
m_taskbarButton = nullptr;
#endif
connect(this, &Gui::ProgressDialog::canceled, this, &ProgressDialog::onCancel);
connect(this, &QProgressDialog::canceled, this, &ProgressDialog::onCancel);
}
ProgressDialog::~ProgressDialog ()

View File

@@ -324,7 +324,7 @@ UIntSpinBox::UIntSpinBox (QWidget* parent)
{
d = new UIntSpinBoxPrivate;
d->mValidator = new UnsignedValidator(this->minimum(), this->maximum(), this);
connect(this, &Gui::UIntSpinBox::valueChanged, this, &UIntSpinBox::valueChange);
connect(this, qOverload<int>(&QSpinBox::valueChanged), this, &UIntSpinBox::valueChange);
setRange(0, 99);
setValue(0);
updateValidator();
@@ -361,7 +361,7 @@ void UIntSpinBox::setValue(uint value)
void UIntSpinBox::valueChange(int value)
{
Q_EMIT valueChanged(d->mapToUInt(value));
Q_EMIT unsignedChanged(d->mapToUInt(value));
}
uint UIntSpinBox::minimum() const
@@ -422,8 +422,8 @@ bool UIntSpinBox::apply(const std::string & propName)
Gui::Command::doCommand(Gui::Command::Doc, "%s = %u", propName.c_str(), value());
return true;
}
else
return false;
return false;
}
void UIntSpinBox::setNumberExpression(App::NumberExpression* expr)

View File

@@ -136,7 +136,7 @@ public:
void paintEvent(QPaintEvent *event) override;
Q_SIGNALS:
void valueChanged( uint value ); // clazy:exclude=overloaded-signal
void unsignedChanged( uint value );
public Q_SLOTS:
void setValue( uint value );

View File

@@ -236,12 +236,12 @@ TextEditor::TextEditor(QWidget* parent)
// set colors and font
hPrefGrp->NotifyAll();
connect(this, &Gui::TextEditor::cursorPositionChanged,
this, &TextEditor::highlightCurrentLine);
connect(this, &Gui::TextEditor::blockCountChanged,
this, &TextEditor::updateLineNumberAreaWidth);
connect(this, &Gui::TextEditor::updateRequest,
this, &TextEditor::updateLineNumberArea);
connect(this, &QPlainTextEdit::cursorPositionChanged,
this, &TextEditor::highlightCurrentLine);
connect(this, &QPlainTextEdit::blockCountChanged,
this, &TextEditor::updateLineNumberAreaWidth);
connect(this, &QPlainTextEdit::updateRequest,
this, &TextEditor::updateLineNumberArea);
updateLineNumberAreaWidth(0);
highlightCurrentLine();

View File

@@ -504,12 +504,12 @@ TreeWidget::TreeWidget(const char* name, QWidget* parent)
this->selectTimer->setSingleShot(true);
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, &QTreeWidget::itemEntered, this, &TreeWidget::onItemEntered);
connect(this, &QTreeWidget::itemCollapsed, this, &TreeWidget::onItemCollapsed);
connect(this, &QTreeWidget::itemExpanded, this, &TreeWidget::onItemExpanded);
connect(this, &QTreeWidget::itemSelectionChanged,
this, &TreeWidget::onItemSelectionChanged);
connect(this, &QTreeWidget::itemChanged, this, &TreeWidget::onItemChanged);
connect(this->preselectTimer, &QTimer::timeout, this, &TreeWidget::onPreSelectTimer);
connect(this->selectTimer, &QTimer::timeout, this, &TreeWidget::onSelectTimer);
preselectTime.start();

View File

@@ -532,7 +532,7 @@ ClearLineEdit::ClearLineEdit (QWidget * parent)
clearAction = this->addAction(QIcon(QString::fromLatin1(":/icons/edit-cleartext.svg")),
QLineEdit::TrailingPosition);
connect(clearAction, &QAction::triggered, this, &ClearLineEdit::clear);
connect(this, &Gui::ClearLineEdit::textChanged, this, &ClearLineEdit::updateClearButton);
connect(this, &QLineEdit::textChanged, this, &ClearLineEdit::updateClearButton);
}
void ClearLineEdit::resizeEvent(QResizeEvent *e)
@@ -1300,11 +1300,11 @@ PropertyListEditor::PropertyListEditor(QWidget *parent) : QPlainTextEdit(parent)
{
lineNumberArea = new LineNumberArea(this);
connect(this, &Gui::PropertyListEditor::blockCountChanged,
connect(this, &QPlainTextEdit::blockCountChanged,
this, &PropertyListEditor::updateLineNumberAreaWidth);
connect(this, &Gui::PropertyListEditor::updateRequest,
connect(this, &QPlainTextEdit::updateRequest,
this, &PropertyListEditor::updateLineNumberArea);
connect(this, &Gui::PropertyListEditor::cursorPositionChanged,
connect(this, &QPlainTextEdit::cursorPositionChanged,
this, &PropertyListEditor::highlightCurrentLine);
updateLineNumberAreaWidth(0);

View File

@@ -75,7 +75,7 @@ PropertyEditor::PropertyEditor(QWidget *parent)
setExpandsOnDoubleClick(true);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QStyleOptionViewItem opt = viewOptions();
QStyleOptionViewItem opt = PropertyEditor::viewOptions();
#else
QStyleOptionViewItem opt;
initViewItemOption(&opt);
@@ -85,18 +85,12 @@ PropertyEditor::PropertyEditor(QWidget *parent)
this->setSelectionMode(QAbstractItemView::ExtendedSelection);
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);
connect(this, &QTreeView::activated, this, &PropertyEditor::onItemActivated);
connect(this, &QTreeView::clicked, this, &PropertyEditor::onItemActivated);
connect(this, &QTreeView::expanded, this, &PropertyEditor::onItemExpanded);
connect(this, &QTreeView::collapsed, this, &PropertyEditor::onItemCollapsed);
connect(propertyModel, &QAbstractItemModel::rowsMoved, this, &PropertyEditor::onRowsMoved);
connect(propertyModel, &QAbstractItemModel::rowsRemoved, this, &PropertyEditor::onRowsRemoved);
}
PropertyEditor::~PropertyEditor()

View File

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