More const detach fixes

This commit is contained in:
Jonas Kvinge
2024-08-23 20:30:59 +02:00
parent be09011bb7
commit 7ebcc73a49
54 changed files with 195 additions and 180 deletions

View File

@@ -278,7 +278,8 @@ void FancyTabWidget::CurrentTabChangedSlot(const int idx) {
int FancyTabWidget::IndexOfTab(QWidget *widget) {
if (!tabs_.contains(widget)) return -1;
return QTabWidget::indexOf(tabs_[widget]->page());
QWidget *page = tabs_.value(widget)->page();
return QTabWidget::indexOf(page);
}

View File

@@ -101,7 +101,7 @@ void LoginStateWidget::SetLoggedIn(const State state, const QString &account_nam
void LoginStateWidget::FocusLastCredentialField() {
if (!credential_fields_.isEmpty()) {
QObject *object = credential_fields_.last();
QObject *object = credential_fields_.constLast();
QWidget *widget = qobject_cast<QWidget*>(object);
QLineEdit *line_edit = qobject_cast<QLineEdit*>(object);

View File

@@ -239,7 +239,7 @@ void StretchHeaderView::NormaliseWidths(const QList<int> &sections) {
selected_sum = 0.0;
for (int i = 0; i < count(); ++i) {
if (sections.contains(i)) {
selected_sum += column_widths_[i];
selected_sum += column_widths_.value(i);
}
}
}
@@ -263,7 +263,7 @@ void StretchHeaderView::ResizeSections(const QList<int> &sections) {
if (isSectionHidden(i) || (!sections.isEmpty() && !sections.contains(i))) {
continue;
}
const int pixels = static_cast<int>(column_widths_[i] * width());
const int pixels = static_cast<int>(column_widths_.value(i) * width());
if (pixels != 0) {
resizeSection(i, pixels);
}

View File

@@ -118,7 +118,7 @@ void VolumeSlider::paintEvent(QPaintEvent*) {
p.drawPixmap(0, 0, pixmap_gradient_, 0, 0, offset + padding, 0);
p.drawPixmap(0, 0, pixmap_inset_);
p.drawPixmap(offset - handle_pixmaps_[0].width() / 2 + padding, 0, handle_pixmaps_[anim_count_]);
p.drawPixmap(offset - handle_pixmaps_.value(0).width() / 2 + padding, 0, handle_pixmaps_[anim_count_]);
// Draw percentage number
QStyleOptionViewItem opt;