Port to new connect api

Change-Id: I31078e08f46892e94597f48fd27057a16039eb5a
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Montel Laurent
2015-02-06 10:16:12 +01:00
committed by hjk
parent 835f1fbcd8
commit dd8f2dda5c
11 changed files with 210 additions and 125 deletions

View File

@@ -67,31 +67,50 @@ ContextPaneTextWidget::ContextPaneTextWidget(QWidget *parent) :
ui->colorButton->setShowArrow(false); ui->colorButton->setShowArrow(false);
ui->textColorButton->setShowArrow(false); ui->textColorButton->setShowArrow(false);
connect(ui->colorButton, SIGNAL(toggled(bool)), this, SLOT(onColorButtonToggled(bool))); connect(ui->colorButton, &QmlEditorWidgets::ColorButton::toggled,
connect(ui->textColorButton, SIGNAL(toggled(bool)), this, SLOT(onTextColorButtonToggled(bool))); this, &ContextPaneTextWidget::onColorButtonToggled);
connect(ui->textColorButton, &QmlEditorWidgets::ColorButton::toggled,
this, &ContextPaneTextWidget::onTextColorButtonToggled);
ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget()); ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget());
connect(parentContextWidget->colorDialog(), SIGNAL(accepted(QColor)), this, SLOT(onColorDialogApplied(QColor))); connect(parentContextWidget->colorDialog(), &CustomColorDialog::accepted,
connect(parentContextWidget->colorDialog(), SIGNAL(rejected()), this, SLOT(onColorDialogCancled())); this, &ContextPaneTextWidget::onColorDialogApplied);
connect(parentContextWidget->colorDialog(), &CustomColorDialog::rejected,
this, &ContextPaneTextWidget::onColorDialogCancled);
connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onFontSizeChanged(int))); connect(ui->fontSizeSpinBox,
connect(ui->fontSizeSpinBox, SIGNAL(formatChanged()), this, SLOT(onFontFormatChanged())); static_cast<void (QmlEditorWidgets::FontSizeSpinBox::*)(int)>(&QmlEditorWidgets::FontSizeSpinBox::valueChanged),
this, &ContextPaneTextWidget::onFontSizeChanged);
connect(ui->fontSizeSpinBox, &QmlEditorWidgets::FontSizeSpinBox::formatChanged,
this, &ContextPaneTextWidget::onFontFormatChanged);
connect(ui->boldButton, SIGNAL(toggled(bool)), this, SLOT(onBoldCheckedChanged(bool))); connect(ui->boldButton, &QToolButton::toggled,
connect(ui->italicButton, SIGNAL(toggled(bool)), this, SLOT(onItalicCheckedChanged(bool))); this, &ContextPaneTextWidget::onBoldCheckedChanged);
connect(ui->underlineButton, SIGNAL(toggled(bool)), this, SLOT(onUnderlineCheckedChanged(bool))); connect(ui->italicButton, &QToolButton::toggled,
connect(ui->strikeoutButton, SIGNAL(toggled(bool)), this, SLOT(onStrikeoutCheckedChanged(bool))); this, &ContextPaneTextWidget::onItalicCheckedChanged);
connect(ui->fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(onCurrentFontChanged(QFont))); connect(ui->underlineButton, &QToolButton::toggled,
this, &ContextPaneTextWidget::onUnderlineCheckedChanged);
connect(ui->strikeoutButton, &QToolButton::toggled,
this, &ContextPaneTextWidget::onStrikeoutCheckedChanged);
connect(ui->fontComboBox, &QFontComboBox::currentFontChanged,
this, &ContextPaneTextWidget::onCurrentFontChanged);
connect(ui->centerHAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged())); connect(ui->centerHAlignmentButton, &QToolButton::toggled,
connect(ui->leftAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged())); this, &ContextPaneTextWidget::onHorizontalAlignmentChanged);
connect(ui->rightAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged())); connect(ui->leftAlignmentButton, &QToolButton::toggled,
this, &ContextPaneTextWidget::onHorizontalAlignmentChanged);
connect(ui->rightAlignmentButton, &QToolButton::toggled,
this, &ContextPaneTextWidget::onHorizontalAlignmentChanged);
connect(ui->centerVAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged())); connect(ui->centerVAlignmentButton, &QToolButton::toggled,
connect(ui->topAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged())); this, &ContextPaneTextWidget::onVerticalAlignmentChanged);
connect(ui->bottomAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged())); connect(ui->topAlignmentButton, &QToolButton::toggled,
this, &ContextPaneTextWidget::onVerticalAlignmentChanged);
connect(ui->bottomAlignmentButton, &QToolButton::toggled,
this, &ContextPaneTextWidget::onVerticalAlignmentChanged);
connect(ui->styleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onStyleComboBoxChanged(QString))); connect(ui->styleComboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &ContextPaneTextWidget::onStyleComboBoxChanged);
} }
static inline bool checkIfBoolean(const QVariant &v) static inline bool checkIfBoolean(const QVariant &v)

View File

