Make Qt scintilla code compatible with no-const-char conversions

This commit is contained in:
baldurk
2017-05-02 15:48:26 +01:00
parent ce53be8511
commit 0b410e9879
2 changed files with 9 additions and 9 deletions
@@ -516,7 +516,7 @@ XYPOSITION SurfaceImpl::WidthText(Font &font, const char *s, int len)
XYPOSITION SurfaceImpl::WidthChar(Font &font, char ch)
{
QFontMetricsF metrics(*FontPointer(font), device);
return metrics.width(ch);
return metrics.width(QChar::fromLatin1(ch));
}
XYPOSITION SurfaceImpl::Ascent(Font &font)
@@ -729,7 +729,7 @@ void Window::SetCursor(Cursor curs)
void Window::SetTitle(const char *s)
{
if (wid)
window(wid)->setWindowTitle(s);
window(wid)->setWindowTitle(QString::fromUtf8(s));
}
/* Returns rectangle of monitor pt is on, both rect and pt are in Window's
@@ -1254,7 +1254,7 @@ void Platform::Assert(const char *c, const char *file, int line)
char buffer[2000];
sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
if (Platform::ShowAssertionPopUps(false)) {
QMessageBox mb("Assertion Failure", buffer, QMessageBox::NoIcon,
QMessageBox mb(QStringLiteral("Assertion Failure"), QString::fromUtf8(buffer), QMessageBox::NoIcon,
QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
mb.exec();
} else {
@@ -67,14 +67,14 @@ void ScintillaQt::execCommand(QAction *action)
}
#if defined(Q_OS_WIN)
static const QString sMSDEVColumnSelect("MSDEVColumnSelect");
static const QString sWrappedMSDEVColumnSelect("application/x-qt-windows-mime;value=\"MSDEVColumnSelect\"");
static const QString sMSDEVColumnSelect(QStringLiteral("MSDEVColumnSelect"));
static const QString sWrappedMSDEVColumnSelect(QStringLiteral("application/x-qt-windows-mime;value=\"MSDEVColumnSelect\""));
#elif defined(Q_OS_MAC)
static const QString sScintillaRecPboardType("com.scintilla.utf16-plain-text.rectangular");
static const QString sScintillaRecMimeType("text/x-scintilla.utf16-plain-text.rectangular");
static const QString sScintillaRecPboardType(QStringLiteral("com.scintilla.utf16-plain-text.rectangular"));
static const QString sScintillaRecMimeType(QStringLiteral("text/x-scintilla.utf16-plain-text.rectangular"));
#else
// Linux
static const QString sMimeRectangularMarker("text/x-rectangular-marker");
static const QString sMimeRectangularMarker(QStringLiteral("text/x-rectangular-marker"));
#endif
#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
@@ -632,7 +632,7 @@ void ScintillaQt::AddToPopUp(const char *label,
bool enabled)
{
QMenu *menu = static_cast<QMenu *>(popup.GetID());
QString text(label);
QString text = QString::fromLatin1(label);
if (text.isEmpty()) {
menu->addSeparator();