mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-05 12:56:52 +01:00
ContextView: Use fixed size to avoid scrollbar issues
This commit is contained in:
parent
be01e28068
commit
a2320b99ae
@ -43,7 +43,6 @@
|
||||
#include "contextview.h"
|
||||
#include "contextalbum.h"
|
||||
|
||||
const int ContextAlbum::kWidgetSpacing = 40;
|
||||
const int ContextAlbum::kFadeTimeLineMs = 1000;
|
||||
|
||||
ContextAlbum::ContextAlbum(QWidget *parent)
|
||||
@ -97,7 +96,7 @@ QSize ContextAlbum::sizeHint() const {
|
||||
|
||||
}
|
||||
|
||||
void ContextAlbum::paintEvent(QPaintEvent*) {
|
||||
void ContextAlbum::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
if (width() != prev_width_) {
|
||||
ScaleCover();
|
||||
@ -105,6 +104,12 @@ void ContextAlbum::paintEvent(QPaintEvent*) {
|
||||
prev_width_ = width();
|
||||
}
|
||||
|
||||
QWidget::resizeEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void ContextAlbum::paintEvent(QPaintEvent*) {
|
||||
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
DrawPreviousCovers(&p);
|
||||
|
@ -54,6 +54,7 @@ class ContextAlbum : public QWidget {
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *e) override;
|
||||
void contextMenuEvent(QContextMenuEvent *e) override;
|
||||
@ -92,7 +93,6 @@ class ContextAlbum : public QWidget {
|
||||
void SearchCoverInProgress();
|
||||
|
||||
private:
|
||||
static const int kWidgetSpacing;
|
||||
static const int kFadeTimeLineMs;
|
||||
|
||||
private:
|
||||
|
@ -69,6 +69,8 @@
|
||||
#include "contextview.h"
|
||||
#include "contextalbum.h"
|
||||
|
||||
const int ContextView::kWidgetSpacing = 40;
|
||||
|
||||
ContextView::ContextView(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
app_(nullptr),
|
||||
@ -125,7 +127,7 @@ ContextView::ContextView(QWidget *parent)
|
||||
lyrics_id_(-1),
|
||||
font_size_headline_(0),
|
||||
font_size_normal_(0),
|
||||
prev_width_(0) {
|
||||
prev_width_(width()) {
|
||||
|
||||
setLayout(layout_container_);
|
||||
|
||||
@ -359,6 +361,17 @@ void ContextView::ReloadSettings() {
|
||||
|
||||
}
|
||||
|
||||
void ContextView::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
if (prev_width_ != width()) {
|
||||
widget_album_->setFixedWidth(width() - kWidgetSpacing);
|
||||
prev_width_ = width();
|
||||
}
|
||||
|
||||
QWidget::resizeEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void ContextView::Playing() {}
|
||||
|
||||
void ContextView::Stopped() {
|
||||
|
@ -64,6 +64,7 @@ class ContextView : public QWidget {
|
||||
Song song_playing() const { return song_playing_; }
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void contextMenuEvent(QContextMenuEvent*) override;
|
||||
void dragEnterEvent(QDragEnterEvent*) override;
|
||||
void dropEvent(QDropEvent*) override;
|
||||
@ -101,6 +102,8 @@ class ContextView : public QWidget {
|
||||
void AlbumCoverLoaded(const Song &song, const QImage &image);
|
||||
|
||||
private:
|
||||
static const int kWidgetSpacing;
|
||||
|
||||
Application *app_;
|
||||
CollectionView *collectionview_;
|
||||
AlbumCoverChoiceController *album_cover_choice_controller_;
|
||||
|
@ -30,7 +30,7 @@ ResizableTextEdit::ResizableTextEdit(QWidget *parent)
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
QSize ResizableTextEdit::sizeHint() const {
|
||||
|
||||
return QSize(std::max(QTextEdit::sizeHint().width(), 10), std::max(document()->size().toSize().height(), 10));
|
||||
|
Loading…
Reference in New Issue
Block a user