kcontrol: compiler warnings fix

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-04 10:55:08 +03:00
parent af7509ce3f
commit 46771792d4
3 changed files with 13 additions and 17 deletions

View file

@ -23,8 +23,7 @@
#include "outputgraphicsitem.h"
#include <QGraphicsScene>
#include <cmath>
#include <math.h>
#include <qmath.h>
LayoutManager::LayoutManager(RandRScreen *screen, QGraphicsScene *scene)
: QObject(screen)
@ -40,7 +39,7 @@ LayoutManager::~LayoutManager()
void LayoutManager::slotAdjustOutput(OutputGraphicsItem *output)
{
QPointF p = output->pos();
float nearest = m_scene->width() * m_scene->height();
qreal nearest = m_scene->width() * m_scene->height();
OutputGraphicsItem *selected = NULL;
OutputGraphicsItem *mouseGrabber = dynamic_cast<OutputGraphicsItem*>(m_scene->mouseGrabberItem());
@ -54,7 +53,7 @@ void LayoutManager::slotAdjustOutput(OutputGraphicsItem *output)
}
QPointF pos = cur->pos();
float distance = (p.x() - pos.x())*(p.x()-pos.x()) + (p.y() - pos.y())*(p.y() - pos.y());
qreal distance = (p.x() - pos.x())*(p.x()-pos.x()) + (p.y() - pos.y())*(p.y() - pos.y());
if (distance <=nearest) {
nearest = distance;
selected = cur;
@ -70,10 +69,10 @@ void LayoutManager::slotAdjustOutput(OutputGraphicsItem *output)
i.translate(output->scenePos());
// calculate the distances
float top = fabsf(i.top() - s.bottom());
float bottom = fabsf(i.bottom() - s.top());
float left = fabsf(i.left() - s.right());
float right = fabsf(i.right() - s.left());
qreal top = qAbs(i.top() - s.bottom());
qreal bottom = qAbs(i.bottom() - s.top());
qreal left = qAbs(i.left() - s.right());
qreal right = qAbs(i.right() - s.left());
// choose top
if (top <= bottom && top <= left && top <= right) {

View file

@ -353,9 +353,9 @@ void RandRConfig::slotDelayedUpdateView()
}
// scale the total bounding rectangle for all outputs to fit
// 80% of the containing QGraphicsView
float scaleX = (float)screenView->width() / r.width();
float scaleY = (float)screenView->height() / r.height();
float scale = (scaleX < scaleY) ? scaleX : scaleY;
qreal scaleX = qreal(screenView->width()) / r.width();
qreal scaleY = qreal(screenView->height()) / r.height();
qreal scale = (scaleX < scaleY) ? scaleX : scaleY;
scale *= 0.80f;
screenView->resetMatrix();

View file

@ -313,13 +313,10 @@ bool RandRScreen::setSize(const QSize &s)
return false;
}
int widthMM, heightMM;
float dpi;
/* values taken from xrandr */
dpi = (25.4 * DisplayHeight(QX11Info::display(), m_index)) / DisplayHeightMM(QX11Info::display(), m_index);
widthMM = (int) ((25.4 * s.width()) / dpi);
heightMM = (int) ((25.4 * s.height()) / dpi);
float dpi = (25.4 * DisplayHeight(QX11Info::display(), m_index)) / DisplayHeightMM(QX11Info::display(), m_index);
int widthMM = (int) ((25.4 * s.width()) / dpi);
int heightMM = (int) ((25.4 * s.height()) / dpi);
XRRSetScreenSize(QX11Info::display(), rootWindow(), s.width(), s.height(), widthMM, heightMM);
m_rect.setSize(s);