Change more things.

Things changed:
 - make getImageFileFormat case insensitive
 - use QTextEdit::dragEnterEvent instead of QAbstractScrollArea::dragEnterEvent,
 - Make dragEnterEvent() and dropEvent() overrides.
This commit is contained in:
Mm2PL 2019-10-11 17:00:26 +02:00
parent bf434f3ac5
commit 77af5d54cf
No known key found for this signature in database
GPG key ID: 1C400DA5602DE62E
3 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,7 @@ QString getImageFileFormat(QString path)
static QStringList listOfImageFormats = {".png", ".jpg", ".jpeg"};
for (const QString &format : listOfImageFormats)
{
if (path.endsWith(format))
if (path.endsWith(format, Qt::CaseInsensitive))
{
return format.mid(1);
}

View file

@ -291,7 +291,7 @@ void ResizingTextEdit::dragEnterEvent(QDragEnterEvent *event)
}
else
{
QAbstractScrollArea::dragEnterEvent(event);
QTextEdit::dragEnterEvent(event);
}
}

View file

@ -34,8 +34,8 @@ protected:
bool canInsertFromMimeData(const QMimeData *source) const override;
void insertFromMimeData(const QMimeData *source) override;
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;
private:
// hadSpace is set to true in case the "textUnderCursor" word was after a