Commit 1923b0ac authored by Stan Hammon's avatar Stan Hammon Committed by Kitware Robot
Browse files

Merge topic 'qt-object-naming'

22803475

 Added names to qt UI objects to allow for more repeatable automatic testing

Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: buildbot's avatarbuildbot <buildbot@kitware.com>
Merge-request: !2708
parents 87ff0d8b 22803475
Added names to qt UI objects to allow for more repeatable automatic testing
---------------------------------------------------------------------------
Automated tests were not giving repeatable results due to unpredicatble Qt
implicit naming of UI widgets. To avoid this, all UI widgets were manually
assigned names using QObject::setObjectName()
Developer changes
~~~~~~~~~~~~~~~~~~
It would be good to use QObject::setObjectName() for any new Items to
avoid breaking this new "fully named" status.
User-facing changes
~~~~~~~~~~~~~~~~~~~
N/A
......@@ -100,15 +100,19 @@ qtDateTimeItem::qtDateTimeItem(const qtAttributeItemInfo& info)
if (def->useTimeZone())
{
this->Internals->TimeZoneDialog = new QDialog;
this->Internals->TimeZoneDialog->setObjectName("TimeZoneDialog");
this->Internals->TimeZoneDialog->setSizeGripEnabled(true);
QVBoxLayout* dialogLayout = new QVBoxLayout();
dialogLayout->setObjectName("dialogLayout");
this->Internals->TimeZoneWidget = new qtTimeZoneSelectWidget;
this->Internals->TimeZoneWidget->setObjectName("TimeZoneWidget");
dialogLayout->addWidget(this->Internals->TimeZoneWidget);
QDialogButtonBox* buttonBox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal,
this->Internals->TimeZoneDialog);
buttonBox->setObjectName("buttonBox");
this->Internals->TimeZoneDialogAcceptButton = buttonBox->button(QDialogButtonBox::Ok);
this->Internals->TimeZoneDialogAcceptButton->setEnabled(false);
......@@ -186,9 +190,11 @@ QWidget* qtDateTimeItem::createDateTimeWidget(int elementIdx)
}
QFrame* frame = new QFrame(m_itemInfo.parentWidget());
frame->setObjectName(QString("frame%1").arg(elementIdx));
//frame->setStyleSheet("QFrame { background-color: yellow; }");
QDateTimeEdit* dtEdit = new QDateTimeEdit(qdatetime, frame);
dtEdit->setObjectName(QString("dtEdit%1").arg(elementIdx));
this->Internals->ElementIndexMap.insert(dtEdit, elementIdx);
dtEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
std::string format = def->displayFormat();
......@@ -205,17 +211,20 @@ QWidget* qtDateTimeItem::createDateTimeWidget(int elementIdx)
frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QHBoxLayout* layout = new QHBoxLayout(frame);
layout->setObjectName(QString("layout%1").arg(elementIdx));
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(dtEdit);
if (def->useTimeZone())
{
this->Internals->TimeZoneButton = new QToolButton(frame);
this->Internals->TimeZoneButton->setObjectName(QString("TimeZoneButton%1").arg(elementIdx));
this->Internals->TimeZoneButton->setSizePolicy(
QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
this->Internals->TimeZoneButton->setText(timeZoneText);
this->Internals->TimeZoneButton->setPopupMode(QToolButton::MenuButtonPopup);
this->Internals->TimeZoneMenu = new QMenu(this->Internals->TimeZoneButton);
this->Internals->TimeZoneMenu->setObjectName(QString("TimeZoneMenu%1").arg(elementIdx));
this->Internals->TimeZoneMenu->addAction("Unset TimeZone", this, SLOT(onTimeZoneUnset()));
this->Internals->TimeZoneMenu->addAction("UTC", this, SLOT(onTimeZoneUTC()));
this->Internals->TimeZoneMenu->addAction("Select Region...", this, SLOT(onTimeZoneRegion()));
......@@ -392,6 +401,7 @@ void qtDateTimeItem::updateUI()
m_widget->setEnabled(false);
}
this->Internals->EntryLayout = new QGridLayout(m_widget);
this->Internals->EntryLayout->setObjectName("EntryLayout");
this->Internals->EntryLayout->setMargin(0);
this->Internals->EntryLayout->setSpacing(0);
this->Internals->EntryLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -399,6 +409,7 @@ void qtDateTimeItem::updateUI()
QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QHBoxLayout* labelLayout = new QHBoxLayout();
labelLayout->setObjectName("labelLayout");
labelLayout->setMargin(0);
labelLayout->setSpacing(0);
labelLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -406,6 +417,7 @@ void qtDateTimeItem::updateUI()
if (dataObj->isOptional())
{
QCheckBox* optionalCheck = new QCheckBox(m_itemInfo.parentWidget());
optionalCheck->setObjectName("optionalCheck");
optionalCheck->setChecked(dataObj->localEnabledState());
optionalCheck->setText(" ");
optionalCheck->setSizePolicy(sizeFixedPolicy);
......@@ -425,6 +437,7 @@ void qtDateTimeItem::updateUI()
labelText = dataObj->name().c_str();
}
QLabel* label = new QLabel(labelText, m_widget);
label->setObjectName("label");
label->setSizePolicy(sizeFixedPolicy);
if (iview)
{
......@@ -455,6 +468,7 @@ void qtDateTimeItem::updateUI()
// we need this layout so that for items with conditionan children,
// the label will line up at Top-left against the chilren's widgets.
// QVBoxLayout* vTLlayout = new QVBoxLayout;
// vTLlayout->setObjectName("vTLlayout");
// vTLlayout->setMargin(0);
// vTLlayout->setSpacing(0);
// vTLlayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -487,6 +501,7 @@ void qtDateTimeItem::addInputEditor(int i)
QBoxLayout* childLayout = nullptr;
childLayout = new QVBoxLayout;
childLayout->setObjectName(QString("childLayout%1").arg(i));
childLayout->setContentsMargins(12, 3, 3, 0);
childLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -497,6 +512,7 @@ void qtDateTimeItem::addInputEditor(int i)
}
QBoxLayout* editorLayout = new QHBoxLayout;
editorLayout->setObjectName(QString("editorLayout%1").arg(i));
editorLayout->setMargin(0);
editorLayout->setSpacing(3);
editorLayout->addWidget(editBox);
......
......@@ -235,7 +235,7 @@ QWidget* qtFileItem::createFileBrowseWidget(
QLineEdit* lineEdit = nullptr;
QComboBox* fileExtCombo = nullptr;
QFrame* frame = new QFrame(m_internals->Contents);
frame->setObjectName("fileBrowserContents");
frame->setObjectName(QString("frame%1").arg(elementIdx));
//frame->setStyleSheet("QFrame { background-color: yellow; }");
QString defaultText;
if (item.type() == smtk::attribute::Item::FileType)
......@@ -248,6 +248,7 @@ QWidget* qtFileItem::createFileBrowseWidget(
if (this->showRecentFiles() && fDef.shouldExist() && !item.isExtensible())
{
fileCombo = new QComboBox(frame);
fileCombo->setObjectName(QString("fileCombo%1").arg(elementIdx));
fileCombo->setEditable(true);
fileTextWidget = fileCombo;
lineEdit = fileCombo->lineEdit();
......@@ -270,6 +271,7 @@ QWidget* qtFileItem::createFileBrowseWidget(
if (it != last && std::next(it) != last)
{
fileExtCombo = new QComboBox(frame);
fileExtCombo->setObjectName(QString("fileExtCombo%1").arg(elementIdx));
fileExtCombo->setEditable(false);
for (; it != last; ++it)
{
......@@ -289,6 +291,7 @@ QWidget* qtFileItem::createFileBrowseWidget(
if (fileCombo == nullptr)
{
lineEdit = new QLineEdit(frame);
lineEdit->setObjectName(QString("lineEdit%1").arg(elementIdx));
fileTextWidget = lineEdit;
// We need to be able to get the file ext combo from the line edit widget
// and vice versa
......@@ -326,6 +329,7 @@ QWidget* qtFileItem::createFileBrowseWidget(
frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
fileTextWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QPushButton* fileBrowserButton = new QPushButton("Browse", frame);
fileBrowserButton->setObjectName(QString("fileBrowserButton%1").arg(elementIdx));
fileBrowserButton->setMinimumHeight(fileTextWidget->height());
fileBrowserButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QVariant vdata;
......@@ -333,6 +337,7 @@ QWidget* qtFileItem::createFileBrowseWidget(
fileBrowserButton->setProperty("EditWidget", vdata);
QHBoxLayout* layout = new QHBoxLayout(frame);
layout->setObjectName(QString("layout%1").arg(elementIdx));
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(fileTextWidget);
......@@ -783,12 +788,15 @@ void qtFileItem::addInputEditor(
QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QFrame* editFrame = new QFrame(m_internals->Contents);
editFrame->setObjectName(QString("editFrame%1").arg(i));
QBoxLayout* editorLayout = new QHBoxLayout(editFrame);
editorLayout->setObjectName(QString("editorLayout%1").arg(i));
editorLayout->setMargin(0);
editorLayout->setSpacing(3);
if (item.isExtensible() && (i >= static_cast<int>(itemDef.numberOfRequiredValues())))
{
QToolButton* minusButton = new QToolButton(m_internals->Contents);
minusButton->setObjectName(QString("minusButton%1").arg(i));
QString iconName(":/icons/attribute/minus.png");
minusButton->setFixedSize(QSize(12, 12));
minusButton->setIcon(QIcon(iconName));
......@@ -810,6 +818,7 @@ void qtFileItem::addInputEditor(
{
QString labelText = componentLabel.c_str();
QLabel* label = new QLabel(labelText, editBox);
label->setObjectName(QString("label%1").arg(i));
label->setSizePolicy(sizeFixedPolicy);
editorLayout->addWidget(label);
}
......@@ -849,6 +858,7 @@ void qtFileItem::loadInputValues(
{
QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_internals->AddItemButton = new QToolButton(m_widget);
m_internals->AddItemButton->setObjectName("AddItemButton");
QString iconName(":/icons/attribute/plus.png");
m_internals->AddItemButton->setText("Add New Value");
m_internals->AddItemButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
......@@ -883,6 +893,7 @@ void qtFileItem::updateUI()
}
m_widget = new QFrame(m_itemInfo.parentWidget());
m_widget->setObjectName(item->name().c_str());
if (this->isReadOnly())
{
m_widget->setEnabled(false);
......@@ -896,12 +907,14 @@ void qtFileItem::updateUI()
{
top = new QVBoxLayout(m_widget);
}
top->setObjectName("top");
top->setMargin(0);
top->setSpacing(0);
QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QHBoxLayout* labelLayout = new QHBoxLayout();
labelLayout->setObjectName("labelLayout");
labelLayout->setMargin(0);
labelLayout->setSpacing(0);
labelLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -912,6 +925,7 @@ void qtFileItem::updateUI()
if (itemDef->isOptional())
{
m_internals->OptionalCheck = new QCheckBox(m_itemInfo.parentWidget());
m_internals->OptionalCheck->setObjectName("OptionalCheck");
m_internals->OptionalCheck->setChecked(item->localEnabledState());
m_internals->OptionalCheck->setText(" ");
m_internals->OptionalCheck->setSizePolicy(sizeFixedPolicy);
......@@ -936,6 +950,7 @@ void qtFileItem::updateUI()
labelText = item->name().c_str();
}
QLabel* label = new QLabel(labelText, m_widget);
label->setObjectName("label");
label->setSizePolicy(sizeFixedPolicy);
if (iview)
{
......@@ -961,7 +976,9 @@ void qtFileItem::updateUI()
// Create a frame to hold the item's contents
m_internals->Contents = new QFrame(m_widget);
m_internals->Contents->setObjectName("Contents");
m_internals->EntryLayout = new QVBoxLayout(m_internals->Contents);
m_internals->EntryLayout->setObjectName("EntryLayout");
m_internals->EntryLayout->setMargin(0);
m_internals->EntryLayout->setSpacing(0);
m_internals->EntryLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......
......@@ -126,15 +126,17 @@ void qtGroupItem::createWidget()
m_internals->m_mainFrame = new QFrame(m_itemInfo.parentWidget());
m_internals->m_mainFrame->setObjectName("qtGroupItem");
m_widget = m_internals->m_mainFrame;
m_widget->setObjectName(item->name().c_str());
auto* mainLayout = new QVBoxLayout(m_widget);
mainLayout->setObjectName("mainLayout");
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
m_internals->m_mainFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_internals->m_titleFrame = new QFrame(m_internals->m_mainFrame);
mainLayout->addWidget(m_internals->m_titleFrame);
m_internals->m_mainFrame->setObjectName("TitleFrame");
mainLayout->addWidget(m_internals->m_titleFrame);
auto* titleLayout = new QHBoxLayout(m_internals->m_titleFrame);
titleLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
titleLayout->setMargin(0);
......@@ -166,6 +168,7 @@ void qtGroupItem::createWidget()
m_internals->m_contentsFrame->setObjectName("Contents");
mainLayout->addWidget(m_internals->m_contentsFrame);
auto* contentsLayout = new QVBoxLayout(m_internals->m_contentsFrame);
contentsLayout->setObjectName("contentsLayout");
contentsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
// Lets indent the contents a bit to the right.
contentsLayout->setContentsMargins(10, 0, 0, 0);
......@@ -174,15 +177,17 @@ void qtGroupItem::createWidget()
m_internals->ButtonsFrame = new QFrame(m_internals->m_contentsFrame);
m_internals->ButtonsFrame->setObjectName("ButtonFrame");
new QHBoxLayout(m_internals->ButtonsFrame);
auto* hLayout = new QHBoxLayout(m_internals->ButtonsFrame);
hLayout->setObjectName("hLayout");
contentsLayout->addWidget(m_internals->ButtonsFrame);
m_internals->ButtonsFrame->layout()->setMargin(0);
hLayout->setMargin(0);
m_internals->ChildrensFrame = new QFrame(m_internals->m_contentsFrame);
m_internals->ChildrensFrame->setObjectName("ChildrensFrame");
new QVBoxLayout(m_internals->ChildrensFrame);
auto* vLayout = new QVBoxLayout(m_internals->ChildrensFrame);
vLayout->setObjectName("vLayout");
contentsLayout->addWidget(m_internals->ChildrensFrame);
m_internals->ChildrensFrame->layout()->setMargin(0);
vLayout->setMargin(0);
if (this->isReadOnly())
{
......@@ -286,6 +291,7 @@ void qtGroupItem::updateItemData()
if (!m_internals->AddItemButton)
{
m_internals->AddItemButton = new QToolButton(m_internals->ButtonsFrame);
m_internals->AddItemButton->setObjectName("AddItemButton");
m_internals->AddItemButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QString iconName(":/icons/attribute/plus.png");
std::string extensibleLabel = "Add Row";
......@@ -379,7 +385,7 @@ void qtGroupItem::addSubGroup(int i)
const std::size_t numItems = item->numberOfItemsPerGroup();
QBoxLayout* frameLayout = qobject_cast<QBoxLayout*>(m_internals->ChildrensFrame->layout());
QFrame* subGroupFrame = new QFrame(m_internals->ChildrensFrame);
subGroupFrame->setObjectName("groupitemFrame");
subGroupFrame->setObjectName(QString("groupitemFrame%1").arg(i));
QBoxLayout* subGroupLayout = new QVBoxLayout(subGroupFrame);
if (item->numberOfGroups() == 1)
{
......@@ -400,6 +406,7 @@ void qtGroupItem::addSubGroup(int i)
{
subGroupString = QString::fromStdString(groupDef->subGroupLabel(i));
QLabel* subGroupLabel = new QLabel(subGroupString, subGroupFrame);
subGroupLabel->setObjectName(QString("subGroupLabel%1").arg(i));
subGroupLayout->addWidget(subGroupLabel);
}
......@@ -527,6 +534,7 @@ void qtGroupItem::addItemsToTable(int index)
if (!m_internals->ItemsTable)
{
m_internals->ItemsTable = new qtTableWidget(m_internals->ChildrensFrame);
m_internals->ItemsTable->setObjectName(QString("ItemsTable%1").arg(index));
m_internals->ItemsTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_internals->ItemsTable->setColumnCount(1); // for minus button
......@@ -618,6 +626,7 @@ void qtGroupItem::addItemsToTable(int index)
if (added > 0)
{
minusButton = new QToolButton(m_internals->ChildrensFrame);
minusButton->setObjectName(QString("minusButton%1").arg(index));
QString iconName(":/icons/attribute/minus.png");
minusButton->setFixedSize(QSize(16, 16));
minusButton->setIcon(QIcon(iconName));
......
......@@ -676,6 +676,7 @@ void qtInputsItem::addInputEditor(int i)
if (item->isDiscrete())
{
childLayout = new QVBoxLayout;
childLayout->setObjectName(QString("childLayout%1").arg(i));
childLayout->setContentsMargins(12, 3, 3, 0);
childLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
}
......@@ -688,11 +689,13 @@ void qtInputsItem::addInputEditor(int i)
auto itemDef = item->definitionAs<ValueItemDefinition>();
QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QBoxLayout* editorLayout = new QHBoxLayout;
editorLayout->setObjectName(QString("editorLayout%1").arg(i));
editorLayout->setMargin(0);
editorLayout->setSpacing(3);
if (item->isExtensible())
{
QToolButton* minusButton = new QToolButton(m_widget);
minusButton->setObjectName(QString("minusButton%1").arg(i));
QString iconName(":/icons/attribute/minus.png");
minusButton->setFixedSize(QSize(12, 12));
minusButton->setIcon(QIcon(iconName));
......@@ -765,6 +768,7 @@ void qtInputsItem::loadInputValues()
{
QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_internals->AddItemButton = new QToolButton(m_widget);
m_internals->AddItemButton->setObjectName(QString("AddItemButton"));
QString iconName(":/icons/attribute/plus.png");
m_internals->AddItemButton->setText("Add New Value");
m_internals->AddItemButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
......@@ -795,7 +799,7 @@ QFrame* qtInputsItem::createLabelFrame(
auto* labelFrame = new QFrame();
labelFrame->setObjectName("labelFrame");
QHBoxLayout* labelLayout = new QHBoxLayout(labelFrame);
labelLayout->setObjectName("labelFrame");
labelLayout->setObjectName("labelLayout");
labelLayout->setMargin(0);
labelLayout->setSpacing(0);
labelLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -807,7 +811,7 @@ QFrame* qtInputsItem::createLabelFrame(
if (vitemDef->isOptional() && (m_internals->OptionalCheck == nullptr))
{
m_internals->OptionalCheck = new QCheckBox(m_itemInfo.parentWidget());
m_internals->OptionalCheck->setObjectName("optionBox");
m_internals->OptionalCheck->setObjectName("OptionalCheck");
m_internals->OptionalCheck->setChecked(vitem->localEnabledState());
m_internals->OptionalCheck->setText(" ");
m_internals->OptionalCheck->setSizePolicy(sizeFixedPolicy);
......@@ -832,7 +836,7 @@ QFrame* qtInputsItem::createLabelFrame(
labelText = vitem->name().c_str();
}
QLabel* label = new QLabel(labelText, m_widget);
label->setObjectName("labelText");
label->setObjectName("label");
label->setSizePolicy(sizeFixedPolicy);
if (iview)
{
......@@ -937,10 +941,10 @@ void qtInputsItem::updateUI()
m_internals->m_valuesFrame->setObjectName("valuesFrame");
m_internals->EntryLayout = new QGridLayout(m_internals->m_valuesFrame);
m_internals->EntryLayout->setObjectName("EntryLayout");
m_internals->EntryLayout->setMargin(0);
m_internals->EntryLayout->setSpacing(0);
m_internals->EntryLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
m_internals->EntryLayout->setObjectName("valuesLayout");
this->loadInputValues();
dataLayout->addWidget(m_internals->m_valuesFrame);
......@@ -1137,6 +1141,7 @@ QWidget* qtInputsItem::createInputWidget(int elementIdx, QLayout* childLayout)
if (item->isDiscrete())
{
auto* editor = new qtDiscreteValueEditor(this, elementIdx, childLayout);
editor->setObjectName(QString("editor%1").arg(elementIdx));
QObject::connect(editor, SIGNAL(widgetSizeChanged()), this, SIGNAL(widgetSizeChanged()));
// editor->setUseSelectionManager(m_useSelectionManager);
m_internals->DiscreteEditors.append(editor);
......@@ -1147,9 +1152,8 @@ QWidget* qtInputsItem::createInputWidget(int elementIdx, QLayout* childLayout)
QFrame* qtInputsItem::createExpressionRefFrame()
{
auto* frame = new QFrame();
frame->setObjectName("expressionFrame");
frame->setObjectName("frame");
QHBoxLayout* expressionLayout = new QHBoxLayout(frame);
expressionLayout->setObjectName("expressionLayout");
expressionLayout->setMargin(0);
......@@ -1168,9 +1172,11 @@ QFrame* qtInputsItem::createExpressionRefFrame()
m_internals->m_expressionCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
m_internals->m_expressionEqualsLabel = new QLabel("=", frame);
m_internals->m_expressionEqualsLabel->setObjectName("expressionEqualsLabel");
m_internals->m_expressionEqualsLabel->setVisible(false);
m_internals->m_expressionResultLineEdit = new QLineEdit(frame);
m_internals->m_expressionResultLineEdit->setObjectName("expressionResultLineEdit");
m_internals->m_expressionResultLineEdit->setVisible(false);
m_internals->m_expressionResultLineEdit->setReadOnly(true);
......@@ -1497,6 +1503,7 @@ QWidget* qtInputsItem::createDoubleWidget(
if (option == "LineEdit")
{
auto* editBox = new qtDoubleLineEdit(pWidget);
editBox->setObjectName(QString("editBox%1").arg(elementIdx));
editBox->setUseGlobalPrecisionAndNotation(false);
std::string notation("Mixed");
m_itemInfo.component().attribute("Notation", notation);
......@@ -1510,6 +1517,7 @@ QWidget* qtInputsItem::createDoubleWidget(
}
qtDoubleValidator* validator = new qtDoubleValidator(this, elementIdx, editBox, pWidget);
validator->setObjectName(QString("validator%1").arg(elementIdx));
editBox->setValidator(validator);
int widthValue = 100; // Default fixed width
......@@ -1544,6 +1552,7 @@ QWidget* qtInputsItem::createDoubleWidget(
if (option == "SpinBox")
{
QDoubleSpinBox* spinbox = new QDoubleSpinBox(pWidget);
spinbox->setObjectName(QString("spinbox%1").arg(elementIdx));
spinbox->setMaximum(maxVal);
spinbox->setMinimum(minVal);
double step;
......@@ -1625,7 +1634,9 @@ QWidget* qtInputsItem::createIntWidget(
if (option == "LineEdit")
{
QLineEdit* editBox = new QLineEdit(pWidget);
editBox->setObjectName(QString("editBox%1").arg(elementIdx));
qtIntValidator* validator = new qtIntValidator(this, elementIdx, editBox, pWidget);
validator->setObjectName(QString("validator%1").arg(elementIdx));
editBox->setValidator(validator);
int widthValue = 100; // Default fixed width
......@@ -1646,6 +1657,7 @@ QWidget* qtInputsItem::createIntWidget(
if (option == "SpinBox")
{
QSpinBox* spinbox = new QSpinBox(pWidget);
spinbox->setObjectName(QString("spinbox%1").arg(elementIdx));
auto iitem = dynamic_pointer_cast<IntItem>(vitem);
spinbox->setMaximum(maxVal);
spinbox->setMinimum(minVal);
......@@ -1715,6 +1727,7 @@ QWidget* qtInputsItem::createEditBox(int elementIdx, QWidget* pWidget)
if (sDef->isMultiline())
{
qtTextEdit* textEdit = new qtTextEdit(pWidget);
textEdit->setObjectName(QString("textEdit%1").arg(elementIdx));
textEdit->setPlainText(valText);
QObject::connect(textEdit, SIGNAL(textChanged()), this, SLOT(onTextEditChanged()));
inputWidget = textEdit;
......@@ -1722,6 +1735,7 @@ QWidget* qtInputsItem::createEditBox(int elementIdx, QWidget* pWidget)
else
{
QLineEdit* lineEdit = new QLineEdit(pWidget);
lineEdit->setObjectName(QString("lineEdit%1").arg(elementIdx));
int widthValue = 0; // Default no fixed width
m_itemInfo.component().attributeAsInt("FixedWidth", widthValue);
if (widthValue > 0)
......
......@@ -485,6 +485,7 @@ void qtReferenceItem::updateUI()
}
m_widget->installEventFilter(this);
m_p->m_grid = new QGridLayout(m_widget);
m_p->m_grid->setObjectName("grid");
m_p->m_grid->setMargin(0);
m_p->m_grid->setSpacing(0);
m_p->m_grid->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -494,6 +495,7 @@ void qtReferenceItem::updateUI()
// Create a layout for the item's checkbox (if it is optional) and its label.
QHBoxLayout* labelLayout = new QHBoxLayout();
labelLayout->setObjectName("labelLayout");
labelLayout->setMargin(0);
labelLayout->setSpacing(0);
labelLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -503,6 +505,7 @@ void qtReferenceItem::updateUI()
if (itm->isOptional())
{
m_p->m_optional = new QCheckBox(m_itemInfo.parentWidget());
m_p->m_optional->setObjectName("optionalCheckbox");
m_p->m_optional->setChecked(itm->localEnabledState());
m_p->m_optional->setText(" ");
m_p->m_optional->setSizePolicy(sizeFixedPolicy);
......@@ -520,6 +523,7 @@ void qtReferenceItem::updateUI()
// Add a label for the item.
QString labelText = !itm->label().empty() ? itm->label().c_str() : itm->name().c_str();
m_p->m_label = new QLabel(labelText, m_widget);
m_p->m_label->setObjectName("label");
m_p->m_label->setSizePolicy(sizeFixedPolicy);
if (iview)
{
......@@ -544,6 +548,7 @@ void qtReferenceItem::updateUI()
// Now add widgetry for the "entry"
// Create a layout for the item's entry editor.
QHBoxLayout* entryLayout = new QHBoxLayout();
entryLayout->setObjectName("ReferenceItemLayout");
entryLayout->setMargin(0);
entryLayout->setSpacing(6);
entryLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
......@@ -552,27 +557,27 @@ void qtReferenceItem::updateUI()
// ... a button to grab the selection
QIcon copyFromSelection(":/icons/reference-item/copy-from-selection.png");
m_p->m_copyFromSelection = new QPushButton(copyFromSelection, "");
m_p->m_copyFromSelection->setObjectName("CopyFromSelection");
m_p->m_copyFromSelection->setSizePolicy(sizeFixedPolicy);
m_p->m_copyFromSelection->setToolTip("Replace this item's members with the selection.");
m_p->m_copyFromSelection->setObjectName("CopyFromSelection");
entryLayout->addWidget(m_p->m_copyFromSelection);
QObject::connect(m_p->m_copyFromSelection, SIGNAL(clicked()), this, SLOT(copyFromSelection()));
// ... a button to empty the item's members
QIcon clearItem(":/icons/reference-item/clear.png");
m_p->m_clear = new QPushButton(clearItem, "");
m_p->m_clear->setObjectName("ClearMembership");
m_p->m_clear->setSizePolicy(sizeFixedPolicy);
m_p->m_clear->setToolTip("Clear this item's members.");
m_p->m_clear->setObjectName("ClearMembership");
entryLayout->addWidget(m_p->m_clear);
QObject::connect(m_p->m_clear, SIGNAL(clicked()), this, SLOT(clearItem()));
// ... a button to populate the selection with the item's members
QIcon copyToSelection(":/icons/reference-item/copy-to-selection.png");
m_p->m_copyToSelection = new QPushButton(copyToSelection, "");
m_p->m_copyToSelection->setObjectName("CopyToSelection");
m_p->m_copyToSelection->setSizePolicy(sizeFixedPolicy);
m_p->m_copyToSelection->setToolTip("Replace the selection with this item's members.");
m_p->m_copyToSelection->setObjectName("CopyToSelection");
entryLayout->addWidget(m_p->m_copyToSelection);
QObject::connect(m_p->m_copyToSelection, SIGNAL(clicked()), this, SLOT(copyToSelection()));
......@@ -580,16 +585,16 @@ void qtReferenceItem::updateUI()
bool ok;
QString synText = QString::fromStdString(this->synopsis(ok));
m_p->m_synopsis = new QLabel(synText, m_widget);
m_p->m_synopsis->setObjectName("synopsis");
m_p->m_synopsis->setSizePolicy(sizeStretchyXPolicy);
m_p->m_synopsis->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
entryLayout->addWidget(m_p->m_synopsis);
entryLayout->setObjectName("ReferenceItemLayout");
// ... a button to pop up an editor for the item contents.
m_p->m_editBtn = new QToolButton(m_widget);
m_p->m_editBtn->setObjectName("EditReferenceItemMembers");
m_p->m_editBtn->setPopupMode(QToolButton::InstantPopup);
m_p->m_editBtn->setMenu(new QMenu(m_p->m_editBtn));
m_p->m_editBtn->setObjectName("EditReferenceItemMembers");
m_p->m_editBtn->menu()->setObjectName("Candidates");
entryLayout->addWidget(m_p->m_editBtn);
......@@ -599,8 +604,11 @@ void qtReferenceItem::updateUI()
(refItem->numberOfRequiredValues() > 1 ||
(refItem->isExtensible() && refItem->maxNumberOfValues() != 1));
m_p->m_popup = new QDialog(m_p->m_editBtn);
m_p->m_popup->setObjectName("popup");
m_p->m_popupLayout = new QVBoxLayout(m_p->m_popup);
m_p->m_popupLayout->setObjectName("popupLayout");
m_p->m_popupList = new QListView(m_p->m_popup);
m_p->m_popupList->setObjectName("popupList");
m_p->m_popupList->setItemDelegate(m_p->m_qtDelegate);
m_p->m_popupLayout->addWidget(m_p->m_popupList);
m_p->m_popup->installEventFilter(this);
......@@ -609,6 +617,7 @@ void qtReferenceItem::updateUI()
multiselect ? QAbstractItemView::ExtendedSelection : QAbstractItemView::SingleSelection);
m_p->m_popupList->setSelectionBehavior(QAbstractItemView::SelectRows);
auto* action = new QWidgetAction(m_p->m_editBtn);
action->setObjectName("action");
action->setDefaultWidget(m_p->m_popup);
m_p->m_editBtn->menu()->addAction(action);
m_p->m_editBtn->setMaximumSize(QSize(16, 20));
......
......@@ -77,9 +77,10 @@ void qtVoidItem::createWidget()
{
m_widget->setEnabled(false);
}
new QVBoxLayout(m_widget);
m_widget->layout()->setMargin(0);