Commit 7ab9a631 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some deprecated methods

parent d708e9a9
......@@ -61,7 +61,7 @@ AltTransView::AltTransView(QWidget* parent, Catalog* catalog, const QVector<QAct
hide();
m_browser->setReadOnly(true);
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
QTimer::singleShot(0, this, &AltTransView::initLater);
}
......
......@@ -158,7 +158,7 @@ BinUnitsView::BinUnitsView(Catalog* catalog, QWidget* parent)
m_view->setModel(m_model);
m_view->setRootIsDecorated(false);
m_view->setAlternatingRowColors(true);
m_view->viewport()->setBackgroundRole(QPalette::Background);
m_view->viewport()->setBackgroundRole(QPalette::Window);
connect(m_view, &MyTreeView::doubleClicked, this, &BinUnitsView::mouseDoubleClicked);
connect(catalog, QOverload<>::of(&Catalog::signalFileLoaded), this, &BinUnitsView::fileLoaded);
......
......@@ -118,11 +118,11 @@ CatalogView::CatalogView(QWidget* parent, Catalog* catalog)
m_browser->setRootIsDecorated(false);
m_browser->setAllColumnsShowFocus(true);
m_browser->setAlternatingRowColors(true);
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
#ifdef Q_OS_DARWIN
QPalette p;
p.setColor(QPalette::AlternateBase, p.color(QPalette::Background).darker(110));
p.setColor(QPalette::Highlight, p.color(QPalette::Background).darker(150));
p.setColor(QPalette::AlternateBase, p.color(QPalette::Window).darker(110));
p.setColor(QPalette::Highlight, p.color(QPalette::Window).darker(150));
m_browser->setPalette(p);
#endif
......
......@@ -54,7 +54,7 @@ FlowLayout::FlowLayout(User user,
, m_receiver(signalingWidget)
{
setSizeConstraint(QLayout::SetMinAndMaxSize);
setMargin(margin);
setContentsMargins(margin, margin, margin, margin);
setSpacing(spacing);
if (user == glossary) {
......@@ -121,7 +121,7 @@ int FlowLayout::count() const
}
Qt::Orientations FlowLayout::expandingDirections() const
{
return 0;
return {};
}
bool FlowLayout::hasHeightForWidth() const
{
......
......@@ -29,7 +29,7 @@
#include "project.h"
#include "prefs_lokalize.h"
#include <QCoreApplication>
#include <QElapsedTimer>
CompletionStorage* CompletionStorage::_instance = 0;
void CompletionStorage::cleanupCompletionStorage()
......@@ -50,7 +50,7 @@ CompletionStorage* CompletionStorage::instance()
void CompletionStorage::scanCatalog(Catalog* catalog)
{
if (!catalog->numberOfEntries()) return;
QTime a; a.start();
QElapsedTimer a; a.start();
int wordCompletionLength = Settings::self()->wordCompletionLength();
/* we can't skip the scanning because there might be explicit completion triggered
......
......@@ -45,6 +45,7 @@
#include <QTimer>
#include <QPointer>
#include <QElapsedTimer>
#define IGNOREACCELS KFind::MinimumUserOption
......@@ -254,7 +255,7 @@ void EditorTab::findNext(const DocPosition& startingPos)
QRegExp rx("[^(\\\\n)>]\n");
QTime a; a.start();
QElapsedTimer a; a.start();
//_searchingPos.part=DocPosition::Source;
bool ignoreaccels = m_find->options()&IGNOREACCELS;
bool includenotes = m_find->options()&INCLUDENOTES;
......
......@@ -106,7 +106,7 @@ EditorView::EditorView(QWidget *parent, Catalog* catalog/*,keyEventHandler* kh*/
m_sourceTextEdit->setWhatsThis(i18n("<qt><p><b>Original String</b></p>\n"
"<p>This part of the window shows the original message\n"
"of the currently displayed entry.</p></qt>"));
m_sourceTextEdit->viewport()->setBackgroundRole(QPalette::Background);
m_sourceTextEdit->viewport()->setBackgroundRole(QPalette::Window);
m_sourceTextEdit->setVisualizeSeparators(Settings::self()->visualizeSeparators());
m_targetTextEdit->setVisualizeSeparators(Settings::self()->visualizeSeparators());
......
......@@ -39,6 +39,7 @@
#include <QXmlStreamReader>
#include <QBuffer>
#include <QApplication>
#include <QElapsedTimer>
#include <klocalizedstring.h>
......@@ -71,7 +72,7 @@ Glossary::Glossary(QObject* parent)
//BEGIN DISK
bool Glossary::load(const QString& newPath)
{
QTime a; a.start();
QElapsedTimer a; a.start();
//BEGIN NEW
QIODevice* device = new QFile(newPath);
if (!device->open(QFile::ReadOnly | QFile::Text)) {
......
......@@ -48,6 +48,7 @@
#include <QTime>
#include <QSet>
#include <QScrollArea>
#include <QElapsedTimer>
#include <QPushButton>
#include <klocalizedstring.h>
......@@ -83,7 +84,7 @@ GlossaryView::GlossaryView(QWidget* parent, Catalog* catalog, const QVector<QAct
setWidget(m_browser);
m_browser->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
m_browser->setAutoFillBackground(true);
m_browser->setBackgroundRole(QPalette::Background);
m_browser->setBackgroundRole(QPalette::Window);
m_rxClean.setMinimal(true);
connect(m_glossary, &Glossary::changed, this, QOverload<>::of(&GlossaryView::slotNewEntryDisplayed), Qt::QueuedConnection);
......@@ -116,7 +117,7 @@ void GlossaryView::slotNewEntryDisplayed()
void GlossaryView::slotNewEntryDisplayed(DocPosition pos)
{
//qCWarning(LOKALIZE_LOG)<<"\n\n\n\nstart"<<pos.entry<<m_currentIndex;
QTime time; time.start();
QElapsedTimer time; time.start();
if (pos.entry == -1)
pos.entry = m_currentIndex;
else
......
......@@ -66,6 +66,7 @@
#include <QLabel>
#include <QIcon>
#include <QApplication>
#include <QElapsedTimer>
LokalizeMainWindow::LokalizeMainWindow()
......@@ -468,7 +469,7 @@ void LokalizeMainWindow::setupActions()
//all operations that can be done after initial setup
//(via QTimer::singleShot) go to initLater()
QTime aaa;
QElapsedTimer aaa;
aaa.start();
setStandardToolBarMenuEnabled(true);
......
......@@ -62,7 +62,7 @@ MergeView::MergeView(QWidget* parent, Catalog* catalog, bool primary)
setAcceptDrops(true);
m_browser->setReadOnly(true);
m_browser->setContextMenuPolicy(Qt::NoContextMenu);
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
setContextMenuPolicy(Qt::ActionsContextMenu);
}
......
......@@ -66,7 +66,7 @@ MsgCtxtView::MsgCtxtView(QWidget* parent, Catalog* catalog)
m_stackedLayout = new QStackedLayout(main);
m_stackedLayout->addWidget(m_browser);
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
m_browser->setOpenLinks(false);
connect(m_browser, &QTextBrowser::anchorClicked, this, &MsgCtxtView::anchorClicked);
}
......
......@@ -253,7 +253,7 @@ PhasesWindow::PhasesWindow(Catalog* catalog, QWidget *parent)
m_stackedLayout = new QStackedLayout(m_noteView);
m_stackedLayout->addWidget(m_browser);
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
m_browser->setOpenLinks(false);
connect(m_browser, &QTextBrowser::anchorClicked, this, &PhasesWindow::anchorClicked);
......
......@@ -331,7 +331,7 @@ void SettingsController::projectConfigure()
w = new QWidget(dialog);
QVBoxLayout* layout = new QVBoxLayout(w);
layout->setSpacing(6);
layout->setMargin(11);
layout->setContentsMargins(11, 11, 11, 11);
//m_projectActionsEditor=new Kross::ActionCollectionEditor(Kross::Manager::self().actionCollection()->collection(Project::instance()->projectID()),w);
......
......@@ -43,6 +43,7 @@
#include <QLocale>
#include <QTimer>
#include <QTime>
#include <QElapsedTimer>
#include <QDir>
#include <QFileInfo>
#include <QStringBuilder>
......@@ -152,7 +153,7 @@ Project::~Project()
void Project::load(const QString &newProjectPath, const QString& forcedTargetLangCode, const QString& forcedProjectId)
{
QTime a; a.start();
QElapsedTimer a; a.start();
TM::threadPool()->clear();
qCDebug(LOKALIZE_LOG) << "loading" << newProjectPath << "finishing tm jobs...";
......
......@@ -149,7 +149,7 @@ TMView::TMView(QWidget* parent, Catalog* catalog, const QVector<QAction*>& actio
setWidget(m_browser);
m_browser->document()->setDefaultStyleSheet(QStringLiteral("p.close_match { font-weight:bold; }"));
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
QTimer::singleShot(0, this, &TMView::initLater);
connect(m_catalog, QOverload<const QString &>::of(&Catalog::signalFileLoaded), this, &TMView::slotFileLoaded);
......
......@@ -74,7 +74,7 @@ WebQueryView::WebQueryView(QWidget* parent, Catalog* catalog, const QVector<QAct
hide();
m_browser->viewport()->setBackgroundRole(QPalette::Background);
m_browser->viewport()->setBackgroundRole(QPalette::Window);
m_browser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QWidget* w = new QWidget(m_splitter);
......
......@@ -50,6 +50,7 @@
#include <QMouseEvent>
#include <QToolTip>
#include <QScrollBar>
#include <QElapsedTimer>
inline static QImage generateImage(const QString& str, const QFont& font)
......@@ -1051,19 +1052,19 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
switch (event->modifiers()) {
case Qt::ControlModifier:
if (event->delta() > 0)
if (event->angleDelta().y() > 0)
emit gotoPrevFuzzyRequested();
else
emit gotoNextFuzzyRequested();
break;
case Qt::AltModifier:
if (event->delta() > 0)
if (event->angleDelta().y() > 0)
emit gotoPrevUntranslatedRequested();
else
emit gotoNextUntranslatedRequested();
break;
case Qt::ControlModifier + Qt::ShiftModifier:
if (event->delta() > 0)
if (event->angleDelta().y() > 0)
emit gotoPrevFuzzyUntrRequested();
else
emit gotoNextFuzzyUntrRequested();
......@@ -1071,7 +1072,7 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
case Qt::ShiftModifier:
return KTextEdit::wheelEvent(event);
default:
if (event->delta() > 0)
if (event->angleDelta().y() > 0)
emit gotoPrevRequested();
else
emit gotoNextRequested();
......@@ -1282,7 +1283,7 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
void TranslationUnitTextEdit::doCompletion(int pos) {
QTime a; a.start();
QElapsedTimer a; a.start();
QString target = m_catalog->targetWithTags(m_currentPos).string;
int sp = target.lastIndexOf(CompletionStorage::instance()->rxSplit, pos - 1);
int len = (pos - sp) - 1;
......
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