Replace use of C-style casts

This commit is contained in:
Jonas Kvinge
2022-06-13 00:23:42 +02:00
parent abdcadb5fa
commit d82fd421ed
39 changed files with 95 additions and 93 deletions

View File

@@ -224,7 +224,7 @@ void PlayingWidget::CreateModeAction(const Mode mode, const QString &text, QActi
void PlayingWidget::SetMode(const int mode) {
mode_ = Mode(mode);
mode_ = static_cast<Mode>(mode);
fit_cover_width_action_->setEnabled(mode_ != SmallSongDetails);
@@ -485,7 +485,7 @@ void PlayingWidget::FadePreviousTrack(const qreal value) {
if (!visible_) return;
pixmap_previous_track_opacity_ = value;
if (qFuzzyCompare(pixmap_previous_track_opacity_, qreal(0.0))) {
if (qFuzzyCompare(pixmap_previous_track_opacity_, static_cast<qreal>(0.0))) {
pixmap_previous_track_ = QPixmap();
}

View File

@@ -196,7 +196,7 @@ void StretchHeaderView::SectionResized(const int logical, const int, const int n
if (in_mouse_move_event_) {
// Update this section's proportional width
column_widths_[logical] = ColumnWidthType(new_size) / width();
column_widths_[logical] = static_cast<ColumnWidthType>(new_size) / width();
// Find the visible sections to the right of the section that's being resized
int visual = visualIndex(logical);
@@ -229,7 +229,7 @@ void StretchHeaderView::SetStretchEnabled(const bool enabled) {
// Initialize the list of widths from the current state of the widget
column_widths_.resize(count());
for (int i = 0; i < count(); ++i) {
column_widths_[i] = ColumnWidthType(sectionSize(i)) / width();
column_widths_[i] = static_cast<ColumnWidthType>(sectionSize(i)) / width();
}
// Stretch the columns to fill the widget
@@ -282,7 +282,7 @@ bool StretchHeaderView::RestoreState(const QByteArray &sdata) {
s >> sort_indicator_order;
s >> sort_indicator_section;
setSortIndicator(sort_indicator_section, Qt::SortOrder(sort_indicator_order));
setSortIndicator(sort_indicator_section, static_cast<Qt::SortOrder>(sort_indicator_order));
const qint64 persisted_column_count = qMin(qMin(visual_indices.count(), pixel_widths.count()), column_widths_.count());
@@ -336,7 +336,7 @@ QByteArray StretchHeaderView::SaveState() const {
s << pixel_widths;
s << visual_indices;
s << column_widths_;
s << int(sortIndicatorOrder());
s << static_cast<int>(sortIndicatorOrder());
s << sortIndicatorSection();
return ret;
@@ -372,7 +372,7 @@ QByteArray StretchHeaderView::ResetState() {
s << pixel_widths;
s << visual_indices;
s << column_widths_;
s << int(Qt::AscendingOrder);
s << static_cast<int>(Qt::AscendingOrder);
s << 0;
RestoreState(ret);

View File

@@ -221,7 +221,7 @@ VolumeSlider::VolumeSlider(QWidget *parent, const uint max)
anim_enter_(false),
anim_count_(0),
timer_anim_(new QTimer(this)),
pixmap_inset_(QPixmap(drawVolumePixmap())) {
pixmap_inset_(drawVolumePixmap()) {
setFocusPolicy(Qt::NoFocus);