@@ -183,7 +183,7 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
m_toolButton->setFixedSize(16, 16); m_toolButton->setFixedSize(16, 16);
m_toolButton->setToolTip(tr("Hides this toolbar.")); m_toolButton->setToolTip(tr("Hides this toolbar."));
connect(m_toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane())); connect(m_toolButton, &QToolButton::clicked, this, &ContextPaneWidget::onTogglePane);
layout->addWidget(m_toolButton, 0, 0, 1, 1); layout->addWidget(m_toolButton, 0, 0, 1, 1);
colorDialog(); colorDialog();
@@ -431,9 +431,12 @@ void ContextPaneWidget::protectedMoved()
QWidget* ContextPaneWidget::createFontWidget() QWidget* ContextPaneWidget::createFontWidget()
{ {
m_textWidget = new ContextPaneTextWidget(this); m_textWidget = new ContextPaneTextWidget(this);
connect(m_textWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant))); connect(m_textWidget, &ContextPaneTextWidget::propertyChanged,
connect(m_textWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString))); this, &ContextPaneWidget::propertyChanged);
connect(m_textWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool))); connect(m_textWidget, &ContextPaneTextWidget::removeProperty,
this, &ContextPaneWidget::removeProperty);
connect(m_textWidget, &ContextPaneTextWidget::removeAndChangeProperty,
this, &ContextPaneWidget::removeAndChangeProperty);
return m_textWidget; return m_textWidget;
} }
@@ -442,9 +445,12 @@ QWidget* ContextPaneWidget::createEasingWidget()
{ {
m_easingWidget = new EasingContextPane(this); m_easingWidget = new EasingContextPane(this);
connect(m_easingWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant))); connect(m_easingWidget, &EasingContextPane::propertyChanged,
connect(m_easingWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString))); this, &ContextPaneWidget::propertyChanged);
connect(m_easingWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool))); connect(m_easingWidget, &EasingContextPane::removeProperty,
this, &ContextPaneWidget::removeProperty);
connect(m_easingWidget, &EasingContextPane::removeAndChangeProperty,
this, &ContextPaneWidget::removeAndChangeProperty);
return m_easingWidget; return m_easingWidget;
} }
@@ -452,9 +458,12 @@ QWidget* ContextPaneWidget::createEasingWidget()
QWidget *ContextPaneWidget::createImageWidget() QWidget *ContextPaneWidget::createImageWidget()
{ {
m_imageWidget = new ContextPaneWidgetImage(this); m_imageWidget = new ContextPaneWidgetImage(this);
connect(m_imageWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant))); connect(m_imageWidget, &ContextPaneWidgetImage::propertyChanged,
connect(m_imageWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString))); this, &ContextPaneWidget::propertyChanged);
connect(m_imageWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool))); connect(m_imageWidget, &ContextPaneWidgetImage::removeProperty,
this, &ContextPaneWidget::removeProperty);
connect(m_imageWidget, &ContextPaneWidgetImage::removeAndChangeProperty,
this, &ContextPaneWidget::removeAndChangeProperty);
return m_imageWidget; return m_imageWidget;
} }
@@ -462,9 +471,12 @@ QWidget *ContextPaneWidget::createImageWidget()
QWidget *ContextPaneWidget::createBorderImageWidget() QWidget *ContextPaneWidget::createBorderImageWidget()
{ {
m_borderImageWidget = new ContextPaneWidgetImage(this, true); m_borderImageWidget = new ContextPaneWidgetImage(this, true);
connect(m_borderImageWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant))); connect(m_borderImageWidget, &ContextPaneWidgetImage::propertyChanged,
connect(m_borderImageWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString))); this, &ContextPaneWidget::propertyChanged);
connect(m_borderImageWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool))); connect(m_borderImageWidget, &ContextPaneWidgetImage::removeProperty,
this, &ContextPaneWidget::removeProperty);
connect(m_borderImageWidget, &ContextPaneWidgetImage::removeAndChangeProperty,
this, &ContextPaneWidget::removeAndChangeProperty);
return m_borderImageWidget; return m_borderImageWidget;
@@ -473,9 +485,12 @@ QWidget *ContextPaneWidget::createBorderImageWidget()
QWidget *ContextPaneWidget::createRectangleWidget() QWidget *ContextPaneWidget::createRectangleWidget()
{ {
m_rectangleWidget = new ContextPaneWidgetRectangle(this); m_rectangleWidget = new ContextPaneWidgetRectangle(this);
connect(m_rectangleWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant))); connect(m_rectangleWidget, &ContextPaneWidgetRectangle::propertyChanged,
connect(m_rectangleWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString))); this, &ContextPaneWidget::propertyChanged);
connect(m_rectangleWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool))); connect(m_rectangleWidget, &ContextPaneWidgetRectangle::removeProperty,
this, &ContextPaneWidget::removeProperty);
connect(m_rectangleWidget, &ContextPaneWidgetRectangle::removeAndChangeProperty,
this, &ContextPaneWidget::removeAndChangeProperty);
return m_rectangleWidget; return m_rectangleWidget;
} }

View File

