Commit 38340eab authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use auto vs auto * where it's possible

parent 704a010d
Pipeline #49677 failed with stage
in 10 minutes and 34 seconds
......@@ -35,7 +35,7 @@ void EditorUtilTest::testUpperCase()
QFETCH(QString, result);
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
auto *document = new QTextDocument(this);
auto document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......@@ -65,7 +65,7 @@ void EditorUtilTest::testLowerCase()
QFETCH(QString, result);
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
auto *document = new QTextDocument(this);
auto document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......@@ -95,7 +95,7 @@ void EditorUtilTest::testSentenceCase()
QFETCH(QString, result);
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
auto *document = new QTextDocument(this);
auto document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......@@ -127,7 +127,7 @@ void EditorUtilTest::testReverseCase()
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
auto *document = new QTextDocument(this);
auto document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......
......@@ -27,7 +27,7 @@ struct TestWindow : public QWidget {
createContent();
mMainWidget = new QTextEdit();
auto *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mMainWidget);
......
......@@ -25,9 +25,9 @@ KLinkDialog::KLinkDialog(QWidget *parent)
setWindowTitle(i18nc("@title:window", "Manage Link"));
setModal(true);
auto *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
auto *grid = new QGridLayout;
auto grid = new QGridLayout;
textLabel = new QLabel(i18n("Link Text:"), this);
textLineEdit = new QLineEdit(this);
......
......@@ -118,7 +118,7 @@ void RichTextComposer::createActions(KActionCollection *ac)
void RichTextComposer::updateHighLighter()
{
auto *hlighter = qobject_cast<KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *>(highlighter());
auto hlighter = qobject_cast<KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *>(highlighter());
if (hlighter) {
hlighter->toggleSpellHighlighting(checkSpellingEnabled());
}
......@@ -242,9 +242,9 @@ void RichTextComposer::forcePlainTextMarkup(bool force)
void RichTextComposer::insertPlainTextImplementation()
{
if (d->forcePlainTextMarkup) {
auto *pb = new KPIMTextEdit::PlainTextMarkupBuilder();
auto pb = new KPIMTextEdit::PlainTextMarkupBuilder();
pb->setQuotePrefix(defaultQuoteSign());
auto *pmd = new KPIMTextEdit::MarkupDirector(pb);
auto pmd = new KPIMTextEdit::MarkupDirector(pb);
pmd->processDocument(document());
const QString plainText = pb->getResult();
document()->setPlainText(plainText);
......
......@@ -137,7 +137,7 @@ void RichTextComposerActions::createActions(KActionCollection *ac)
ac->addAction(QStringLiteral("format_align_justify"), d->action_align_justify);
}
auto *alignmentGroup = new QActionGroup(this);
auto alignmentGroup = new QActionGroup(this);
alignmentGroup->addAction(d->action_align_left);
alignmentGroup->addAction(d->action_align_center);
alignmentGroup->addAction(d->action_align_right);
......@@ -162,7 +162,7 @@ void RichTextComposerActions::createActions(KActionCollection *ac)
ac->addAction(QStringLiteral("direction_rtl"), d->action_direction_rtl);
}
auto *directionGroup = new QActionGroup(this);
auto directionGroup = new QActionGroup(this);
directionGroup->addAction(d->action_direction_ltr);
directionGroup->addAction(d->action_direction_rtl);
......
......@@ -25,11 +25,11 @@ RichTextComposerWidget::RichTextComposerWidget(QWidget *parent)
: QWidget(parent)
, d(new KPIMTextEdit::RichTextComposerWidgetPrivate)
{
auto *layout = new QHBoxLayout(this);
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
d->richTextComposer = new KPIMTextEdit::RichTextComposer(this);
d->richTextComposer->setObjectName(QStringLiteral("richtextcomposer"));
auto *editorWidget = new RichTextEditorWidget(d->richTextComposer, this);
auto editorWidget = new RichTextEditorWidget(d->richTextComposer, this);
layout->addWidget(editorWidget);
}
......
......@@ -23,10 +23,10 @@ int main(int argc, char **argv)
parser.addVersionOption();
parser.addHelpOption();
parser.process(app);
auto *richtextcomposerwidget = new KPIMTextEdit::RichTextComposer;
auto richtextcomposerwidget = new KPIMTextEdit::RichTextComposer;
KActionCollection *ac = new KActionCollection(richtextcomposerwidget);
richtextcomposerwidget->createActions(ac);
auto *editor = new KPIMTextEdit::RichTextEditorWidget(richtextcomposerwidget);
auto editor = new KPIMTextEdit::RichTextEditorWidget(richtextcomposerwidget);
editor->resize(800, 600);
editor->show();
......
......@@ -68,7 +68,7 @@ void EmoticonListWidgetSelector::slotEmoticonClicked(QListWidgetItem *item)
if (!item) {
return;
}
auto *itemEmoticon = static_cast<EmoticonTextEditItem *>(item);
auto itemEmoticon = static_cast<EmoticonTextEditItem *>(item);
Q_EMIT itemSelected(itemEmoticon->text());
}
......@@ -22,7 +22,7 @@ public:
: emoticonMenu(new QMenu())
{
selector = new EmoticonTextEditSelector(emoticonMenu);
auto *action = new QWidgetAction(emoticonMenu);
auto action = new QWidgetAction(emoticonMenu);
action->setDefaultWidget(selector);
emoticonMenu->addAction(action);
connect(emoticonMenu, &QMenu::aboutToShow, selector, &EmoticonTextEditSelector::loadEmoticons);
......
......@@ -16,7 +16,7 @@ using namespace KPIMTextEdit;
EmoticonTextEditSelector::EmoticonTextEditSelector(QWidget *parent)
: QWidget(parent)
{
auto *lay = new QHBoxLayout(this);
auto lay = new QHBoxLayout(this);
lay->setSpacing(0);
lay->setContentsMargins(0, 0, 0, 0);
mUnicodeTab = new EmoticonUnicodeTab(this);
......
......@@ -65,7 +65,7 @@ void EmoticonUnicodeTab::loadEmoticons()
void EmoticonUnicodeTab::createPlainTextEmoticonTab(const QString &str, const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticons)
{
if (!emoticons.isEmpty()) {
auto *selector = new EmoticonListWidgetSelector(this);
auto selector = new EmoticonListWidgetSelector(this);
connect(selector, &KPIMTextEdit::EmoticonListWidgetSelector::itemSelected, this, &EmoticonUnicodeTab::itemSelected);
QStringList lst;
lst.reserve(emoticons.count());
......
......@@ -25,12 +25,12 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Insert HTML"));
auto *lay = new QVBoxLayout(q);
auto lay = new QVBoxLayout(q);
QLabel *label = new QLabel(i18n("Insert HTML tags and texts:"));
lay->addWidget(label);
editor = new InsertHtmlEditor;
editor->setSpellCheckingSupport(false);
auto *editorWidget = new KPIMTextEdit::PlainTextEditorWidget(editor);
auto editorWidget = new KPIMTextEdit::PlainTextEditorWidget(editor);
lay->addWidget(editorWidget);
label = new QLabel(i18n("Example: <i> Hello word </i>"));
QFont font = label->font();
......
......@@ -27,7 +27,7 @@ InsertHtmlEditor::InsertHtmlEditor(QWidget *parent)
qCWarning(KPIMTEXTEDIT_LOG) << "Invalid definition name";
}
auto *hl = new KSyntaxHighlighting::SyntaxHighlighter(document());
auto hl = new KSyntaxHighlighting::SyntaxHighlighter(document());
hl->setTheme((palette().color(QPalette::Base).lightness() < 128) ? mRepo.defaultTheme(KSyntaxHighlighting::Repository::DarkTheme)
: mRepo.defaultTheme(KSyntaxHighlighting::Repository::LightTheme));
hl->setDefinition(def);
......
......@@ -23,7 +23,7 @@ public:
InsertImageDialogPrivate(InsertImageDialog *qq)
: q(qq)
{
auto *vbox = new QVBoxLayout(q);
auto vbox = new QVBoxLayout(q);
q->setWindowTitle(i18nc("@title:window", "Insert Image"));
imageWidget = new InsertImageWidget(q);
......
......@@ -34,9 +34,9 @@ public:
InsertImageWidgetPrivate(InsertImageWidget *qq)
: q(qq)
{
auto *lay = new QVBoxLayout(q);
auto lay = new QVBoxLayout(q);
lay->setContentsMargins(0, 0, 0, 0);
auto *hbox = new QHBoxLayout;
auto hbox = new QHBoxLayout;
QLabel *lab = new QLabel(i18n("Image Location:"));
imageUrlRequester = new KUrlRequester;
......
......@@ -24,7 +24,7 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Insert Table"));
auto *mainLayout = new QVBoxLayout(q);
auto mainLayout = new QVBoxLayout(q);
insertTableWidget = new InsertTableWidget(q);
mainLayout->addWidget(insertTableWidget);
......
......@@ -35,7 +35,7 @@ public:
mBorder->setValue(1);
mBorder->setSuffix(i18n(" px"));
auto *gridLayout = new QGridLayout;
auto gridLayout = new QGridLayout;
gridLayout->setContentsMargins(0, 0, 0, 0);
gridLayout->addWidget(new QLabel(i18n("Rows:")), 0, 0);
gridLayout->addWidget(mRows, 0, 1);
......
......@@ -23,7 +23,7 @@ public:
{
q->setWindowTitle(i18nc("@title:window", "Select Special Characters"));
auto *lay = new QVBoxLayout(q);
auto lay = new QVBoxLayout(q);
mCharSelect = new KCharSelect(q, nullptr, KCharSelect::CharacterTable | KCharSelect::BlockCombos);
q->connect(mCharSelect, &KCharSelect::charSelected, q, &SelectSpecialCharDialog::charSelected);
......
......@@ -26,10 +26,10 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Cell Format"));
auto *mainLayout = new QVBoxLayout;
auto mainLayout = new QVBoxLayout;
q->setLayout(mainLayout);
auto *hbox = new QHBoxLayout;
auto hbox = new QHBoxLayout;
QLabel *lab = new QLabel(i18n("Vertical Alignment:"));
hbox->addWidget(lab);
verticalAlignment = new QComboBox;
......
......@@ -29,10 +29,10 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Table Format"));
auto *mainLayout = new QVBoxLayout(q);
auto mainLayout = new QVBoxLayout(q);
QWidget *page = new QWidget(q);
auto *lay = new QVBoxLayout(page);
auto lay = new QVBoxLayout(page);
lay->setContentsMargins(0, 0, 0, 0);
tableWidget = new InsertTableWidget;
lay->addWidget(tableWidget);
......@@ -40,7 +40,7 @@ public:
KSeparator *sep = new KSeparator;
lay->addWidget(sep);
auto *hbox = new QHBoxLayout;
auto hbox = new QHBoxLayout;
QLabel *lab = new QLabel(i18n("Spacing:"));
hbox->addWidget(lab);
spacing = new QSpinBox;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment