Gui: Colorful/Greyable overlay status in icons
=============================================== Before this implementation, specific status via former mergeOverlayIcon() was greyed out with the visibility. With this commit, the developer has two options: a) override mergeGreyableOverlayIcons, in which case the overlay will be greyed out when the item is greyed out as per former mergeOverlayIcon() b) override mergeColorfulOverlayIcons, in which case the overlay will be superimposed after the icon is greyed out as it is the case for stardard error and recompute flags.
This commit is contained in:
committed by
abdullahtahiriyo
parent
035bea5082
commit
87c9f83bd6
@@ -4670,6 +4670,8 @@ void DocumentObjectItem::testStatus(bool resetStatus, QIcon &icon1, QIcon &icon2
|
||||
|
||||
icon.addPixmap(pxOn, QIcon::Normal, QIcon::On);
|
||||
icon.addPixmap(pxOff, QIcon::Normal, QIcon::Off);
|
||||
|
||||
icon = object()->mergeColorfulOverlayIcons(icon);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -302,10 +302,10 @@ void ViewProvider::update(const App::Property* prop)
|
||||
|
||||
QIcon ViewProvider::getIcon(void) const
|
||||
{
|
||||
return mergeOverlayIcons (Gui::BitmapFactory().pixmap(sPixmap));
|
||||
return mergeGreyableOverlayIcons (Gui::BitmapFactory().pixmap(sPixmap));
|
||||
}
|
||||
|
||||
QIcon ViewProvider::mergeOverlayIcons (const QIcon & orig) const
|
||||
QIcon ViewProvider::mergeGreyableOverlayIcons (const QIcon & orig) const
|
||||
{
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
|
||||
@@ -313,7 +313,21 @@ QIcon ViewProvider::mergeOverlayIcons (const QIcon & orig) const
|
||||
|
||||
for (Gui::ViewProviderExtension* ext : vector) {
|
||||
if (!ext->ignoreOverlayIcon())
|
||||
overlayedIcon = ext->extensionMergeOverlayIcons(overlayedIcon);
|
||||
overlayedIcon = ext->extensionMergeGreyableOverlayIcons(overlayedIcon);
|
||||
}
|
||||
|
||||
return overlayedIcon;
|
||||
}
|
||||
|
||||
QIcon ViewProvider::mergeColorfulOverlayIcons (const QIcon & orig) const
|
||||
{
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
|
||||
QIcon overlayedIcon = orig;
|
||||
|
||||
for (Gui::ViewProviderExtension* ext : vector) {
|
||||
if (!ext->ignoreOverlayIcon())
|
||||
overlayedIcon = ext->extensionMergeColorfullOverlayIcons(overlayedIcon);
|
||||
}
|
||||
|
||||
return overlayedIcon;
|
||||
|
||||
@@ -237,12 +237,20 @@ public:
|
||||
/** @name Methods used by the Tree
|
||||
* If you want to take control over the
|
||||
* appearance of your object in the tree you
|
||||
* can reimplemnt these methods.
|
||||
* can reimplement these methods.
|
||||
*/
|
||||
//@{
|
||||
/// deliver the icon shown in the tree view
|
||||
virtual QIcon getIcon(void) const;
|
||||
|
||||
/** @name Methods used by the Tree
|
||||
* If you want to take control over the
|
||||
* viewprovider specific overlay icons that will be drawn with color
|
||||
* regardless of whether the icon is greyed out or not, such as status, you
|
||||
* can reimplement this method.
|
||||
*/
|
||||
virtual QIcon mergeColorfulOverlayIcons (const QIcon & orig) const;
|
||||
|
||||
/** deliver the children belonging to this object
|
||||
* this method is used to deliver the objects to
|
||||
* the tree framework which should be grouped under its
|
||||
@@ -530,13 +538,12 @@ protected:
|
||||
/// Reimplemented from subclass
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
/** @name Methods used by the Tree
|
||||
* If you want to take control over the
|
||||
* viewprovider specific overlay icons, such as status, you
|
||||
* can reimplement this method.
|
||||
* viewprovider specific overlay icons, that will be grayed out together
|
||||
* with the base icon, you can reimplement this method.
|
||||
*/
|
||||
virtual QIcon mergeOverlayIcons (const QIcon & orig) const;
|
||||
virtual QIcon mergeGreyableOverlayIcons (const QIcon & orig) const;
|
||||
|
||||
/// Turn on mode switch
|
||||
virtual void setModeSwitch();
|
||||
|
||||
@@ -80,7 +80,7 @@ bool ViewProviderDocumentObjectGroup::isShow(void) const
|
||||
|
||||
QIcon ViewProviderDocumentObjectGroup::getIcon(void) const
|
||||
{
|
||||
return mergeOverlayIcons (Gui::BitmapFactory().iconFromTheme(sPixmap));
|
||||
return mergeGreyableOverlayIcons (Gui::BitmapFactory().iconFromTheme(sPixmap));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,8 @@ public:
|
||||
bool ignoreOverlayIcon() const {
|
||||
return m_ignoreOverlayIcon;
|
||||
}
|
||||
virtual QIcon extensionMergeOverlayIcons(const QIcon & orig) const {return orig;}
|
||||
virtual QIcon extensionMergeGreyableOverlayIcons(const QIcon & orig) const {return orig;}
|
||||
virtual QIcon extensionMergeColorfullOverlayIcons(const QIcon & orig) const {return orig;}
|
||||
|
||||
virtual void extensionStartRestoring() {}
|
||||
virtual void extensionFinishRestoring() {}
|
||||
|
||||
@@ -212,7 +212,7 @@ public:
|
||||
if (icon.isNull())
|
||||
icon = ViewProviderT::getIcon();
|
||||
else
|
||||
icon = ViewProviderT::mergeOverlayIcons(icon);
|
||||
icon = ViewProviderT::mergeGreyableOverlayIcons(icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ ViewProviderAttachExtension::ViewProviderAttachExtension()
|
||||
initExtensionType(ViewProviderAttachExtension::getExtensionClassTypeId());
|
||||
}
|
||||
|
||||
QIcon ViewProviderAttachExtension::extensionMergeOverlayIcons(const QIcon & orig) const
|
||||
QIcon ViewProviderAttachExtension::extensionMergeColorfullOverlayIcons (const QIcon & orig) const
|
||||
{
|
||||
QIcon mergedicon = orig;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
ViewProviderAttachExtension(void);
|
||||
virtual ~ViewProviderAttachExtension() = default;
|
||||
|
||||
virtual QIcon extensionMergeOverlayIcons(const QIcon & orig) const override;
|
||||
virtual QIcon extensionMergeColorfullOverlayIcons (const QIcon & orig) const override;
|
||||
|
||||
virtual void extensionUpdateData(const App::Property*) override;
|
||||
virtual void extensionSetupContextMenu(QMenu*, QObject*, const char*) override;
|
||||
|
||||
@@ -221,7 +221,7 @@ void ViewProvider::setTipIcon(bool onoff) {
|
||||
signalChangeIcon();
|
||||
}
|
||||
|
||||
QIcon ViewProvider::mergeOverlayIcons (const QIcon & orig) const
|
||||
QIcon ViewProvider::mergeColorfulOverlayIcons (const QIcon & orig) const
|
||||
{
|
||||
QIcon mergedicon = orig;
|
||||
|
||||
@@ -248,7 +248,7 @@ QIcon ViewProvider::mergeOverlayIcons (const QIcon & orig) const
|
||||
|
||||
}
|
||||
|
||||
return Gui::ViewProvider::mergeOverlayIcons(mergedicon);
|
||||
return Gui::ViewProvider::mergeColorfulOverlayIcons (mergedicon);
|
||||
}
|
||||
|
||||
bool ViewProvider::onDelete(const std::vector<std::string> &)
|
||||
|
||||
@@ -70,6 +70,8 @@ public:
|
||||
|
||||
virtual PyObject* getPyObject(void) override;
|
||||
|
||||
virtual QIcon mergeColorfulOverlayIcons (const QIcon & orig) const override;
|
||||
|
||||
protected:
|
||||
virtual void setupContextMenu(QMenu* menu, QObject* receiver, const char* member) override;
|
||||
virtual bool setEdit(int ModNum) override;
|
||||
@@ -77,8 +79,6 @@ protected:
|
||||
|
||||
virtual bool onDelete(const std::vector<std::string> &) override;
|
||||
|
||||
virtual QIcon mergeOverlayIcons (const QIcon & orig) const override;
|
||||
|
||||
/**
|
||||
* Returns a newly create dialog for the part to be placed in the task view
|
||||
* Must be reimplemented in subclasses.
|
||||
|
||||
@@ -174,6 +174,6 @@ QIcon ViewProviderLoft::getIcon(void) const {
|
||||
str += QString::fromLatin1("Subtractive_");
|
||||
|
||||
str += QString::fromLatin1("Loft.svg");
|
||||
return PartDesignGui::ViewProvider::mergeOverlayIcons(Gui::BitmapFactory().pixmap(str.toStdString().c_str()));
|
||||
return PartDesignGui::ViewProvider::mergeGreyableOverlayIcons(Gui::BitmapFactory().pixmap(str.toStdString().c_str()));
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +207,6 @@ QIcon ViewProviderPipe::getIcon(void) const {
|
||||
str += QString::fromLatin1("Subtractive_");
|
||||
|
||||
str += QString::fromLatin1("Pipe.svg");
|
||||
return PartDesignGui::ViewProvider::mergeOverlayIcons(Gui::BitmapFactory().pixmap(str.toStdString().c_str()));
|
||||
return PartDesignGui::ViewProvider::mergeGreyableOverlayIcons(Gui::BitmapFactory().pixmap(str.toStdString().c_str()));
|
||||
}
|
||||
|
||||
|
||||
@@ -172,5 +172,5 @@ QIcon ViewProviderPrimitive::getIcon(void) const {
|
||||
}
|
||||
|
||||
str += QString::fromLatin1(".svg");
|
||||
return PartDesignGui::ViewProvider::mergeOverlayIcons(Gui::BitmapFactory().pixmap(str.toStdString().c_str()));
|
||||
return PartDesignGui::ViewProvider::mergeGreyableOverlayIcons(Gui::BitmapFactory().pixmap(str.toStdString().c_str()));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ ViewProviderCosmeticExtension::ViewProviderCosmeticExtension()
|
||||
initExtensionType(ViewProviderCosmeticExtension::getExtensionClassTypeId());
|
||||
}
|
||||
|
||||
QIcon ViewProviderCosmeticExtension::extensionMergeOverlayIcons(const QIcon & orig) const
|
||||
QIcon ViewProviderCosmeticExtension::extensionMergeGreyableOverlayIcons(const QIcon & orig) const
|
||||
{
|
||||
QIcon mergedicon = orig;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
ViewProviderCosmeticExtension(void);
|
||||
virtual ~ViewProviderCosmeticExtension() = default;
|
||||
|
||||
virtual QIcon extensionMergeOverlayIcons(const QIcon & orig) const override;
|
||||
virtual QIcon extensionMergeGreyableOverlayIcons(const QIcon & orig) const override;
|
||||
|
||||
virtual void extensionUpdateData(const App::Property*) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user