MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / MakeComboBoxOptionInaccessible

Function MakeComboBoxOptionInaccessible

qCC/ccRasterizeTool.cpp:68–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66constexpr char HILLSHADE_FIELD_NAME[] = "Hillshade";
67
68static void MakeComboBoxOptionInaccessible(QComboBox* comboBox, int index)
69{
70 if (!comboBox)
71 {
72 assert(false);
73 return;
74 }
75
76 const QStandardItemModel* model = qobject_cast<const QStandardItemModel*>(comboBox->model());
77 QStandardItem* item = model ? model->item(index) : 0;
78 if (item)
79 {
80 item->setFlags(item->flags() & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled));
81 // visually disable by greying out - works only if combobox has been painted already and palette returns the wanted color
82 item->setData(comboBox->palette().color(QPalette::Disabled, QPalette::Text), Qt::TextColorRole); // clear item data in order to use default color
83 }
84}
85
86ccRasterizeTool::ccRasterizeTool(ccGenericPointCloud* cloud, QWidget* parent)
87 : QDialog(parent, Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint)

Callers 1

ccRasterizeToolMethod · 0.85

Calls 4

itemMethod · 0.80
flagsMethod · 0.45
setDataMethod · 0.45
colorMethod · 0.45

Tested by

no test coverage detected