@@ -89,18 +89,28 @@ ContextPaneWidgetImage::ContextPaneWidgetImage(QWidget *parent, bool borderImage
uiBorderImage->label->installEventFilter(labelFilter); uiBorderImage->label->installEventFilter(labelFilter);
connect(uiBorderImage->verticalTileRadioButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalStretchChanged())); connect(uiBorderImage->verticalTileRadioButton, &QRadioButton::toggled,
connect(uiBorderImage->verticalStretchRadioButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalStretchChanged())); this, &ContextPaneWidgetImage::onVerticalStretchChanged);
connect(uiBorderImage->verticalTileRadioButtonNoCrop, SIGNAL(toggled(bool)), this, SLOT(onVerticalStretchChanged())); connect(uiBorderImage->verticalStretchRadioButton, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onVerticalStretchChanged);
connect(uiBorderImage->verticalTileRadioButtonNoCrop, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onVerticalStretchChanged);
connect(uiBorderImage->horizontalTileRadioButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalStretchChanged())); connect(uiBorderImage->horizontalTileRadioButton, &QRadioButton::toggled,
connect(uiBorderImage->horizontalStretchRadioButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalStretchChanged())); this, &ContextPaneWidgetImage::onHorizontalStretchChanged);
connect(uiBorderImage->horizontalTileRadioButtonNoCrop, SIGNAL(toggled(bool)), this, SLOT(onHorizontalStretchChanged())); connect(uiBorderImage->horizontalStretchRadioButton, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onHorizontalStretchChanged);
connect(uiBorderImage->horizontalTileRadioButtonNoCrop, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onHorizontalStretchChanged);
PreviewLabel *previewLabel = previewDialog()->previewLabel(); PreviewLabel *previewLabel = previewDialog()->previewLabel();
connect(previewLabel, SIGNAL(leftMarginChanged()), this, SLOT(onLeftMarginsChanged())); connect(previewLabel, &PreviewLabel::leftMarginChanged,
connect(previewLabel, SIGNAL(rightMarginChanged()), this, SLOT(onRightMarginsChanged())); this, &ContextPaneWidgetImage::onLeftMarginsChanged);
connect(previewLabel, SIGNAL(topMarginChanged()), this, SLOT(onTopMarginsChanged())); connect(previewLabel, &PreviewLabel::rightMarginChanged,
connect(previewLabel, SIGNAL(bottomMarginChanged()), this, SLOT(onBottomMarginsChanged())); this, &ContextPaneWidgetImage::onRightMarginsChanged);
connect(previewLabel, &PreviewLabel::topMarginChanged,
this, &ContextPaneWidgetImage::onTopMarginsChanged);
connect(previewLabel, &PreviewLabel::bottomMarginChanged,
this, &ContextPaneWidgetImage::onBottomMarginsChanged);
} else { } else {
ui = new Ui::ContextPaneWidgetImage; ui = new Ui::ContextPaneWidgetImage;
@@ -110,19 +120,27 @@ ContextPaneWidgetImage::ContextPaneWidgetImage(QWidget *parent, bool borderImage
m_fileWidget = ui->fileWidget; m_fileWidget = ui->fileWidget;
m_sizeLabel = ui->sizeLabel; m_sizeLabel = ui->sizeLabel;
connect(ui->stretchRadioButton, SIGNAL(toggled(bool)), this, SLOT(onStretchChanged())); connect(ui->stretchRadioButton, &QRadioButton::toggled,
connect(ui->tileRadioButton, SIGNAL(toggled(bool)), this, SLOT(onStretchChanged())); this, &ContextPaneWidgetImage::onStretchChanged);
connect(ui->horizontalStretchRadioButton, SIGNAL(toggled(bool)), this, SLOT(onStretchChanged())); connect(ui->tileRadioButton, &QRadioButton::toggled,
connect(ui->verticalStretchRadioButton, SIGNAL(toggled(bool)), this, SLOT(onStretchChanged())); this, &ContextPaneWidgetImage::onStretchChanged);
connect(ui->preserveAspectFitRadioButton, SIGNAL(toggled(bool)), this, SLOT(onStretchChanged())); connect(ui->horizontalStretchRadioButton, &QRadioButton::toggled,
connect(ui->cropAspectFitRadioButton, SIGNAL(toggled(bool)), this, SLOT(onStretchChanged())); this, &ContextPaneWidgetImage::onStretchChanged);
connect(ui->verticalStretchRadioButton, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onStretchChanged);
connect(ui->preserveAspectFitRadioButton, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onStretchChanged);
connect(ui->cropAspectFitRadioButton, &QRadioButton::toggled,
this, &ContextPaneWidgetImage::onStretchChanged);
} }
previewDialog(); previewDialog();
m_fileWidget->setShowComboBox(true); m_fileWidget->setShowComboBox(true);
m_fileWidget->setFilter(QLatin1String("*.png *.gif *.jpg")); m_fileWidget->setFilter(QLatin1String("*.png *.gif *.jpg"));
connect(m_fileWidget, SIGNAL(fileNameChanged(QUrl)), this, SLOT(onFileNameChanged())); connect(m_fileWidget, &FileWidget::fileNameChanged,
connect(labelFilter, SIGNAL(doubleClicked()), this, SLOT(onPixmapDoubleClicked())); this, &ContextPaneWidgetImage::onFileNameChanged);
connect(labelFilter, &LabelFilter::doubleClicked,
this, &ContextPaneWidgetImage::onPixmapDoubleClicked);
} }
@@ -881,7 +899,7 @@ PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
toolButton->setIcon(icon); toolButton->setIcon(icon);
toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly); toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
toolButton->setFixedSize(icon.availableSizes().value(0) + QSize(4, 4)); toolButton->setFixedSize(icon.availableSizes().value(0) + QSize(4, 4));
connect(toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane())); connect(toolButton, &QToolButton::clicked, this, &PreviewDialog::onTogglePane);
QScrollArea *scrollArea = new QScrollArea(this); QScrollArea *scrollArea = new QScrollArea(this);
WheelFilter *wheelFilter = new WheelFilter(scrollArea); WheelFilter *wheelFilter = new WheelFilter(scrollArea);
@@ -906,7 +924,7 @@ PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
wheelFilter->setTarget(this); wheelFilter->setTarget(this);
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderMoved(int))); connect(m_slider, &QSlider::valueChanged, this, &PreviewDialog::onSliderMoved);
foreach (QWidget *childWidget, findChildren<QWidget*>()) { foreach (QWidget *childWidget, findChildren<QWidget*>()) {
childWidget->installEventFilter(wheelFilter); childWidget->installEventFilter(wheelFilter);

View File

@@ -50,23 +50,33 @@ ContextPaneWidgetRectangle::ContextPaneWidgetRectangle(QWidget *parent) :
ui->colorColorButton->setShowArrow(false); ui->colorColorButton->setShowArrow(false);
ui->borderColorButton->setShowArrow(false); ui->borderColorButton->setShowArrow(false);
connect(ui->colorColorButton, SIGNAL(toggled(bool)), this, SLOT(onColorButtonToggled(bool))); connect(ui->colorColorButton, &QmlEditorWidgets::ColorButton::toggled,
connect(ui->borderColorButton, SIGNAL(toggled(bool)), this, SLOT(onBorderColorButtonToggled(bool))); this, &ContextPaneWidgetRectangle::onColorButtonToggled);
connect(ui->borderColorButton, &QmlEditorWidgets::ColorButton::toggled,
this, &ContextPaneWidgetRectangle::onBorderColorButtonToggled);
connect(ui->colorSolid, SIGNAL(clicked()), this, SLOT(onColorSolidClicked())); connect(ui->colorSolid, &QToolButton::clicked,
connect(ui->borderSolid, SIGNAL(clicked()), this, SLOT(onBorderSolidClicked())); this, &ContextPaneWidgetRectangle::onColorSolidClicked);
connect(ui->borderSolid, &QToolButton::clicked,
this, &ContextPaneWidgetRectangle::onBorderSolidClicked);
connect(ui->colorNone, SIGNAL(clicked()), this, SLOT(onColorNoneClicked())); connect(ui->colorNone, &QToolButton::clicked,
connect(ui->borderNone, SIGNAL(clicked()), this, SLOT(onBorderNoneClicked())); this, &ContextPaneWidgetRectangle::onColorNoneClicked);
connect(ui->borderNone, &QToolButton::clicked,
this, &ContextPaneWidgetRectangle::onBorderNoneClicked);
connect(ui->colorGradient, SIGNAL(clicked()), this, SLOT(onGradientClicked())); connect(ui->colorGradient, &QToolButton::clicked, this, &ContextPaneWidgetRectangle::onGradientClicked);
ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget()); ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget());
connect(parentContextWidget->colorDialog(), SIGNAL(accepted(QColor)), this, SLOT(onColorDialogApplied(QColor))); connect(parentContextWidget->colorDialog(), &CustomColorDialog::accepted,
connect(parentContextWidget->colorDialog(), SIGNAL(rejected()), this, SLOT(onColorDialogCancled())); this, &ContextPaneWidgetRectangle::onColorDialogApplied);
connect(parentContextWidget->colorDialog(), &CustomColorDialog::rejected,
this, &ContextPaneWidgetRectangle::onColorDialogCancled);
connect(ui->gradientLine, SIGNAL(openColorDialog(QPoint)), this, SLOT(onGradientLineDoubleClicked(QPoint))); connect(ui->gradientLine, &QmlEditorWidgets::GradientLine::openColorDialog,
connect(ui->gradientLine, SIGNAL(gradientChanged()), this, SLOT(onUpdateGradient())); this, &ContextPaneWidgetRectangle::onGradientLineDoubleClicked);
connect(ui->gradientLine, &QmlEditorWidgets::GradientLine::gradientChanged,
this, &ContextPaneWidgetRectangle::onUpdateGradient);
} }
ContextPaneWidgetRectangle::~ContextPaneWidgetRectangle() ContextPaneWidgetRectangle::~ContextPaneWidgetRectangle()

