forked from qt-creator/qt-creator
ProjectExplorer: Overlay the original icon for missing files
QmlProject could be edited manually to add files into the project. In case of the files are mising in the file system (or if there's a typo in the file path) file names still shown in the project explorer without any information. This patch brings a small overlay on top of the original icon to notify the users that the file doesn't exist. Task-number: QDS-10344 Change-Id: Ia73699b048725bcc70a1ee0f52c34b55b081a779 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -72,8 +72,18 @@ public:
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||
{
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
const bool useUnavailableMarker = index.data(Project::UseUnavailableMarkerRole).toBool();
|
||||
if (useUnavailableMarker) {
|
||||
QStyleOptionViewItem opt = option;
|
||||
opt.palette.setColor(QPalette::Text, creatorTheme()->color(Theme::TextColorDisabled));
|
||||
QStyledItemDelegate::paint(painter, opt, index);
|
||||
static const QPixmap pixmap
|
||||
= QApplication::style()->standardIcon(QStyle::SP_BrowserStop).pixmap(10);
|
||||
painter->drawPixmap(option.rect.topLeft(), pixmap);
|
||||
return;
|
||||
}
|
||||
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
if (index.data(Project::isParsingRole).toBool()) {
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
|
||||
Reference in New Issue
Block a user