mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
f049d04af4
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.
35 lines
726 B
C++
35 lines
726 B
C++
#pragma once
|
|
|
|
#include "window-dock.hpp"
|
|
#include <QScopedPointer>
|
|
|
|
#include <browser-panel.hpp>
|
|
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_)
|
|
{
|
|
title = title_;
|
|
setAttribute(Qt::WA_NativeWindow);
|
|
}
|
|
|
|
QScopedPointer<QCefWidget> cefWidget;
|
|
|
|
inline void SetWidget(QCefWidget *widget_)
|
|
{
|
|
setWidget(widget_);
|
|
cefWidget.reset(widget_);
|
|
}
|
|
|
|
inline void setTitle(const QString &title_) { title = title_; }
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
void showEvent(QShowEvent *event) override;
|
|
};
|