Skip to content

Commit

Permalink
Fix deprecations where it won't cause compatibility issues
Browse files Browse the repository at this point in the history
Going by the documentation, most of these "new" symbols seem to have been
introduced a long time ago, in Qt 4 days even.
  • Loading branch information
J5lx committed Apr 22, 2020
1 parent afff608 commit 245ca9c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/src/colorwheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void ColorWheel::mouseReleaseEvent(QMouseEvent *)
void ColorWheel::resizeEvent(QResizeEvent* event)
{
mWheelPixmap = QPixmap(event->size());
mWheelPixmap.fill(palette().background().color());
mWheelPixmap.fill(palette().window().color());
drawWheelImage(event->size());
drawSquareImage(mCurrentColor.hue());

Expand Down
10 changes: 5 additions & 5 deletions app/src/preferencesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ void FilesPage::initPreset()
QString name = mPresetSettings->value(key).toString();
if (name.isEmpty())
continue;

QListWidgetItem* item = new QListWidgetItem(name);
item->setFlags(item->flags() | Qt::ItemIsEditable);
item->setData(Qt::UserRole, index);
Expand Down Expand Up @@ -681,19 +681,19 @@ void FilesPage::updateValues()

bool ok = true;
int defaultPresetIndex = mManager->getInt(SETTING::DEFAULT_PRESET);

for (int i = 0; i < ui->presetListWidget->count(); i++)
{
QListWidgetItem* item = ui->presetListWidget->item(i);
int presetIndex = item->data(Qt::UserRole).toInt(&ok);

bool isDefault = presetIndex == defaultPresetIndex;

QFont font = item->font();
font.setBold(isDefault); // Bold text for the default item
item->setFont(font);

QBrush backgroundBrush = (isDefault) ? palette().light() : palette().background();
QBrush backgroundBrush = (isDefault) ? palette().light() : palette().window();
item->setBackground(backgroundBrush);
}
ui->autosaveCheckBox->setChecked(mManager->isOn(SETTING::AUTO_SAVE));
Expand Down Expand Up @@ -729,7 +729,7 @@ ToolsPage::~ToolsPage()
}

void ToolsPage::updateValues()
{
{
ui->useQuickSizingBox->setChecked(mManager->isOn(SETTING::QUICK_SIZING));
setRotationIncrement(mManager->getInt(SETTING::ROTATION_INCREMENT));
}
Expand Down
6 changes: 3 additions & 3 deletions core_lib/src/graphics/bitmap/bitmapimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void BitmapImage::autoCrop()
int relRight = mBounds.width()-1;

// Check left row
isEmpty = (relBottom >= relTop); // Check left only when
isEmpty = (relBottom >= relTop); // Check left only when
while (isEmpty && relBottom >= relTop && relLeft <= relRight) // Loop through columns
{
// Point cursor to the pixel at row relTop and column relLeft
Expand Down Expand Up @@ -628,7 +628,7 @@ void BitmapImage::drawPath(QPainterPath path, QPen pen, QBrush brush,
painter.setPen(pen);
painter.setBrush(brush);
painter.setTransform(QTransform().translate(-mBounds.left(), -mBounds.top()));
painter.setMatrixEnabled(true);
painter.setWorldMatrixEnabled(true);
if (path.length() > 0)
{
/*
Expand Down Expand Up @@ -714,7 +714,7 @@ Status BitmapImage::writeFile(const QString& filename)
bool b = mImage->save(filename);
return (b) ? Status::OK : Status::FAIL;
}

if (bounds().isEmpty())
{
QFile f(filename);
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/graphics/vector/beziercurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void BezierCurve::drawPath(QPainter& painter, Object* object, QTransform transfo
qreal renderedWidth = width;
if (simplified)
{
renderedWidth = 1.0/painter.matrix().m11();
renderedWidth = 1.0/painter.worldTransform().m11();

// Make sure the line width is positive.
renderedWidth = fabs(renderedWidth);
Expand Down Expand Up @@ -483,7 +483,7 @@ void BezierCurve::drawPath(QPainter& painter, Object* object, QTransform transfo
// highlight the selected elements
colour = QColor(100,150,255); // highlight colour
painter.setBrush(Qt::NoBrush);
qreal lineWidth = 1.5/painter.matrix().m11();
qreal lineWidth = 1.5/painter.worldTransform().m11();
lineWidth = fabs(lineWidth); // make sure line width is positive, otherwise nothing is drawn
painter.setPen(QPen(QBrush(colour), lineWidth, Qt::SolidLine, Qt::RoundCap,Qt::RoundJoin));
if (isSelected()) painter.drawPath(myCurve.getSimplePath());
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/structure/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ bool Object::exportX(int frameStart, int frameEnd, QTransform view, QSize export
xPainter.setWorldTransform(thumbView);
xPainter.setClipRegion(thumbView.inverted().map(QRegion(target)));
paintImage(xPainter, i, false, antialiasing);
xPainter.resetMatrix();
xPainter.resetTransform();
xPainter.setClipping(false);
xPainter.setPen(Qt::black);
xPainter.drawRect(target);
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/tool/strokemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GNU General Public License for more details.
#include <time.h>
#include <QTabletEvent>
#include <QTimer>
#include <QTime>
#include <QElapsedTimer>
#include "object.h"
#include "assert.h"

Expand Down Expand Up @@ -76,7 +76,7 @@ class StrokeManager : public QObject

QTimer timer;

QTime mSingleshotTime;
QElapsedTimer mSingleshotTime;
QPointF mCurrentPressPixel = { 0, 0 };
QPointF mLastPressPixel2 = { 0, 0 };
QPointF mLastPressPixel = { 0, 0 };
Expand Down

0 comments on commit 245ca9c

Please sign in to comment.