mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-06-30 08:33:32 +00:00
UI: Store dock titles in BrowserDock instead of relying on Qt
Attempting to set the window title of a BrowserDock that is closed, then opening the BrowserDock, would show that BrowserDock with an incorrect title. We can handle this by overriding the showEvent of BrowserDock and manually setting the window title after the showEvent is called, hopefully ensuring that we are only setting the window title on a window that exists.
This commit is contained in:
parent
25b97df6eb
commit
f049d04af4
|
@ -18,3 +18,9 @@ void BrowserDock::closeEvent(QCloseEvent *event)
|
|||
cefWidget->closeBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserDock::showEvent(QShowEvent *event)
|
||||
{
|
||||
OBSDock::showEvent(event);
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
|
|
@ -8,10 +8,14 @@ extern QCef *cef;
|
|||
extern QCefCookieManager *panel_cookies;
|
||||
|
||||
class BrowserDock : public OBSDock {
|
||||
private:
|
||||
QString title;
|
||||
|
||||
public:
|
||||
inline BrowserDock() : OBSDock() { setAttribute(Qt::WA_NativeWindow); }
|
||||
inline BrowserDock(const QString &title) : OBSDock(title)
|
||||
inline BrowserDock(const QString &title_) : OBSDock(title_)
|
||||
{
|
||||
title = title_;
|
||||
setAttribute(Qt::WA_NativeWindow);
|
||||
}
|
||||
|
||||
|
@ -23,5 +27,8 @@ public:
|
|||
cefWidget.reset(widget_);
|
||||
}
|
||||
|
||||
inline void setTitle(const QString &title_) { title = title_; }
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
};
|
||||
|
|
|
@ -34,3 +34,8 @@ void OBSDock::closeEvent(QCloseEvent *event)
|
|||
|
||||
QDockWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void OBSDock::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDockWidget::showEvent(event);
|
||||
}
|
||||
|
|
|
@ -13,4 +13,5 @@ public:
|
|||
}
|
||||
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
};
|
||||
|
|
|
@ -181,6 +181,7 @@ void ExtraBrowsersModel::UpdateItem(Item &item)
|
|||
if (main->extraBrowserDockNames[idx] != item.title) {
|
||||
main->extraBrowserDockNames[idx] = item.title;
|
||||
dock->toggleViewAction()->setText(item.title);
|
||||
dock->setTitle(item.title);
|
||||
}
|
||||
|
||||
if (main->extraBrowserDockTargets[idx] != item.url) {
|
||||
|
|
Loading…
Reference in a new issue