Center user info dialog on the screen

This commit is contained in:
Loren Burkholder 2021-01-16 15:33:33 -05:00
parent 12bc7d4131
commit cd998d1c35
3 changed files with 12 additions and 1 deletions

View file

@ -10,6 +10,8 @@ ApplicationWindow {
property var profile
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
height: 650
width: 420
minimumHeight: 420

View file

@ -61,10 +61,15 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
Q_PROPERTY(int x READ x)
Q_PROPERTY(int y READ y)
Q_PROPERTY(int width READ width)
Q_PROPERTY(int height READ height)
public:
explicit MainWindow(QWidget *parent = nullptr);
static MainWindow *instance() { return instance_; };
static MainWindow *instance() { return instance_; }
void saveCurrentWindowSize();
void openLeaveRoomDialog(const QString &room_id);

View file

@ -128,6 +128,10 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
"UserProfile needs to be instantiated on the C++ side");
static auto self = this;
qmlRegisterSingletonType<MainWindow>(
"im.nheko", 1, 0, "MainWindow", [](QQmlEngine *, QJSEngine *) -> QObject * {
return MainWindow::instance();
});
qmlRegisterSingletonType<TimelineViewManager>(
"im.nheko", 1, 0, "TimelineManager", [](QQmlEngine *, QJSEngine *) -> QObject * {
return self;