Skip to content

Commit

Permalink
Make sure to use default text and document-close icons
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed Feb 11, 2025
1 parent 3ae0eec commit 93ea617
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions avogadro/qtgui/moleculemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/

#include "molecule.h"
#include "moleculemodel.h"
#include "molecule.h"

#include <QtCore/QFileInfo>
#include <QtGui/QColor>
#include <QtGui/QIcon>
#include <QtGui/QPalette>

namespace Avogadro::QtGui {

MoleculeModel::MoleculeModel(QObject* p)
: QAbstractItemModel(p), m_activeMolecule(nullptr)
{}
{
}

QModelIndex MoleculeModel::parent(const QModelIndex&) const
{
Expand Down Expand Up @@ -115,14 +117,16 @@ QVariant MoleculeModel::data(const QModelIndex& idx, int role) const
case Qt::ForegroundRole:
if (mol == m_activeMolecule)
return QVariant(QColor(Qt::red));
else
return QVariant(QColor(Qt::black));
else {
const QPalette defaultPalette;
return QVariant(defaultPalette.color(QPalette::WindowText));
}
default:
return QVariant();
}
} else if (idx.column() == 1) {
if (role == Qt::DecorationRole)
return QIcon(":/icons/fallback/32x32/edit-delete.png");
return QIcon::fromTheme("document-close");
}
return QVariant();
}
Expand Down Expand Up @@ -197,4 +201,4 @@ void MoleculeModel::itemChanged()
}
}

} // namespace Avogadro
} // namespace Avogadro::QtGui
2 changes: 2 additions & 0 deletions avogadro/qtgui/qtgui.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<qresource prefix="/">
<file>icons/fallback/32x32/cross.png</file>
<file>icons/fallback/32x32/dashed-preview.png</file>
<file>icons/fallback/32x32/document-close.png</file>
<file>icons/fallback/32x32/document-export.png</file>
<file>icons/fallback/32x32/document-import.png</file>
<file>icons/fallback/32x32/document-new.png</file>
Expand All @@ -17,6 +18,7 @@
<file>icons/fallback/32x32/edit-paste.png</file>
<file>icons/fallback/32x32/edit-delete.png</file>
<file>icons/fallback/32x32/help-about.png</file>
<file>icons/fallback/64x64/document-close.png</file>
<file>icons/fallback/64x64/document-export.png</file>
<file>icons/fallback/64x64/document-import.png</file>
<file>icons/fallback/64x64/document-new.png</file>
Expand Down

0 comments on commit 93ea617

Please sign in to comment.