View File

@@ -121,15 +121,23 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
resize(sizeHint()); resize(sizeHint());
connect(m_colorBox, SIGNAL(colorChanged()), this, SLOT(onColorBoxChanged())); connect(m_colorBox, &ColorBox::colorChanged, this, &CustomColorDialog::onColorBoxChanged);
connect(m_alphaSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); connect(m_alphaSpinBox,
connect(m_rSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
connect(m_gSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); this, &CustomColorDialog::spinBoxChanged);
connect(m_bSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged())); connect(m_rSpinBox,
connect(m_hueControl, SIGNAL(hueChanged(int)), this, SLOT(onHueChanged(int))); static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &CustomColorDialog::spinBoxChanged);
connect(m_gSpinBox,
static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &CustomColorDialog::spinBoxChanged);
connect(m_bSpinBox,
static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &CustomColorDialog::spinBoxChanged);
connect(m_hueControl, &HueControl::hueChanged, this, &CustomColorDialog::onHueChanged);
connect(applyButton, SIGNAL(pressed()), this, SLOT(onAccept())); connect(applyButton, &QPushButton::pressed, this, &CustomColorDialog::onAccept);
connect(cancelButton, SIGNAL(pressed()), this, SIGNAL(rejected())); connect(cancelButton, &QPushButton::pressed, this, &CustomColorDialog::rejected);
m_alphaSpinBox->setMaximum(1); m_alphaSpinBox->setMaximum(1);
m_rSpinBox->setMaximum(1); m_rSpinBox->setMaximum(1);

View File

@@ -62,9 +62,9 @@ FileWidget::FileWidget(QWidget *parent) :
m_comboBox->setEditable(true); m_comboBox->setEditable(true);
layout->addWidget(m_pushButton); layout->addWidget(m_pushButton);
m_pushButton->setText(QLatin1String("...")); m_pushButton->setText(QLatin1String("..."));
connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(lineEditChanged())); connect(m_lineEdit, &QLineEdit::editingFinished, this, &FileWidget::lineEditChanged);
connect(m_pushButton, SIGNAL(released()), this, SLOT(onButtonReleased())); connect(m_pushButton, &QToolButton::released, this, &FileWidget::onButtonReleased);
connect(m_comboBox, SIGNAL(editTextChanged(QString)), this, SLOT(comboBoxChanged())); connect(m_comboBox, &QComboBox::editTextChanged, this, &FileWidget::comboBoxChanged);
} }
FileWidget::~FileWidget() FileWidget::~FileWidget()

View File

