Fix check for context tab in TabSwitched

Broken with Qt 6
This commit is contained in:
Jonas Kvinge 2020-07-18 15:52:36 +02:00
parent d7f88cf3a4
commit b15c4ecd10
3 changed files with 10 additions and 4 deletions

View File

@ -1197,7 +1197,7 @@ void MainWindow::TrackSkipped(PlaylistItemPtr item) {
void MainWindow::TabSwitched() {
if (playing_widget_ && ui_->action_toggle_show_sidebar->isChecked() && (ui_->tabs->tabBar()->tabData(ui_->tabs->currentIndex()).toString().toLower() != "context" || !context_view_->album_enabled())) {
if (playing_widget_ && ui_->action_toggle_show_sidebar->isChecked() && (ui_->tabs->currentIndex() != ui_->tabs->IndexOfTab(context_view_) || !context_view_->album_enabled())) {
ui_->widget_playing->SetEnabled();
}
else {

View File

@ -538,6 +538,11 @@ bool FancyTabWidget::DisableTab(QWidget *widget_view) {
}
int FancyTabWidget::IndexOfTab(QWidget *widget) {
if (!tabs_.contains(widget)) return -1;
return QTabWidget::indexOf(tabs_[widget]->page());
}
void FancyTabWidget::paintEvent(QPaintEvent *pe) {
if (mode() != FancyTabWidget::Mode_LargeSidebar && mode() != FancyTabWidget::Mode_SmallSidebar) {

View File

@ -48,11 +48,12 @@ class FancyTabWidget : public QTabWidget {
public:
explicit FancyTabWidget(QWidget *parent = nullptr);
void AddTab(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label);
void AddTab(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label);
bool EnableTab(QWidget *widget_view);
bool DisableTab(QWidget *widget_view);
int insertTab(const int idx, QWidget *page, const QIcon &icon, const QString &label);
void addBottomWidget(QWidget* widget_view);
int IndexOfTab(QWidget *widget);
void setBackgroundPixmap(const QPixmap& pixmap);
void addSpacer();
@ -101,11 +102,11 @@ class FancyTabWidget : public QTabWidget {
void addMenuItem(QActionGroup* group, const QString& text, Mode mode);
QPixmap background_pixmap_;
QMenu* menu_;
QMenu *menu_;
Mode mode_;
QWidget *bottom_widget_;
QMap <QWidget*, TabData*> tabs_;
QMap<QWidget*, TabData*> tabs_;
bool bg_color_system_;
bool bg_gradient_;