Add non-const overload to partition() function.

This commit is contained in:
Andrius Štikonas 2018-03-03 16:31:33 +00:00
parent fe117a20b0
commit 17451c3494
2 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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;
};