mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-10 23:42:46 -07:00
Fix main window turns blank after restoring from tray (#15031)
When restoring from tray icon, although the window manager shows qbt window but qbt itself didn't handle the event correctly, i.e. the `show()` was missing and thus qbt did nothing and the window is blank. Note that at this point the `visible` property is `false`. After invoking `show()` qbt will start showing the contents and also fire another showEvent where `visible` property is `true` and here is where qbt should handle preparations for the window. Fix #9510.
This commit is contained in:
parent
d335f263f3
commit
2503271a45
1 changed files with 17 additions and 8 deletions
|
@ -1131,12 +1131,15 @@ void MainWindow::on_actionStatistics_triggered()
|
||||||
void MainWindow::showEvent(QShowEvent *e)
|
void MainWindow::showEvent(QShowEvent *e)
|
||||||
{
|
{
|
||||||
qDebug("** Show Event **");
|
qDebug("** Show Event **");
|
||||||
|
e->accept();
|
||||||
|
|
||||||
|
if (isVisible())
|
||||||
|
{
|
||||||
|
// preparations before showing the window
|
||||||
|
|
||||||
if (currentTabWidget() == m_transferListWidget)
|
if (currentTabWidget() == m_transferListWidget)
|
||||||
m_propertiesWidget->loadDynamicData();
|
m_propertiesWidget->loadDynamicData();
|
||||||
|
|
||||||
e->accept();
|
|
||||||
|
|
||||||
// Make sure the window is initially centered
|
// Make sure the window is initially centered
|
||||||
if (!m_posInitialized)
|
if (!m_posInitialized)
|
||||||
{
|
{
|
||||||
|
@ -1144,6 +1147,12 @@ void MainWindow::showEvent(QShowEvent *e)
|
||||||
m_posInitialized = true;
|
m_posInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// to avoid blank screen when restoring from tray icon
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::keyPressEvent(QKeyEvent *event)
|
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue