mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Require at least Qt 5.12. Part2: Qt frontend
Most of it is fairly mechanical, but some parts require care.
This commit is contained in:
parent
6ba2b5c5b9
commit
c39d5b760c
@ -287,11 +287,7 @@ void CategorizedCombo::Private::setFilter(QString const & s)
|
|||||||
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
|
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
|
||||||
|
|
||||||
filter_ = s;
|
filter_ = s;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
filterModel_->setFilterRegExp(charFilterRegExp(filter_));
|
|
||||||
#else
|
|
||||||
filterModel_->setFilterRegularExpression(charFilterRegExp(filter_));
|
filterModel_->setFilterRegularExpression(charFilterRegExp(filter_));
|
||||||
#endif
|
|
||||||
countCategories();
|
countCategories();
|
||||||
|
|
||||||
// restore old selection
|
// restore old selection
|
||||||
|
@ -295,14 +295,12 @@ static QString version(bool const plain = false)
|
|||||||
out << '\n';
|
out << '\n';
|
||||||
else
|
else
|
||||||
out << "</p><p>";
|
out << "</p><p>";
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
|
|
||||||
out << toqstr(bformat(_("OS Version (run-time): %1$s"),
|
out << toqstr(bformat(_("OS Version (run-time): %1$s"),
|
||||||
qstring_to_ucs4(QSysInfo::prettyProductName())));
|
qstring_to_ucs4(QSysInfo::prettyProductName())));
|
||||||
if (plain)
|
if (plain)
|
||||||
out << '\n';
|
out << '\n';
|
||||||
else
|
else
|
||||||
out << "</p><p>";
|
out << "</p><p>";
|
||||||
#endif
|
|
||||||
out << toqstr(bformat(_("Python detected: %1$s"), from_utf8(os::python_info())));
|
out << toqstr(bformat(_("Python detected: %1$s"), from_utf8(os::python_info())));
|
||||||
if (plain)
|
if (plain)
|
||||||
out << '\n';
|
out << '\n';
|
||||||
|
@ -106,9 +106,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
#endif
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QSessionManager>
|
#include <QSessionManager>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -128,7 +126,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION >= 0x050400)
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||||
# if (QT_VERSION >= 0x060000)
|
# if (QT_VERSION >= 0x060000)
|
||||||
# if (QT_VERSION >= 0x060500)
|
# if (QT_VERSION >= 0x060500)
|
||||||
@ -154,7 +151,6 @@ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
|
|||||||
# endif
|
# endif
|
||||||
# include <objidl.h>
|
# include <objidl.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
||||||
#include <QMacPasteboardMime>
|
#include <QMacPasteboardMime>
|
||||||
@ -195,12 +191,10 @@ frontend::Application * createApplication(int & argc, char * argv[])
|
|||||||
// Setup high DPI handling. This is a bit complicated, but will be default in Qt6.
|
// Setup high DPI handling. This is a bit complicated, but will be default in Qt6.
|
||||||
// macOS does it by itself.
|
// macOS does it by itself.
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_OS_MAC)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_OS_MAC)
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
|
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
|
||||||
if (getEnv("QT_ENABLE_HIGHDPI_SCALING").empty()
|
if (getEnv("QT_ENABLE_HIGHDPI_SCALING").empty()
|
||||||
&& getEnv("QT_AUTO_SCREEN_SCALE_FACTOR").empty())
|
&& getEnv("QT_AUTO_SCREEN_SCALE_FACTOR").empty())
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
// HighDPI scale factor policy must be set before QGuiApplication is created
|
// HighDPI scale factor policy must be set before QGuiApplication is created
|
||||||
@ -851,7 +845,6 @@ public:
|
|||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Windows specific stuff goes here...
|
// Windows specific stuff goes here...
|
||||||
|
|
||||||
#if (QT_VERSION >= 0x050400)
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||||
// QWindowsMimeMetafile can only be compiled on Windows.
|
// QWindowsMimeMetafile can only be compiled on Windows.
|
||||||
|
|
||||||
@ -950,7 +943,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/// Allows to check whether ESC was pressed during a long operation
|
/// Allows to check whether ESC was pressed during a long operation
|
||||||
@ -1014,7 +1006,6 @@ struct GuiApplication::Private
|
|||||||
Private(): language_model_(nullptr), meta_fake_bit(NoModifier),
|
Private(): language_model_(nullptr), meta_fake_bit(NoModifier),
|
||||||
global_menubar_(nullptr), last_state_(Qt::ApplicationInactive)
|
global_menubar_(nullptr), last_state_(Qt::ApplicationInactive)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= 0x050400)
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||||
/// WMF Mime handler for Windows clipboard.
|
/// WMF Mime handler for Windows clipboard.
|
||||||
wmf_mime_ = new QWindowsMimeMetafile;
|
wmf_mime_ = new QWindowsMimeMetafile;
|
||||||
@ -1023,7 +1014,6 @@ struct GuiApplication::Private
|
|||||||
(QGuiApplicationPrivate::platformIntegration());
|
(QGuiApplicationPrivate::platformIntegration());
|
||||||
win_app_->registerMime(wmf_mime_);
|
win_app_->registerMime(wmf_mime_);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
initKeySequences(&theTopLevelKeymap());
|
initKeySequences(&theTopLevelKeymap());
|
||||||
}
|
}
|
||||||
@ -1108,14 +1098,12 @@ struct GuiApplication::Private
|
|||||||
QMacPasteboardMimeGraphics mac_pasteboard_mime_;
|
QMacPasteboardMimeGraphics mac_pasteboard_mime_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION >= 0x050400)
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||||
/// WMF Mime handler for Windows clipboard.
|
/// WMF Mime handler for Windows clipboard.
|
||||||
QWindowsMimeMetafile * wmf_mime_;
|
QWindowsMimeMetafile * wmf_mime_;
|
||||||
#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
|
#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
|
||||||
QWindowsApplication * win_app_;
|
QWindowsApplication * win_app_;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Allows to check whether ESC was pressed during a long operation
|
/// Allows to check whether ESC was pressed during a long operation
|
||||||
@ -1146,15 +1134,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050700
|
|
||||||
setDesktopFileName(lyx_package);
|
setDesktopFileName(lyx_package);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
|
||||||
QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
|
QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||||
#else
|
|
||||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Install LyX translator for missing Qt translations
|
// Install LyX translator for missing Qt translations
|
||||||
installTranslator(&d->gui_trans_);
|
installTranslator(&d->gui_trans_);
|
||||||
|
@ -70,15 +70,9 @@ void GuiChanges::updateContents()
|
|||||||
text += inserted ? qt_("Inserted by %1").arg(author)
|
text += inserted ? qt_("Inserted by %1").arg(author)
|
||||||
: qt_("Deleted by %1").arg(author);
|
: qt_("Deleted by %1").arg(author);
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
|
||||||
QString const date =
|
QString const date =
|
||||||
QLocale().toString(QDateTime::fromSecsSinceEpoch(c.changetime),
|
QLocale().toString(QDateTime::fromSecsSinceEpoch(c.changetime),
|
||||||
QLocale::LongFormat);
|
QLocale::LongFormat);
|
||||||
#else
|
|
||||||
QString const date =
|
|
||||||
QLocale().toString(QDateTime::fromTime_t(c.changetime),
|
|
||||||
QLocale::LongFormat);
|
|
||||||
#endif
|
|
||||||
if (!date.isEmpty()) {
|
if (!date.isEmpty()) {
|
||||||
if (!author.isEmpty())
|
if (!author.isEmpty())
|
||||||
text += qt_(" on[[date]] %1").arg(date);
|
text += qt_(" on[[date]] %1").arg(date);
|
||||||
|
@ -494,13 +494,7 @@ PreambleModule::PreambleModule(QWidget * parent)
|
|||||||
checkFindButton();
|
checkFindButton();
|
||||||
int const tabStop = 4;
|
int const tabStop = 4;
|
||||||
QFontMetrics metrics(preambleTE->currentFont());
|
QFontMetrics metrics(preambleTE->currentFont());
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
// horizontalAdvance() is available starting in 5.11.0
|
|
||||||
// setTabStopDistance() is available starting in 5.10.0
|
|
||||||
preambleTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
|
preambleTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
|
||||||
#else
|
|
||||||
preambleTE->setTabStopWidth(tabStop * metrics.width(' '));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -646,13 +640,7 @@ LocalLayout::LocalLayout(QWidget * parent)
|
|||||||
connect(editPB, SIGNAL(clicked()), this, SLOT(editExternal()));
|
connect(editPB, SIGNAL(clicked()), this, SLOT(editExternal()));
|
||||||
int const tabStop = 4;
|
int const tabStop = 4;
|
||||||
QFontMetrics metrics(locallayoutTE->currentFont());
|
QFontMetrics metrics(locallayoutTE->currentFont());
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
// horizontalAdvance() is available starting in 5.11.0
|
|
||||||
// setTabStopDistance() is available starting in 5.10.0
|
|
||||||
locallayoutTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
|
locallayoutTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
|
||||||
#else
|
|
||||||
locallayoutTE->setTabStopWidth(tabStop * metrics.width(' '));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2522,11 +2510,7 @@ void GuiDocument::updateQuoteStyles(bool const set)
|
|||||||
for (int i = 0; i < langModule->quoteStyleCO->count(); ++i) {
|
for (int i = 0; i < langModule->quoteStyleCO->count(); ++i) {
|
||||||
langModule->quoteStyleCO->setItemData(i, QVariant(comboFont), Qt::FontRole);
|
langModule->quoteStyleCO->setItemData(i, QVariant(comboFont), Qt::FontRole);
|
||||||
QString str = langModule->quoteStyleCO->itemText(i);
|
QString str = langModule->quoteStyleCO->itemText(i);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
qswidth = max(qswidth, fm.horizontalAdvance(str));
|
qswidth = max(qswidth, fm.horizontalAdvance(str));
|
||||||
#else
|
|
||||||
qswidth = max(qswidth, fm.width(str));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
// add scrollbar width and margin to width
|
// add scrollbar width and margin to width
|
||||||
qswidth += langModule->quoteStyleCO->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
|
qswidth += langModule->quoteStyleCO->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
|
||||||
|
@ -284,11 +284,7 @@ int GuiFontMetrics::width(docstring const & s) const
|
|||||||
if (math_char) {
|
if (math_char) {
|
||||||
QString const qs = toqstr(s);
|
QString const qs = toqstr(s);
|
||||||
int br_width = rbearing(s[0]);
|
int br_width = rbearing(s[0]);
|
||||||
#if QT_VERSION >= 0x050b00
|
|
||||||
int s_width = metrics_.horizontalAdvance(qs);
|
int s_width = metrics_.horizontalAdvance(qs);
|
||||||
#else
|
|
||||||
int s_width = metrics_.width(qs);
|
|
||||||
#endif
|
|
||||||
// keep value 0 for math chars with width 0
|
// keep value 0 for math chars with width 0
|
||||||
if (s_width != 0)
|
if (s_width != 0)
|
||||||
w = max(br_width, s_width);
|
w = max(br_width, s_width);
|
||||||
@ -668,17 +664,10 @@ int GuiFontMetrics::width(char_type c) const
|
|||||||
if (value != outOfLimitMetric)
|
if (value != outOfLimitMetric)
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050b00
|
|
||||||
if (is_utf16(c))
|
if (is_utf16(c))
|
||||||
value = metrics_.horizontalAdvance(ucs4_to_qchar(c));
|
value = metrics_.horizontalAdvance(ucs4_to_qchar(c));
|
||||||
else
|
else
|
||||||
value = metrics_.horizontalAdvance(toqstr(docstring(1, c)));
|
value = metrics_.horizontalAdvance(toqstr(docstring(1, c)));
|
||||||
#else
|
|
||||||
if (is_utf16(c))
|
|
||||||
value = metrics_.width(ucs4_to_qchar(c));
|
|
||||||
else
|
|
||||||
value = metrics_.width(toqstr(docstring(1, c)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
width_cache_.insert(c, value);
|
width_cache_.insert(c, value);
|
||||||
|
|
||||||
|
@ -845,25 +845,15 @@ bool KeySymbol::operator==(KeySymbol const & ks) const
|
|||||||
KeyModifier q_key_state(Qt::KeyboardModifiers state)
|
KeyModifier q_key_state(Qt::KeyboardModifiers state)
|
||||||
{
|
{
|
||||||
KeyModifier k = NoModifier;
|
KeyModifier k = NoModifier;
|
||||||
#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))
|
|
||||||
/// Additional check for Control and Meta modifier swap state.
|
|
||||||
/// Starting with Qt 5 the modifiers aren't reported correctly.
|
|
||||||
/// Until this is fixed a correction is required.
|
|
||||||
/// AFAIK it is fixed at least with Qt 5.12.0
|
|
||||||
const bool dontSwapCtrlAndMeta =
|
|
||||||
frontend::theGuiApp()->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
|
|
||||||
#else
|
|
||||||
const bool dontSwapCtrlAndMeta = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (state & (dontSwapCtrlAndMeta ? Qt::MetaModifier : Qt::ControlModifier))
|
if (state & Qt::ControlModifier)
|
||||||
k |= ControlModifier;
|
k |= ControlModifier;
|
||||||
if (state & Qt::ShiftModifier)
|
if (state & Qt::ShiftModifier)
|
||||||
k |= ShiftModifier;
|
k |= ShiftModifier;
|
||||||
if (state & Qt::AltModifier)
|
if (state & Qt::AltModifier)
|
||||||
k |= AltModifier;
|
k |= AltModifier;
|
||||||
#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
|
#if defined(USE_MACOSX_PACKAGING) || defined(USE_META_KEYBINDING)
|
||||||
if (state & (dontSwapCtrlAndMeta ? Qt::ControlModifier : Qt::MetaModifier))
|
if (state & Qt::MetaModifier)
|
||||||
k |= MetaModifier;
|
k |= MetaModifier;
|
||||||
#else
|
#else
|
||||||
if (state & Qt::MetaModifier)
|
if (state & Qt::MetaModifier)
|
||||||
|
@ -261,7 +261,7 @@ private:
|
|||||||
|
|
||||||
/// Current ratio between physical pixels and device-independent pixels
|
/// Current ratio between physical pixels and device-independent pixels
|
||||||
double pixelRatio() const {
|
double pixelRatio() const {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return devicePixelRatioF();
|
return devicePixelRatioF();
|
||||||
#else
|
#else
|
||||||
return devicePixelRatio();
|
return devicePixelRatio();
|
||||||
@ -665,11 +665,7 @@ GuiView::GuiView(int id)
|
|||||||
connect(stat_counts_, SIGNAL(clicked()), this, SLOT(statsPressed()));
|
connect(stat_counts_, SIGNAL(clicked()), this, SLOT(statsPressed()));
|
||||||
|
|
||||||
zoom_slider_ = new QSlider(Qt::Horizontal, statusBar());
|
zoom_slider_ = new QSlider(Qt::Horizontal, statusBar());
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
zoom_slider_->setFixedWidth(fm.horizontalAdvance('x') * 15);
|
zoom_slider_->setFixedWidth(fm.horizontalAdvance('x') * 15);
|
||||||
#else
|
|
||||||
zoom_slider_->setFixedWidth(fm.width('x') * 15);
|
|
||||||
#endif
|
|
||||||
// Make the defaultZoom center
|
// Make the defaultZoom center
|
||||||
zoom_slider_->setRange(10, (lyxrc.defaultZoom * 2) - 10);
|
zoom_slider_->setRange(10, (lyxrc.defaultZoom * 2) - 10);
|
||||||
// Initialize proper zoom value
|
// Initialize proper zoom value
|
||||||
@ -682,11 +678,7 @@ GuiView::GuiView(int id)
|
|||||||
zoom_slider_->setToolTip(qt_("Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust."));
|
zoom_slider_->setToolTip(qt_("Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust."));
|
||||||
|
|
||||||
// Buttons to change zoom stepwise
|
// Buttons to change zoom stepwise
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
QSize s(fm.horizontalAdvance('+'), fm.height());
|
QSize s(fm.horizontalAdvance('+'), fm.height());
|
||||||
#else
|
|
||||||
QSize s(fm.width('+'), fm.height());
|
|
||||||
#endif
|
|
||||||
zoom_in_ = new GuiClickableLabel(statusBar());
|
zoom_in_ = new GuiClickableLabel(statusBar());
|
||||||
zoom_in_->setText("+");
|
zoom_in_->setText("+");
|
||||||
zoom_in_->setFixedSize(s);
|
zoom_in_->setFixedSize(s);
|
||||||
@ -726,11 +718,7 @@ GuiView::GuiView(int id)
|
|||||||
// zoom_value_->setPalette(palette);
|
// zoom_value_->setPalette(palette);
|
||||||
zoom_value_->setForegroundRole(statusBar()->foregroundRole());
|
zoom_value_->setForegroundRole(statusBar()->foregroundRole());
|
||||||
zoom_value_->setFixedHeight(fm.height());
|
zoom_value_->setFixedHeight(fm.height());
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
zoom_value_->setMinimumWidth(fm.horizontalAdvance("444\%"));
|
zoom_value_->setMinimumWidth(fm.horizontalAdvance("444\%"));
|
||||||
#else
|
|
||||||
zoom_value_->setMinimumWidth(fm.width("444\%"));
|
|
||||||
#endif
|
|
||||||
zoom_value_->setAlignment(Qt::AlignCenter);
|
zoom_value_->setAlignment(Qt::AlignCenter);
|
||||||
zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), zoom)));
|
zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), zoom)));
|
||||||
statusBar()->addPermanentWidget(zoom_value_);
|
statusBar()->addPermanentWidget(zoom_value_);
|
||||||
@ -1706,10 +1694,8 @@ bool GuiView::event(QEvent * e)
|
|||||||
}
|
}
|
||||||
for (int i = 0; i != d.splitter_->count(); ++i)
|
for (int i = 0; i != d.splitter_->count(); ++i)
|
||||||
d.tabWorkArea(i)->setFullScreen(true);
|
d.tabWorkArea(i)->setFullScreen(true);
|
||||||
#if QT_VERSION > 0x050903
|
// Safe area measures won't allow us to go negative in margins
|
||||||
//Qt's 5.9.4 ba44cdae38406c safe area measures won't allow us to go negative in margins
|
|
||||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
|
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
|
||||||
#endif
|
|
||||||
setContentsMargins(-2, -2, -2, -2);
|
setContentsMargins(-2, -2, -2, -2);
|
||||||
// bug 5274
|
// bug 5274
|
||||||
hideDialogs("prefs", nullptr);
|
hideDialogs("prefs", nullptr);
|
||||||
@ -1728,9 +1714,7 @@ bool GuiView::event(QEvent * e)
|
|||||||
}
|
}
|
||||||
for (int i = 0; i != d.splitter_->count(); ++i)
|
for (int i = 0; i != d.splitter_->count(); ++i)
|
||||||
d.tabWorkArea(i)->setFullScreen(false);
|
d.tabWorkArea(i)->setFullScreen(false);
|
||||||
#if QT_VERSION > 0x050903
|
|
||||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, true);
|
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, true);
|
||||||
#endif
|
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1872,7 +1856,7 @@ void GuiView::resetCommandExecute()
|
|||||||
|
|
||||||
double GuiView::pixelRatio() const
|
double GuiView::pixelRatio() const
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return devicePixelRatioF();
|
return devicePixelRatioF();
|
||||||
#else
|
#else
|
||||||
return devicePixelRatio();
|
return devicePixelRatio();
|
||||||
@ -5189,14 +5173,10 @@ bool GuiView::lfunUiToggle(string const & ui_component)
|
|||||||
//are the frames in default state?
|
//are the frames in default state?
|
||||||
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
|
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
|
||||||
if (l == 0) {
|
if (l == 0) {
|
||||||
#if QT_VERSION > 0x050903
|
|
||||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
|
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);
|
||||||
#endif
|
|
||||||
setContentsMargins(-2, -2, -2, -2);
|
setContentsMargins(-2, -2, -2, -2);
|
||||||
} else {
|
} else {
|
||||||
#if QT_VERSION > 0x050903
|
|
||||||
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, true);
|
setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, true);
|
||||||
#endif
|
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -178,7 +178,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & gv)
|
|||||||
|
|
||||||
double GuiWorkArea::pixelRatio() const
|
double GuiWorkArea::pixelRatio() const
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
return devicePixelRatioF();
|
return devicePixelRatioF();
|
||||||
#else
|
#else
|
||||||
return devicePixelRatio();
|
return devicePixelRatio();
|
||||||
@ -774,8 +774,7 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
|
|||||||
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
|
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
|
||||||
#endif
|
#endif
|
||||||
q_button_state(e->button()), q_key_state(e->modifiers()));
|
q_button_state(e->button()), q_key_state(e->modifiers()));
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,10,1) && \
|
#if QT_VERSION < QT_VERSION_CHECK(5,15,1)
|
||||||
QT_VERSION < QT_VERSION_CHECK(5,15,1))
|
|
||||||
d->synthetic_mouse_event_.cmd = cmd; // QtBug QAbstractScrollArea::mouseMoveEvent
|
d->synthetic_mouse_event_.cmd = cmd; // QtBug QAbstractScrollArea::mouseMoveEvent
|
||||||
#endif
|
#endif
|
||||||
d->dispatch(cmd);
|
d->dispatch(cmd);
|
||||||
@ -785,8 +784,7 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
|
|||||||
|
|
||||||
void GuiWorkArea::mouseMoveEvent(QMouseEvent * e)
|
void GuiWorkArea::mouseMoveEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,10,1) && \
|
#if QT_VERSION < QT_VERSION_CHECK(5,15,1)
|
||||||
QT_VERSION < QT_VERSION_CHECK(5,15,1))
|
|
||||||
// cancel the event if the coordinates didn't change, this is due to QtBug
|
// cancel the event if the coordinates didn't change, this is due to QtBug
|
||||||
// QAbstractScrollArea::mouseMoveEvent, the event is triggered falsely when quickly
|
// QAbstractScrollArea::mouseMoveEvent, the event is triggered falsely when quickly
|
||||||
// double tapping a touchpad. To test: try to select a word by quickly double tapping
|
// double tapping a touchpad. To test: try to select a word by quickly double tapping
|
||||||
@ -1597,12 +1595,10 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
|
|||||||
return QVariant(d->im_cursor_rect_);
|
return QVariant(d->im_cursor_rect_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
|
||||||
case Qt::ImAnchorRectangle: {
|
case Qt::ImAnchorRectangle: {
|
||||||
return QVariant(d->im_anchor_rect_);
|
return QVariant(d->im_anchor_rect_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return QWidget::inputMethodQuery(query);
|
return QWidget::inputMethodQuery(query);
|
||||||
}
|
}
|
||||||
|
@ -320,11 +320,7 @@ void LayoutBox::Private::setFilter(QString const & s)
|
|||||||
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
|
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
|
||||||
|
|
||||||
filter_ = s;
|
filter_ = s;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
filterModel_->setFilterRegExp(charFilterRegExp(filter_));
|
filterModel_->setFilterRegExp(charFilterRegExp(filter_));
|
||||||
#else
|
|
||||||
filterModel_->setFilterRegularExpression(charFilterRegExp(filter_));
|
|
||||||
#endif
|
|
||||||
countCategories();
|
countCategories();
|
||||||
|
|
||||||
// restore old selection
|
// restore old selection
|
||||||
|
@ -766,11 +766,7 @@ QString formatToolTip(QString text, int width)
|
|||||||
text = Qt::convertFromPlainText(text, Qt::WhiteSpaceNormal);
|
text = Qt::convertFromPlainText(text, Qt::WhiteSpaceNormal);
|
||||||
// Compute desired width in pixels
|
// Compute desired width in pixels
|
||||||
QFont const font = QToolTip::font();
|
QFont const font = QToolTip::font();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
int const px_width = width * QFontMetrics(font).horizontalAdvance("M");
|
int const px_width = width * QFontMetrics(font).horizontalAdvance("M");
|
||||||
#else
|
|
||||||
int const px_width = width * QFontMetrics(font).width("M");
|
|
||||||
#endif
|
|
||||||
// Determine the ideal width of the tooltip
|
// Determine the ideal width of the tooltip
|
||||||
QTextDocument td("");
|
QTextDocument td("");
|
||||||
td.setHtml(text);
|
td.setHtml(text);
|
||||||
|
@ -179,24 +179,6 @@ QString changeExtension(QString const & oldname, QString const & ext);
|
|||||||
QString formatToolTip(QString text, int width = 30);
|
QString formatToolTip(QString text, int width = 30);
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION < 0x050300
|
|
||||||
// Very partial implementation of QSignalBlocker for archaic qt versions.
|
|
||||||
class QSignalBlocker {
|
|
||||||
public:
|
|
||||||
explicit QSignalBlocker(QObject * o)
|
|
||||||
: obj(o), init_state(obj && obj->blockSignals(true)) {}
|
|
||||||
|
|
||||||
~QSignalBlocker() {
|
|
||||||
if (obj)
|
|
||||||
obj->blockSignals(init_state);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
QObject * obj;
|
|
||||||
bool init_state;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Check if text is understood as rich text (Qt HTML) and if so, produce a
|
// Check if text is understood as rich text (Qt HTML) and if so, produce a
|
||||||
// rendering in plain text.
|
// rendering in plain text.
|
||||||
QString qtHtmlToPlainText(QString const & text);
|
QString qtHtmlToPlainText(QString const & text);
|
||||||
|
Loading…
Reference in New Issue
Block a user