mirror of
https://github.com/RetroShare/RetroShare.git
synced 2026-01-15 07:21:10 -05:00
possibly fix window reopening issues
This commit is contained in:
parent
0bca0d3b27
commit
70bf22d6ca
1 changed files with 22 additions and 9 deletions
|
|
@ -74,8 +74,14 @@ void StatisticsWindow::showYourself()
|
|||
mInstance = new StatisticsWindow();
|
||||
}
|
||||
|
||||
/* Ensure the window is visible and restored if minimized */
|
||||
if (mInstance->isMinimized()) {
|
||||
mInstance->showNormal();
|
||||
}
|
||||
|
||||
mInstance->show();
|
||||
mInstance->activateWindow();
|
||||
mInstance->raise(); /* Bring to front */
|
||||
mInstance->activateWindow(); /* Give focus */
|
||||
}
|
||||
|
||||
StatisticsWindow* StatisticsWindow::getInstance()
|
||||
|
|
@ -93,22 +99,26 @@ void StatisticsWindow::releaseInstance()
|
|||
/********************************************** STATIC WINDOW *************************************/
|
||||
|
||||
|
||||
|
||||
StatisticsWindow::StatisticsWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::StatisticsWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
/* Automatically destroy the object when the window is closed */
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
initStackedPage();
|
||||
connect(ui->stackPages, SIGNAL(currentChanged(int)), this, SLOT(setNewPage(int)));
|
||||
ui->stackPages->setCurrentIndex(0);
|
||||
int toolSize = Settings->getToolButtonSize();
|
||||
ui->toolBar->setToolButtonStyle(Settings->getToolButtonStyle());
|
||||
ui->toolBar->setIconSize(QSize(toolSize,toolSize));
|
||||
setWindowTitle("RetroShare Statistics - " + MainWindow::getInstance()->get_nameAndLocation());
|
||||
|
||||
int toolSize = Settings->getToolButtonSize();
|
||||
ui->toolBar->setToolButtonStyle(Settings->getToolButtonStyle());
|
||||
ui->toolBar->setIconSize(QSize(toolSize,toolSize));
|
||||
|
||||
setWindowTitle("RetroShare Statistics - " + MainWindow::getInstance()->get_nameAndLocation());
|
||||
}
|
||||
|
||||
StatisticsWindow::~StatisticsWindow()
|
||||
|
|
@ -233,8 +243,11 @@ void StatisticsWindow::setNewPage(int page)
|
|||
void StatisticsWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
close(); // Close window is escape is pressed
|
||||
/* This will trigger the closeEvent and, thanks to WA_DeleteOnClose, the destructor */
|
||||
close();
|
||||
} else {
|
||||
/* Pass the event to the base class for default handling */
|
||||
QMainWindow::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue