[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krita] libs/ui: Don't crash when shoing the popup palette and hud after changing canvas type
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2016-09-26 9:23:06
Message-ID: E1boS7u-0007az-JC () code ! kde ! org
[Download RAW message or body]
Git commit a55505eb9d0f8e16b209bd41267d341943fbfb8e by Boudewijn Rempt.
Committed on 26/09/2016 at 09:21.
Pushed by rempt into branch 'master'.
Don't crash when shoing the popup palette and hud after changing canvas type
M +5 -3 libs/ui/kis_popup_palette.cpp
M +1 -0 libs/ui/kis_popup_palette.h
http://commits.kde.org/krita/a55505eb9d0f8e16b209bd41267d341943fbfb8e
diff --git a/libs/ui/kis_popup_palette.cpp b/libs/ui/kis_popup_palette.cpp
index 98db88b..e94d90e 100644
--- a/libs/ui/kis_popup_palette.cpp
+++ b/libs/ui/kis_popup_palette.cpp
@@ -251,21 +251,18 @@ void KisPopupPalette::slotEnableChangeFGColor()
void KisPopupPalette::adjustLayout(const QPoint &p)
{
KIS_ASSERT_RECOVER_RETURN(m_brushHud);
-
if (isVisible() && parentWidget()) {
const QRect fitRect = kisGrowRect(parentWidget()->rect(), -widgetMargin);
const QPoint paletteCenterOffset(width() / 2, height() / 2);
QRect paletteRect = rect();
paletteRect.moveTo(p - paletteCenterOffset);
-
if (m_brushHudButton->isChecked()) {
m_brushHud->updateGeometry();
paletteRect.adjust(0, 0, m_brushHud->width() + hudMargin, 0);
}
paletteRect = kisEnsureInRect(paletteRect, fitRect);
-
move(paletteRect.topLeft());
m_brushHud->move(paletteRect.topLeft() + QPoint(widgetSize + hudMargin, 0));
m_lastCenterPoint = p;
@@ -312,6 +309,11 @@ void KisPopupPalette::setVisible(bool b)
QWidget::setVisible(b);
}
+void KisPopupPalette::setParent(QWidget *parent) {
+ m_brushHud->setParent(parent);
+ QWidget::setParent(parent);
+}
+
QSize KisPopupPalette::sizeHint() const
{
return QSize(widgetSize, widgetSize);
diff --git a/libs/ui/kis_popup_palette.h b/libs/ui/kis_popup_palette.h
index a45e375..741d610 100644
--- a/libs/ui/kis_popup_palette.h
+++ b/libs/ui/kis_popup_palette.h
@@ -57,6 +57,7 @@ public:
//functions to set up selectedColor
void setSelectedColor(int x);
int selectedColor() const;
+ void setParent(QWidget *parent);
virtual void tabletEvent(QTabletEvent * event);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic