Skip to content

Commit

Permalink
[65_9] Deprecate Qt 5 support
Browse files Browse the repository at this point in the history
Should be merged after the release of 1.2.5.
  • Loading branch information
da-liii authored Feb 26, 2024
1 parent 3ec0fe9 commit 8ee91b2
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 500 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/cd_research_on_ubuntu_20_04.yml

This file was deleted.

100 changes: 0 additions & 100 deletions .github/workflows/ci-xmake-ubuntu-focal.yml

This file was deleted.

68 changes: 0 additions & 68 deletions src/Plugins/Qt/QTMApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,64 +28,6 @@ void init_palette (QApplication* app);
void init_style_sheet (QApplication* app);
void set_standard_style_sheet (QWidget* w);

#ifdef Q_OS_MAC
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QMacPasteboardMime>

// On MacOS we have to register appropriate mime types for PDF files
// The QMacPasteboardMimePDF class is instantiated in QTMApplication
// and provides the necessary support.
//
// code from:
// https://www.lyx.org/trac/browser/lyxsvn/lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp?rev=24894

// (mg) I'm not sure this is the right place to have this code, but well...

class QMacPasteboardMimePDF : public QMacPasteboardMime {
public:
QMacPasteboardMimePDF ()
: QMacPasteboardMime (MIME_QT_CONVERTOR | MIME_ALL) {}

QString convertorName () { return "PDF"; }

QString flavorFor (QString const& mime) {
if (mime == QLatin1String ("application/pdf"))
return QLatin1String ("com.adobe.pdf");
return QString ();
}

QString mimeFor (QString flav) {
if (flav == QLatin1String ("com.adobe.pdf"))
return QLatin1String ("application/pdf");
return QString ();
}

bool canConvert (QString const& mime, QString flav) {
return mimeFor (flav) == mime;
}

QVariant convertToMime (QString const& mime, QList<QByteArray> data,
QString flav) {
(void) flav;
(void) mime;
if (data.count () > 1)
debug_qt << "QMacPasteboardMimePDF: Cannot handle multiple member data "
<< LF;
return data.first ();
}

QList<QByteArray> convertFromMime (QString const& mime, QVariant data,
QString flav) {
(void) flav;
(void) mime;
QList<QByteArray> ret;
ret.append (data.toByteArray ());
return ret;
}
};
#endif
#endif

/*
FIXME: We would like to do the following
Expand All @@ -112,26 +54,16 @@ class QMacPasteboardMimePDF : public QMacPasteboardMime {
class QTMApplication : public QApplication {
Q_OBJECT

#ifdef Q_OS_MAC
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QMacPasteboardMimePDF mac_pasteboard_mime_pdf;
#endif
#endif

public:
QTMApplication (int& argc, char** argv) : QApplication (argc, argv) {
init_palette (this);
init_style_sheet (this);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QGuiApplication::setHighDpiScaleFactorRoundingPolicy (
Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (!retina_manual) {
qreal ratio = QApplication::primaryScreen ()->devicePixelRatio ();
retina_factor= qRound (ratio - 0.1);
}
#endif
}

void set_window_icon (string icon_path) {
Expand Down
14 changes: 2 additions & 12 deletions src/Plugins/Qt/QTMMenuHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,6 @@ QTMRefreshWidget::QTMRefreshWidget (qt_widget _tmwid, string _strwid,
SLOT (doRefresh (string)));
QVBoxLayout* l= new QVBoxLayout (this);
l->setContentsMargins (0, 0, 0, 0);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// https://doc.qt.io/qt-5/qlayout-obsolete.html#setMargin
l->setMargin (0);
#endif
setLayout (l);

doRefresh ("init");
Expand Down Expand Up @@ -898,9 +894,6 @@ QTMRefreshableWidget::QTMRefreshableWidget (qt_widget _tmwid, object _prom,
SLOT (doRefresh (string)));
QVBoxLayout* l= new QVBoxLayout (this);
l->setContentsMargins (0, 0, 0, 0);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
l->setMargin (0);
#endif
setLayout (l);

doRefresh ("init");
Expand Down Expand Up @@ -1000,13 +993,10 @@ QTMComboBox::addItemsAndResize (const QStringList& texts, string ww,
string hh) {
QComboBox::addItems (texts);

///// Calculate the minimal contents size:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
calcSize= QApplication::globalStrut ();
#else
///// Calculate the minimal contents size (only in Qt 5)
// calcSize= QApplication::globalStrut ();
// see https://doc.qt.io/qt-5/qapplication-obsolete.html#globalStrut-prop
// no replacement of QApplication::globalStrut
#endif
const QFontMetrics& fm= fontMetrics ();

for (int i= 0; i < count (); ++i) {
Expand Down
6 changes: 1 addition & 5 deletions src/Plugins/Qt/QTMPipeLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ QTMPipeLink::~QTMPipeLink () { killProcess (1000); }
bool
QTMPipeLink::launchCmd () {
if (state () != QProcess::NotRunning) killProcess (1000);
// FIXME: is UTF8 the right encoding here?
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QProcess::start (utf8_to_qstring (cmd));
#else
// FIXME: is UTF8 the right encoding here?
QProcess::startCommand (utf8_to_qstring (cmd));
#endif
bool r= waitForStarted ();
if (r) {
connect (this, SIGNAL (readyReadStandardOutput ()), SLOT (readErrOut ()));
Expand Down
Loading

0 comments on commit 8ee91b2

Please sign in to comment.