Fix narrowing conversions
This commit is contained in:
@@ -559,7 +559,7 @@ void FancyTabWidget::addBottomWidget(QWidget *widget_view) {
|
||||
|
||||
void FancyTabWidget::AddTab(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label) {
|
||||
|
||||
TabData *tab = new TabData(widget_view, name, icon, label, tabs_.count(), this);
|
||||
TabData *tab = new TabData(widget_view, name, icon, label, static_cast<int>(tabs_.count()), this);
|
||||
tabs_.insert(widget_view, tab);
|
||||
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void FreeSpaceBar::DrawBar(QPainter *p, const QRect r) {
|
||||
if (additional_ > 0) {
|
||||
QRect additional_rect(bar_rect);
|
||||
additional_rect.setLeft(bar_rect.right());
|
||||
additional_rect.setWidth(static_cast<int>(static_cast<float>(r.width()) * (static_cast<float>(qMin(free_, additional_)) / total_) + 1));
|
||||
additional_rect.setWidth(static_cast<int>(static_cast<float>(r.width()) * (static_cast<float>(qMin(free_, additional_)) / static_cast<float>(total_)) + 1.0F));
|
||||
|
||||
QLinearGradient additional_gradient(additional_rect.topLeft(), additional_rect.bottomLeft());
|
||||
additional_gradient.setColorAt(0, kColorAdd1);
|
||||
@@ -233,15 +233,12 @@ void FreeSpaceBar::DrawText(QPainter *p, const QRect r) {
|
||||
|
||||
}
|
||||
|
||||
QString FreeSpaceBar::TextForSize(const QString &prefix, const qint64 size) {
|
||||
QString FreeSpaceBar::TextForSize(const QString &prefix, const quint64 size) {
|
||||
|
||||
QString ret;
|
||||
if (size > 0) {
|
||||
ret = Utilities::PrettySize(size);
|
||||
}
|
||||
else if (size < 0) {
|
||||
ret = "-" + Utilities::PrettySize(-size);
|
||||
}
|
||||
else {
|
||||
ret = "0 MB";
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ class FreeSpaceBar : public QWidget {
|
||||
static const QRgb kColorBar2;
|
||||
static const QRgb kColorBorder;
|
||||
|
||||
void set_free_bytes(const qint64 bytes) { free_ = bytes; update(); }
|
||||
void set_additional_bytes(const qint64 bytes) { additional_ = bytes; update(); }
|
||||
void set_total_bytes(const qint64 bytes) { total_ = bytes; update(); }
|
||||
void set_free_bytes(const quint64 bytes) { free_ = bytes; update(); }
|
||||
void set_additional_bytes(const quint64 bytes) { additional_ = bytes; update(); }
|
||||
void set_total_bytes(const quint64 bytes) { total_ = bytes; update(); }
|
||||
|
||||
void set_free_text(const QString &text) { free_text_ = text; update(); }
|
||||
void set_additional_text(const QString &text) { additional_text_ = text; update(); }
|
||||
@@ -77,15 +77,15 @@ class FreeSpaceBar : public QWidget {
|
||||
QColor color;
|
||||
};
|
||||
|
||||
static QString TextForSize(const QString &prefix, const qint64 size);
|
||||
static QString TextForSize(const QString &prefix, const quint64 size);
|
||||
|
||||
void DrawBar(QPainter *p, const QRect r);
|
||||
void DrawText(QPainter *p, const QRect r);
|
||||
|
||||
private:
|
||||
qint64 free_;
|
||||
qint64 additional_;
|
||||
qint64 total_;
|
||||
quint64 free_;
|
||||
quint64 additional_;
|
||||
quint64 total_;
|
||||
|
||||
QString free_text_;
|
||||
QString additional_text_;
|
||||
|
||||
@@ -228,7 +228,7 @@ QModelIndex GroupedIconView::indexAt(const QPoint &p) const {
|
||||
|
||||
const QPoint viewport_p = p + QPoint(horizontalOffset(), verticalOffset());
|
||||
|
||||
const int count = visual_rects_.count();
|
||||
const int count = static_cast<int>(visual_rects_.count());
|
||||
for (int i = 0; i<count; ++i) {
|
||||
if (visual_rects_[i].contains(viewport_p)) {
|
||||
return model()->index(i, 0);
|
||||
@@ -347,7 +347,7 @@ QVector<QModelIndex> GroupedIconView::IntersectingItems(const QRect rect) const
|
||||
|
||||
QVector<QModelIndex> ret;
|
||||
|
||||
const int count = visual_rects_.count();
|
||||
const int count = static_cast<int>(visual_rects_.count());
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (rect.intersects(visual_rects_[i])) {
|
||||
ret.append(model()->index(i, 0));
|
||||
|
||||
@@ -82,7 +82,7 @@ void MultiLoadingIndicator::UpdateText() {
|
||||
task_text[0] = task_text[0].toLower();
|
||||
|
||||
if (task.progress_max > 0) {
|
||||
int percentage = static_cast<int>(static_cast<float>(task.progress) / task.progress_max * 100);
|
||||
int percentage = static_cast<int>(static_cast<float>(task.progress) / static_cast<float>(task.progress_max) * 100.0F);
|
||||
task_text += QString(" %1%").arg(percentage);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void MultiLoadingIndicator::UpdateText() {
|
||||
text_ += "...";
|
||||
}
|
||||
|
||||
emit TaskCountChange(tasks.count());
|
||||
emit TaskCountChange(static_cast<int>(tasks.count()));
|
||||
update();
|
||||
updateGeometry();
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ void PlayingWidget::DrawContents(QPainter *p) {
|
||||
|
||||
case LargeSongDetails:
|
||||
// Work out how high the text is going to be
|
||||
const int text_height = details_->size().height();
|
||||
const int text_height = static_cast<int>(details_->size().height());
|
||||
const int cover_size = fit_width_ ? width() : qMin(kMaxCoverSize, width());
|
||||
const int x_offset = (width() - cover_loader_options_.desired_height_) / 2;
|
||||
|
||||
|
||||
@@ -92,13 +92,10 @@ void StretchHeaderView::UpdateWidths(const QList<int> §ions) {
|
||||
|
||||
if (!stretch_enabled_) return;
|
||||
|
||||
ColumnWidthType total_w = 0.0;
|
||||
|
||||
for (int i = 0; i < column_widths_.count(); ++i) {
|
||||
const ColumnWidthType w = column_widths_[i];
|
||||
int pixels = w * width();
|
||||
|
||||
total_w += w;
|
||||
int pixels = static_cast<int>(w * width());
|
||||
|
||||
if (!sections.isEmpty() && !sections.contains(i)) {
|
||||
continue;
|
||||
@@ -287,7 +284,7 @@ bool StretchHeaderView::RestoreState(const QByteArray &sdata) {
|
||||
|
||||
setSortIndicator(sort_indicator_section, Qt::SortOrder(sort_indicator_order));
|
||||
|
||||
const int persisted_column_count = qMin(qMin(visual_indices.count(), pixel_widths.count()), column_widths_.count());
|
||||
const qint64 persisted_column_count = qMin(qMin(visual_indices.count(), pixel_widths.count()), column_widths_.count());
|
||||
|
||||
// Set column visible state, visual indices and, if we're not in stretch mode, pixel widths.
|
||||
for (int i = 0; i < count() && i < persisted_column_count; ++i) {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <QFlags>
|
||||
#include <QtEvents>
|
||||
|
||||
SliderSlider::SliderSlider(const Qt::Orientation orientation, QWidget *parent, const uint max)
|
||||
SliderSlider::SliderSlider(const Qt::Orientation orientation, QWidget *parent, const int max)
|
||||
: QSlider(orientation, parent),
|
||||
sliding_(false),
|
||||
outside_(false),
|
||||
@@ -165,7 +165,7 @@ void SliderSlider::setValue(int newValue) {
|
||||
#define MARGIN 3
|
||||
|
||||
PrettySlider::PrettySlider(const Qt::Orientation orientation, const SliderMode mode, QWidget *parent, const uint max)
|
||||
: SliderSlider(orientation, parent, max), m_mode(mode) {
|
||||
: SliderSlider(orientation, parent, static_cast<int>(max)), m_mode(mode) {
|
||||
|
||||
if (m_mode == Pretty) {
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
@@ -220,7 +220,7 @@ QSize PrettySlider::sizeHint() const {
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
VolumeSlider::VolumeSlider(QWidget *parent, const uint max)
|
||||
: SliderSlider(Qt::Horizontal, parent, max),
|
||||
: SliderSlider(Qt::Horizontal, parent, static_cast<int>(max)),
|
||||
anim_enter_(false),
|
||||
anim_count_(0),
|
||||
timer_anim_(new QTimer(this)),
|
||||
@@ -317,7 +317,7 @@ void VolumeSlider::slideEvent(QMouseEvent *e) {
|
||||
|
||||
void VolumeSlider::wheelEvent(QWheelEvent *e) {
|
||||
|
||||
const uint step = e->angleDelta().y() / (e->angleDelta().x() == 0 ? 30 : -30);
|
||||
const int step = e->angleDelta().y() / (e->angleDelta().x() == 0 ? 30 : -30);
|
||||
QSlider::setValue(SliderSlider::value() + step); // clazy:exclude=skipped-base-method
|
||||
emit sliderReleased(value());
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class SliderSlider : public QSlider {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SliderSlider(const Qt::Orientation, QWidget*, const uint max = 0);
|
||||
explicit SliderSlider(const Qt::Orientation, QWidget*, const int max = 0);
|
||||
|
||||
virtual void setValue(int);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user