~adamreichold/qpdfview/trunk

« back to all changes in this revision

Viewing changes to sources/settingsdialog.cpp

  • Committer: Adam Reichold
  • Author(s): Frank Dana
  • Date: 2025-06-02 13:51:01 UTC
  • Revision ID: adam.reichold@t-online.de-20250602135101-5vu2dg9ji4g6nbn3
Reduce memory usage by using a single shared model of color names

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <QHeaderView>
32
32
#include <QPushButton>
33
33
#include <QShortcut>
 
34
#include <QStringListModel>
34
35
#include <QTableView>
35
36
 
36
37
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
108
109
        s_settings = Settings::instance();
109
110
    }
110
111
 
 
112
    m_colorNamesModel = new QStringListModel(QColor::colorNames(), this);
 
113
 
111
114
    setWindowTitle(tr("Settings") + QLatin1String(" - qpdfview"));
112
115
 
113
116
    m_graphicsTabWidget = new QTabWidget(this);
870
873
    QComboBox* comboBox = new QComboBox(this);
871
874
    comboBox->setEditable(true);
872
875
    comboBox->setInsertPolicy(QComboBox::NoInsert);
873
 
    comboBox->addItems(QColor::colorNames());
 
876
    comboBox->setModel(m_colorNamesModel);
874
877
 
875
878
    setCurrentTextToColorName(comboBox, color);
876
879