Use MainWindow instead of QApplication::activeWindow to reference the main window
The latter will not always return a valid pointer. fixes #363
This commit is contained in:
parent
31d09dbd68
commit
fde066e236
@ -1,5 +1,5 @@
|
||||
#include "Cache.h"
|
||||
#include "CommunitiesList.h"
|
||||
#include "Cache.h"
|
||||
#include "Logging.hpp"
|
||||
#include "MatrixClient.h"
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "Config.h"
|
||||
#include "Logging.hpp"
|
||||
#include "MainWindow.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include "dialogs/PreviewUploadOverlay.h"
|
||||
@ -61,9 +62,16 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
|
||||
void
|
||||
PreviewUploadOverlay::init()
|
||||
{
|
||||
auto window = QApplication::activeWindow();
|
||||
auto winsize = window->frameGeometry().size();
|
||||
auto center = window->frameGeometry().center();
|
||||
QSize winsize;
|
||||
QPoint center;
|
||||
|
||||
auto window = MainWindow::instance();
|
||||
if (window) {
|
||||
winsize = window->frameGeometry().size();
|
||||
center = window->frameGeometry().center();
|
||||
} else {
|
||||
nhlog::ui()->warn("unable to load the retrieve MainWindow's size");
|
||||
}
|
||||
|
||||
fileName_.setText(QFileInfo{filePath_}.fileName());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user