@@ -38,7 +38,8 @@ namespace QmlEditorWidgets {
FontSizeSpinBox::FontSizeSpinBox(QWidget *parent) : FontSizeSpinBox::FontSizeSpinBox(QWidget *parent) :
QAbstractSpinBox(parent), m_isPointSize(true), m_value(0) QAbstractSpinBox(parent), m_isPointSize(true), m_value(0)
{ {
connect(this, SIGNAL(editingFinished()), this, SLOT(onEditingFinished())); connect(this, &FontSizeSpinBox::editingFinished,
this, &FontSizeSpinBox::onEditingFinished);
} }
void FontSizeSpinBox::stepBy(int steps) void FontSizeSpinBox::stepBy(int steps)

View File

@@ -45,8 +45,8 @@ using namespace Core::Internal;
CurrentDocumentFind::CurrentDocumentFind() CurrentDocumentFind::CurrentDocumentFind()
: m_currentFind(0) : m_currentFind(0)
{ {
connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), connect(qApp, &QApplication::focusChanged,
this, SLOT(updateCandidateFindFilter(QWidget*,QWidget*))); this, &CurrentDocumentFind::updateCandidateFindFilter);
} }
void CurrentDocumentFind::removeConnections() void CurrentDocumentFind::removeConnections()
@@ -189,7 +189,8 @@ void CurrentDocumentFind::acceptCandidate()
m_currentFind = m_candidateFind; m_currentFind = m_candidateFind;
if (m_currentFind) { if (m_currentFind) {
connect(m_currentFind, SIGNAL(changed()), this, SIGNAL(changed())); connect(m_currentFind.data(), &IFindSupport::changed,
this, &CurrentDocumentFind::changed);
connect(m_currentFind, SIGNAL(destroyed(QObject*)), SLOT(clearFindSupport())); connect(m_currentFind, SIGNAL(destroyed(QObject*)), SLOT(clearFindSupport()));
} }
if (m_currentWidget) if (m_currentWidget)
@@ -200,8 +201,10 @@ void CurrentDocumentFind::acceptCandidate()
void CurrentDocumentFind::removeFindSupportConnections() void CurrentDocumentFind::removeFindSupportConnections()
{ {
if (m_currentFind) { if (m_currentFind) {
disconnect(m_currentFind, SIGNAL(changed()), this, SIGNAL(changed())); disconnect(m_currentFind.data(), &IFindSupport::changed,
disconnect(m_currentFind, SIGNAL(destroyed(QObject*)), this, SLOT(clearFindSupport())); this, &CurrentDocumentFind::changed);
disconnect(m_currentFind.data(), &IFindSupport::destroyed,
this, &CurrentDocumentFind::clearFindSupport);
} }
if (m_currentWidget) if (m_currentWidget)
m_currentWidget->removeEventFilter(this); m_currentWidget->removeEventFilter(this);

View File

@@ -214,7 +214,8 @@ void FindPlugin::setupMenu()
cmd = ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); cmd = ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
mfindadvanced->addAction(cmd); mfindadvanced->addAction(cmd);
connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter())); connect(d->m_openFindDialog, &QAction::triggered,
this, &FindPlugin::openFindFilter);
} }
void FindPlugin::setupFilterMenuItems() void FindPlugin::setupFilterMenuItems()
@@ -240,8 +241,8 @@ void FindPlugin::setupFilterMenuItems()
cmd->setDefaultKeySequence(filter->defaultShortcut()); cmd->setDefaultKeySequence(filter->defaultShortcut());
mfindadvanced->addAction(cmd); mfindadvanced->addAction(cmd);
d->m_filterActions.insert(filter, action); d->m_filterActions.insert(filter, action);
connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter())); connect(action, &QAction::triggered, this, &FindPlugin::openFindFilter);
connect(filter, SIGNAL(enabledChanged(bool)), this, SLOT(filterChanged())); connect(filter, &IFindFilter::enabledChanged, this, &FindPlugin::filterChanged);
} }
d->m_findDialog->setFindFilters(findInterfaces); d->m_findDialog->setFindFilters(findInterfaces);
d->m_openFindDialog->setEnabled(haveEnabledFilters); d->m_openFindDialog->setEnabled(haveEnabledFilters);

View File

