From 17451c34940ab605dba7aa37a938267cca708961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 3 Mar 2018 16:31:33 +0000 Subject: [PATCH] Add non-const overload to partition() function. --- src/gui/partwidget.cpp | 4 ++-- src/gui/partwidget.h | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/partwidget.cpp b/src/gui/partwidget.cpp index c73a1e1..49b252f 100644 --- a/src/gui/partwidget.cpp +++ b/src/gui/partwidget.cpp @@ -30,7 +30,7 @@ @param parent pointer to the parent widget @param p pointer to the Partition this widget will show. must not be nullptr. */ -PartWidget::PartWidget(QWidget* parent, const Partition* p) : +PartWidget::PartWidget(QWidget* parent, Partition* p) : PartWidgetBase(parent), m_Partition(nullptr), m_Active(false) @@ -40,7 +40,7 @@ PartWidget::PartWidget(QWidget* parent, const Partition* p) : m_fileSystemColorCode = FileSystem::defaultColorCode; } -void PartWidget::init(const Partition* p) +void PartWidget::init(Partition* p) { m_Partition = p; diff --git a/src/gui/partwidget.h b/src/gui/partwidget.h index ee86f2d..452aa69 100644 --- a/src/gui/partwidget.h +++ b/src/gui/partwidget.h @@ -44,9 +44,9 @@ class LIBKPMCORE_EXPORT PartWidget : public PartWidgetBase Q_OBJECT public: - explicit PartWidget(QWidget* parent, const Partition* p = nullptr); + explicit PartWidget(QWidget* parent, Partition* p = nullptr); - void init(const Partition* p); + void init(Partition* p); void setActive(bool b) { m_Active = b; } @@ -55,6 +55,10 @@ public: } void updateChildren(); + Partition* partition() { + return m_Partition; /**< @return the widget's Partition */ + } + const Partition* partition() const { return m_Partition; /**< @return the widget's Partition */ } @@ -70,7 +74,7 @@ protected: void drawGradient(QPainter* painter, const QColor& color, const QRect& rect, bool active = false) const; private: - const Partition* m_Partition; + Partition* m_Partition; bool m_Active; std::array< QColor, FileSystem::__lastType > m_fileSystemColorCode; };