ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvPickOneElementDlg.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "ecvPickOneElementDlg.h"
9 
10 // UI file
11 #include <ui_pickOneElementDlg.h>
12 
14  const QString &label,
15  const QString &windowTitle /*=QString()*/,
16  QWidget *parent /*=0*/)
17  : QDialog(parent, Qt::Tool), m_ui(new Ui_PickOneElementDialog) {
18  m_ui->setupUi(this);
19 
20  if (!windowTitle.isNull()) {
21  setWindowTitle(windowTitle);
22  }
23 
24  m_ui->comboLabel->setText(label);
25 }
26 
28  if (m_ui) {
29  delete m_ui;
30  m_ui = nullptr;
31  }
32 }
33 
34 void ccPickOneElementDlg::addElement(const QString &elementName) {
35  m_ui->comboBox->addItem(elementName);
36 }
37 
39  m_ui->comboBox->setCurrentIndex(index);
40 }
41 
43  return m_ui->comboBox->currentIndex();
44 }
~ccPickOneElementDlg() override
Destructor.
void addElement(const QString &elementName)
Add an element to the combo box.
ccPickOneElementDlg(const QString &label, const QString &windowTitle=QString(), QWidget *parent=nullptr)
Default constructor.
int getSelectedIndex()
Returns the combo box current index (after completion)
Ui_PickOneElementDialog * m_ui
Associated UI.
void setDefaultIndex(int index)
Sets the combo box default index.