Commit 75bb4b36 authored by Sven Langkamp's avatar Sven Langkamp
Browse files

workaroung to be able to resize the filter dialog after it's centered

BUG:297313
parent c6bc9578
......@@ -43,7 +43,8 @@
struct KisFilterDialog::Private {
Private()
: currentFilter(0)
, mask(0) {
, mask(0)
, resizeCount(0) {
}
KisFilterSP currentFilter;
......@@ -51,6 +52,7 @@ struct KisFilterDialog::Private {
KisFilterMaskSP mask;
KisNodeSP node;
KisImageWSP image;
int resizeCount;
};
KisFilterDialog::KisFilterDialog(QWidget* parent, KisNodeSP node, KisImageWSP image, KisSelectionSP selection) :
......@@ -172,14 +174,18 @@ void KisFilterDialog::resizeEvent(QResizeEvent* event)
{
QDialog::resizeEvent(event);
KisView2* view = dynamic_cast<KisView2*>(parentWidget());
if(view) {
QWidget* canvas = dynamic_cast<KisView2*>(parentWidget())->canvas();
QRect rect(canvas->mapToGlobal(canvas->geometry().topLeft()), size());
int deltaX = (canvas->geometry().width() - geometry().width())/2;
int deltaY = (canvas->geometry().height() - geometry().height())/2;
rect.translate(deltaX, deltaY);
setGeometry(rect);
// Workaround, after the initalisation don't center the dialog anymore
if(d->resizeCount < 2) {
KisView2* view = dynamic_cast<KisView2*>(parentWidget());
if(view) {
QWidget* canvas = dynamic_cast<KisView2*>(parentWidget())->canvas();
QRect rect(canvas->mapToGlobal(canvas->geometry().topLeft()), size());
int deltaX = (canvas->geometry().width() - geometry().width())/2;
int deltaY = (canvas->geometry().height() - geometry().height())/2;
rect.translate(deltaX, deltaY);
setGeometry(rect);
}
d->resizeCount++;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment