ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvSelectChildrenDlg.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 "ecvSelectChildrenDlg.h"
9 
10 #include "ui_selectChildrenDlg.h"
11 
12 static QString s_lastName;
13 static bool s_lastNameState = false;
15 static bool s_lastTypeState = true;
16 static bool s_lastTypeStrictState = true;
17 static bool s_lastUseRegex = true;
18 
20  : QDialog(parent, Qt::Tool), mUI(new Ui::SelectChildrenDialog) {
21  mUI->setupUi(this);
22 
23  mUI->typeCheckBox->setChecked(s_lastTypeState);
24  mUI->typeStrictCheckBox->setChecked(s_lastTypeStrictState);
25  mUI->nameCheckBox->setChecked(s_lastNameState);
26  mUI->nameLineEdit->setText(s_lastName);
27  mUI->checkBoxRegex->setChecked(s_lastUseRegex);
28 
29  connect(mUI->buttonBox, &QDialogButtonBox::accepted, this,
31 }
32 
34  delete mUI;
35  mUI = nullptr;
36 }
37 
39  mUI->typeComboBox->addItem(typeName, QVariant::fromValue<qint64>(type));
40 
41  // auto select last selected type
42  if (type == s_lastType) {
43  mUI->typeComboBox->setCurrentIndex(mUI->typeComboBox->count() - 1);
44  }
45 }
46 
48  s_lastNameState = mUI->nameCheckBox->isChecked();
49  s_lastName = mUI->nameLineEdit->text();
50  s_lastTypeState = mUI->typeCheckBox->isChecked();
51  s_lastTypeStrictState = mUI->typeCheckBox->isChecked();
54 }
55 
57  if (!mUI->typeCheckBox->isChecked()) {
59  }
60 
61  int currentIndex = mUI->typeComboBox->currentIndex();
62  return static_cast<CV_CLASS_ENUM>(
63  mUI->typeComboBox->itemData(currentIndex).value<qint64>());
64 }
65 
67  if (!mUI->nameCheckBox->isChecked()) {
68  return QString();
69  }
70 
71  return mUI->nameLineEdit->text();
72 }
73 
75  return mUI->typeStrictCheckBox->isChecked();
76 }
77 
79  return mUI->typeCheckBox->isChecked();
80 }
81 
83  return mUI->checkBoxRegex->isChecked();
84 }
85 
87  return mUI->nameCheckBox->isChecked();
88 }
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
char type
bool getNameMatchIsUsed() const
if performing name-match (regex or not)
bool getNameIsRegex() const
if the name must be considered as regex
bool getStrictMatchState() const
Returns the state of the strict type checkbox.
void onAccept()
Called when the dialog is accepted.
ccSelectChildrenDlg(QWidget *parent=nullptr)
Default constructor.
CV_CLASS_ENUM getSelectedType()
Returns the selected type.
void addType(QString typeName, CV_CLASS_ENUM type)
Add an element to the 'type' combo box.
QString getSelectedName()
Returns the selected name (if any)
static bool s_lastNameState
static QString s_lastName
static bool s_lastUseRegex
static CV_CLASS_ENUM s_lastType
static bool s_lastTypeStrictState
static bool s_lastTypeState
@ HIERARCHY_OBJECT
Definition: CVTypes.h:103
@ POINT_CLOUD
Definition: CVTypes.h:104