@@ -92,10 +92,12 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_ui.findEdit->setAttribute(Qt::WA_MacShowFocusRect, false); m_ui.findEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
m_ui.replaceEdit->setAttribute(Qt::WA_MacShowFocusRect, false); m_ui.replaceEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
connect(m_ui.findEdit, SIGNAL(editingFinished()), this, SLOT(invokeResetIncrementalSearch())); connect(m_ui.findEdit, &Utils::FancyLineEdit::editingFinished,
this, &FindToolBar::invokeResetIncrementalSearch);
setLightColoredIcon(false); setLightColoredIcon(false);
connect(m_ui.close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus())); connect(m_ui.close, &QToolButton::clicked,
this, &FindToolBar::hideAndResetFocus);
m_findCompleter->setModel(m_plugin->findCompletionModel()); m_findCompleter->setModel(m_plugin->findCompletionModel());
m_replaceCompleter->setModel(m_plugin->replaceCompletionModel()); m_replaceCompleter->setModel(m_plugin->replaceCompletionModel());
@@ -108,35 +110,42 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_ui.findEdit->button(Utils::FancyLineEdit::Left)->setFocusPolicy(Qt::TabFocus); m_ui.findEdit->button(Utils::FancyLineEdit::Left)->setFocusPolicy(Qt::TabFocus);
m_ui.replaceEdit->setPlaceholderText(QString()); m_ui.replaceEdit->setPlaceholderText(QString());
connect(m_ui.findEdit, SIGNAL(textChanged(QString)), this, SLOT(invokeFindIncremental())); connect(m_ui.findEdit, &Utils::FancyLineEdit::textChanged,
connect(m_ui.findEdit, SIGNAL(leftButtonClicked()), this, &FindToolBar::invokeFindIncremental);
this, SLOT(findEditButtonClicked())); connect(m_ui.findEdit, &Utils::FancyLineEdit::leftButtonClicked,
this, &FindToolBar::findEditButtonClicked);
// invoke{Find,Replace}Helper change the completion model. QueuedConnection is used to perform these // invoke{Find,Replace}Helper change the completion model. QueuedConnection is used to perform these
// changes only after the completer's activated() signal is handled (QTCREATORBUG-8408) // changes only after the completer's activated() signal is handled (QTCREATORBUG-8408)
connect(m_ui.findEdit, SIGNAL(returnPressed()), this, SLOT(invokeFindEnter()), Qt::QueuedConnection); connect(m_ui.findEdit, &Utils::FancyLineEdit::returnPressed,
connect(m_ui.replaceEdit, SIGNAL(returnPressed()), this, SLOT(invokeReplaceEnter()), Qt::QueuedConnection); this, &FindToolBar::invokeFindEnter, Qt::QueuedConnection);
connect(m_ui.replaceEdit, &Utils::FancyLineEdit::returnPressed,
this, &FindToolBar::invokeReplaceEnter, Qt::QueuedConnection);
QAction *shiftEnterAction = new QAction(m_ui.findEdit); QAction *shiftEnterAction = new QAction(m_ui.findEdit);
shiftEnterAction->setShortcut(QKeySequence(tr("Shift+Enter"))); shiftEnterAction->setShortcut(QKeySequence(tr("Shift+Enter")));
shiftEnterAction->setShortcutContext(Qt::WidgetShortcut); shiftEnterAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftEnterAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious())); connect(shiftEnterAction, &QAction::triggered,
this, &FindToolBar::invokeFindPrevious);
m_ui.findEdit->addAction(shiftEnterAction); m_ui.findEdit->addAction(shiftEnterAction);
QAction *shiftReturnAction = new QAction(m_ui.findEdit); QAction *shiftReturnAction = new QAction(m_ui.findEdit);
shiftReturnAction->setShortcut(QKeySequence(tr("Shift+Return"))); shiftReturnAction->setShortcut(QKeySequence(tr("Shift+Return")));
shiftReturnAction->setShortcutContext(Qt::WidgetShortcut); shiftReturnAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftReturnAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious())); connect(shiftReturnAction, &QAction::triggered,
this, &FindToolBar::invokeFindPrevious);
m_ui.findEdit->addAction(shiftReturnAction); m_ui.findEdit->addAction(shiftReturnAction);
QAction *shiftEnterReplaceAction = new QAction(m_ui.replaceEdit); QAction *shiftEnterReplaceAction = new QAction(m_ui.replaceEdit);
shiftEnterReplaceAction->setShortcut(QKeySequence(tr("Shift+Enter"))); shiftEnterReplaceAction->setShortcut(QKeySequence(tr("Shift+Enter")));
shiftEnterReplaceAction->setShortcutContext(Qt::WidgetShortcut); shiftEnterReplaceAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftEnterReplaceAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious())); connect(shiftEnterReplaceAction, &QAction::triggered,
this, &FindToolBar::invokeReplacePrevious);
m_ui.replaceEdit->addAction(shiftEnterReplaceAction); m_ui.replaceEdit->addAction(shiftEnterReplaceAction);
QAction *shiftReturnReplaceAction = new QAction(m_ui.replaceEdit); QAction *shiftReturnReplaceAction = new QAction(m_ui.replaceEdit);
shiftReturnReplaceAction->setShortcut(QKeySequence(tr("Shift+Return"))); shiftReturnReplaceAction->setShortcut(QKeySequence(tr("Shift+Return")));
shiftReturnReplaceAction->setShortcutContext(Qt::WidgetShortcut); shiftReturnReplaceAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftReturnReplaceAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious())); connect(shiftReturnReplaceAction, &QAction::triggered,
this, &FindToolBar::invokeReplacePrevious);
m_ui.replaceEdit->addAction(shiftReturnReplaceAction); m_ui.replaceEdit->addAction(shiftReturnReplaceAction);
// need to make sure QStringList is registered as metatype // need to make sure QStringList is registered as metatype
@@ -153,14 +162,16 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_goToCurrentFindAction = new QAction(this); m_goToCurrentFindAction = new QAction(this);
ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR, ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR,
findcontext); findcontext);
connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport())); connect(m_goToCurrentFindAction, &QAction::triggered,
this, &FindToolBar::setFocusToCurrentFindSupport);
QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace")); QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace"));
m_findInDocumentAction = new QAction(icon, tr("Find/Replace"), this); m_findInDocumentAction = new QAction(icon, tr("Find/Replace"), this);
cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext); cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::Find); cmd->setDefaultKeySequence(QKeySequence::Find);
mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT);
connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind())); connect(m_findInDocumentAction, &QAction::triggered,
this, &FindToolBar::openFind);
// Pressing the find shortcut while focus is in the tool bar should not change the search text, // Pressing the find shortcut while focus is in the tool bar should not change the search text,
// so register a different find action for the tool bar // so register a different find action for the tool bar
@@ -175,7 +186,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext); cmd = ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_enterFindStringAction, SIGNAL(triggered()), this, SLOT(putSelectionToFindClipboard())); connect(m_enterFindStringAction, &QAction::triggered, this, &FindToolBar::putSelectionToFindClipboard);
connect(QApplication::clipboard(), SIGNAL(findBufferChanged()), this, SLOT(updateFromFindClipboard())); connect(QApplication::clipboard(), SIGNAL(findBufferChanged()), this, SLOT(updateFromFindClipboard()));
} }
@@ -183,7 +194,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext); cmd = ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::FindNext); cmd->setDefaultKeySequence(QKeySequence::FindNext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeGlobalFindNext())); connect(m_findNextAction, &QAction::triggered, this, &FindToolBar::invokeGlobalFindNext);
m_localFindNextAction = new QAction(m_findNextAction->text(), this); m_localFindNextAction = new QAction(m_findNextAction->text(), this);
cmd = ActionManager::registerAction(m_localFindNextAction, Constants::FIND_NEXT, findcontext); cmd = ActionManager::registerAction(m_localFindNextAction, Constants::FIND_NEXT, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localFindNextAction); cmd->augmentActionWithShortcutToolTip(m_localFindNextAction);
@@ -194,7 +205,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext); cmd = ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::FindPrevious); cmd->setDefaultKeySequence(QKeySequence::FindPrevious);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeGlobalFindPrevious())); connect(m_findPreviousAction, &QAction::triggered, this, &FindToolBar::invokeGlobalFindPrevious);
m_localFindPreviousAction = new QAction(m_findPreviousAction->text(), this); m_localFindPreviousAction = new QAction(m_findPreviousAction->text(), this);
cmd = ActionManager::registerAction(m_localFindPreviousAction, Constants::FIND_PREVIOUS, findcontext); cmd = ActionManager::registerAction(m_localFindPreviousAction, Constants::FIND_PREVIOUS, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localFindPreviousAction); cmd->augmentActionWithShortcutToolTip(m_localFindPreviousAction);
@@ -205,19 +216,19 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext); cmd = ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F3"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F3")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findNextSelectedAction, SIGNAL(triggered()), this, SLOT(findNextSelected())); connect(m_findNextSelectedAction, &QAction::triggered, this, &FindToolBar::findNextSelected);
m_findPreviousSelectedAction = new QAction(tr("Find Previous (Selected)"), this); m_findPreviousSelectedAction = new QAction(tr("Find Previous (Selected)"), this);
cmd = ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext); cmd = ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findPreviousSelectedAction, SIGNAL(triggered()), this, SLOT(findPreviousSelected())); connect(m_findPreviousSelectedAction, &QAction::triggered, this, &FindToolBar::findPreviousSelected);
m_replaceAction = new QAction(tr("Replace"), this); m_replaceAction = new QAction(tr("Replace"), this);
cmd = ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext); cmd = ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext);
cmd->setDefaultKeySequence(QKeySequence()); cmd->setDefaultKeySequence(QKeySequence());
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplace())); connect(m_replaceAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplace);
m_localReplaceAction = new QAction(m_replaceAction->text(), this); m_localReplaceAction = new QAction(m_replaceAction->text(), this);
cmd = ActionManager::registerAction(m_localReplaceAction, Constants::REPLACE, findcontext); cmd = ActionManager::registerAction(m_localReplaceAction, Constants::REPLACE, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplaceAction); cmd->augmentActionWithShortcutToolTip(m_localReplaceAction);
@@ -228,7 +239,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
cmd = ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext); cmd = ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+="))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+=")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplaceNext())); connect(m_replaceNextAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplaceNext);
m_localReplaceNextAction = new QAction(m_replaceNextAction->text(), this); m_localReplaceNextAction = new QAction(m_replaceNextAction->text(), this);
m_localReplaceNextAction->setIconText(m_replaceNextAction->text()); // Workaround QTBUG-23396 m_localReplaceNextAction->setIconText(m_replaceNextAction->text()); // Workaround QTBUG-23396
cmd = ActionManager::registerAction(m_localReplaceNextAction, Constants::REPLACE_NEXT, findcontext); cmd = ActionManager::registerAction(m_localReplaceNextAction, Constants::REPLACE_NEXT, findcontext);
@@ -239,7 +250,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this); m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this);
cmd = ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext); cmd = ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplacePrevious())); connect(m_replacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplacePrevious);
m_localReplacePreviousAction = new QAction(m_replacePreviousAction->text(), this); m_localReplacePreviousAction = new QAction(m_replacePreviousAction->text(), this);
cmd = ActionManager::registerAction(m_localReplacePreviousAction, Constants::REPLACE_PREVIOUS, findcontext); cmd = ActionManager::registerAction(m_localReplacePreviousAction, Constants::REPLACE_PREVIOUS, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplacePreviousAction); cmd->augmentActionWithShortcutToolTip(m_localReplacePreviousAction);
@@ -248,7 +259,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_replaceAllAction = new QAction(tr("Replace All"), this); m_replaceAllAction = new QAction(tr("Replace All"), this);
cmd = ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext); cmd = ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeGlobalReplaceAll())); connect(m_replaceAllAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplaceAll);
m_localReplaceAllAction = new QAction(m_replaceAllAction->text(), this); m_localReplaceAllAction = new QAction(m_replaceAllAction->text(), this);
cmd = ActionManager::registerAction(m_localReplaceAllAction, Constants::REPLACE_ALL, findcontext); cmd = ActionManager::registerAction(m_localReplaceAllAction, Constants::REPLACE_ALL, findcontext);
cmd->augmentActionWithShortcutToolTip(m_localReplaceAllAction); cmd->augmentActionWithShortcutToolTip(m_localReplaceAllAction);
@@ -261,7 +272,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_caseSensitiveAction->setChecked(false); m_caseSensitiveAction->setChecked(false);
cmd = ActionManager::registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext); cmd = ActionManager::registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_caseSensitiveAction, SIGNAL(toggled(bool)), this, SLOT(setCaseSensitive(bool))); connect(m_caseSensitiveAction, &QAction::toggled, this, &FindToolBar::setCaseSensitive);
m_wholeWordAction = new QAction(tr("Whole Words Only"), this); m_wholeWordAction = new QAction(tr("Whole Words Only"), this);
m_wholeWordAction->setIcon(QIcon(QLatin1String(":/find/images/wholewords.png"))); m_wholeWordAction->setIcon(QIcon(QLatin1String(":/find/images/wholewords.png")));
@@ -269,7 +280,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_wholeWordAction->setChecked(false); m_wholeWordAction->setChecked(false);
cmd = ActionManager::registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext); cmd = ActionManager::registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_wholeWordAction, SIGNAL(toggled(bool)), this, SLOT(setWholeWord(bool))); connect(m_wholeWordAction, &QAction::toggled, this, &FindToolBar::setWholeWord);
m_regularExpressionAction = new QAction(tr("Use Regular Expressions"), this); m_regularExpressionAction = new QAction(tr("Use Regular Expressions"), this);
m_regularExpressionAction->setIcon(QIcon(QLatin1String(":/find/images/regexp.png"))); m_regularExpressionAction->setIcon(QIcon(QLatin1String(":/find/images/regexp.png")));
@@ -277,7 +288,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_regularExpressionAction->setChecked(false); m_regularExpressionAction->setChecked(false);
cmd = ActionManager::registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); cmd = ActionManager::registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_regularExpressionAction, SIGNAL(toggled(bool)), this, SLOT(setRegularExpressions(bool))); connect(m_regularExpressionAction, &QAction::toggled, this, &FindToolBar::setRegularExpressions);
m_preserveCaseAction = new QAction(tr("Preserve Case when Replacing"), this); m_preserveCaseAction = new QAction(tr("Preserve Case when Replacing"), this);
m_preserveCaseAction->setIcon(QPixmap(QLatin1String(":/find/images/preservecase.png"))); m_preserveCaseAction->setIcon(QPixmap(QLatin1String(":/find/images/preservecase.png")));
@@ -285,22 +296,18 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_preserveCaseAction->setChecked(false); m_preserveCaseAction->setChecked(false);
cmd = ActionManager::registerAction(m_preserveCaseAction, Constants::PRESERVE_CASE, globalcontext); cmd = ActionManager::registerAction(m_preserveCaseAction, Constants::PRESERVE_CASE, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_preserveCaseAction, SIGNAL(toggled(bool)), this, SLOT(setPreserveCase(bool))); connect(m_preserveCaseAction, &QAction::toggled, this, &FindToolBar::setPreserveCase);
connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged, connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged, this, &FindToolBar::adaptToCandidate);
this, &FindToolBar::adaptToCandidate); connect(m_currentDocumentFind, &CurrentDocumentFind::changed, this, &FindToolBar::updateGlobalActions);
connect(m_currentDocumentFind, &CurrentDocumentFind::changed, connect(m_currentDocumentFind, &CurrentDocumentFind::changed, this, &FindToolBar::updateToolBar);
this, &FindToolBar::updateGlobalActions);
connect(m_currentDocumentFind, &CurrentDocumentFind::changed,
this, &FindToolBar::updateToolBar);
updateGlobalActions(); updateGlobalActions();
updateToolBar(); updateToolBar();
m_findIncrementalTimer.setSingleShot(true); m_findIncrementalTimer.setSingleShot(true);
m_findStepTimer.setSingleShot(true); m_findStepTimer.setSingleShot(true);
connect(&m_findIncrementalTimer, SIGNAL(timeout()), connect(&m_findIncrementalTimer, &QTimer::timeout, this, &FindToolBar::invokeFindIncremental);
this, SLOT(invokeFindIncremental())); connect(&m_findStepTimer, &QTimer::timeout, this, &FindToolBar::invokeFindStep);
connect(&m_findStepTimer, SIGNAL(timeout()), this, SLOT(invokeFindStep()));
} }
FindToolBar::~FindToolBar() FindToolBar::~FindToolBar()
@@ -493,12 +500,14 @@ QString FindToolBar::getReplaceText()
void FindToolBar::setFindText(const QString &text) void FindToolBar::setFindText(const QString &text)
{ {
disconnect(m_ui.findEdit, SIGNAL(textChanged(QString)), this, SLOT(invokeFindIncremental())); disconnect(m_ui.findEdit, &Utils::FancyLineEdit::textChanged,
this, &FindToolBar::invokeFindIncremental);
if (hasFindFlag(FindRegularExpression)) if (hasFindFlag(FindRegularExpression))
m_ui.findEdit->setText(QRegExp::escape(text)); m_ui.findEdit->setText(QRegExp::escape(text));
else else
m_ui.findEdit->setText(text); m_ui.findEdit->setText(text);
connect(m_ui.findEdit, SIGNAL(textChanged(QString)), this, SLOT(invokeFindIncremental())); connect(m_ui.findEdit, &Utils::FancyLineEdit::textChanged,
this, &FindToolBar::invokeFindIncremental);
} }
void FindToolBar::selectFindText() void FindToolBar::selectFindText()
@@ -994,8 +1003,8 @@ QCheckBox *OptionsPopup::createCheckboxForCommand(Id id)
checkbox->setChecked(action->isChecked()); checkbox->setChecked(action->isChecked());
checkbox->setEnabled(action->isEnabled()); checkbox->setEnabled(action->isEnabled());
checkbox->installEventFilter(this); // enter key handling checkbox->installEventFilter(this); // enter key handling
QObject::connect(checkbox, SIGNAL(clicked(bool)), action, SLOT(setChecked(bool))); QObject::connect(checkbox, &QCheckBox::clicked, action, &QAction::setChecked);
QObject::connect(action, SIGNAL(changed()), this, SLOT(actionChanged())); QObject::connect(action, &QAction::changed, this, &OptionsPopup::actionChanged);
m_checkboxMap.insert(action, checkbox); m_checkboxMap.insert(action, checkbox);
return checkbox; return checkbox;
} }

View File

@@ -51,7 +51,8 @@ SearchResultTreeView::SearchResultTreeView(QWidget *parent)
setExpandsOnDoubleClick(true); setExpandsOnDoubleClick(true);
header()->hide(); header()->hide();
connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(emitJumpToSearchResult(QModelIndex))); connect(this, &SearchResultTreeView::activated,
this, &SearchResultTreeView::emitJumpToSearchResult);
} }
void SearchResultTreeView::setAutoExpandResults(bool expand) void SearchResultTreeView::setAutoExpandResults(bool expand)