Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
fbe3ad6b
Commit
fbe3ad6b
authored
Feb 08, 2021
by
Waqar Ahmed
Browse files
Fix positioning of dialog
parent
8e0e9501
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/project/branchesdialog.cpp
View file @
fbe3ad6b
...
...
@@ -16,6 +16,7 @@
#include <QTextDocument>
#include <QTreeView>
#include <QVBoxLayout>
#include <QWidget>
#include <QtConcurrentRun>
#include <KTextEditor/MainWindow>
...
...
@@ -287,14 +288,16 @@ void BranchesDialog::updateViewGeometry()
m_treeView
->
resizeColumnToContents
(
0
);
m_treeView
->
resizeColumnToContents
(
1
);
const
QSize
centralSize
=
m_mainWindow
->
window
()
->
size
();
QWidget
*
window
=
m_mainWindow
->
window
();
const
QSize
centralSize
=
window
->
size
();
// width: 2.4 of editor, height: 1/2 of editor
const
QSize
viewMaxSize
(
centralSize
.
width
()
/
2.4
,
centralSize
.
height
()
/
2
);
// Position should be central over window
const
int
xPos
=
std
::
max
(
0
,
(
centralSize
.
width
()
-
viewMaxSize
.
width
())
/
2
);
const
int
yPos
=
std
::
max
(
0
,
(
centralSize
.
height
()
-
viewMaxSize
.
height
())
*
1
/
4
);
const
QPoint
centralWidgetPos
=
window
->
parentWidget
()
?
window
->
mapToGlobal
(
window
->
pos
())
:
window
->
pos
();
const
int
xPos
=
std
::
max
(
0
,
centralWidgetPos
.
x
()
+
(
centralSize
.
width
()
-
viewMaxSize
.
width
())
/
2
);
const
int
yPos
=
std
::
max
(
0
,
centralWidgetPos
.
y
()
+
(
centralSize
.
height
()
-
viewMaxSize
.
height
())
*
1
/
4
);
move
(
QPoint
(
xPos
,
yPos
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment