Skip to content

Commit

Permalink
Merge pull request #85 from bacetiner/master
Browse files Browse the repository at this point in the history
An attempt at fixing text overflow issue with SC_ComboBoxes in BRAILS-Buildings on MacOS
  • Loading branch information
fmckenna authored Mar 29, 2024
2 parents 9fd1374 + a5e6a92 commit c4a3ae3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions UIWidgets/BrailsInventoryGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,9 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "ModularPython.h"

#include <QLabel>
#include <QComboBox>
#include <QPushButton>
#include <QStandardPaths>
#include <QGroupBox>
#include <QGridLayout>
#include <QComboBox>
#include <QSettings>

#include <SC_DoubleLineEdit.h>
#include <SC_FileEdit.h>
Expand Down Expand Up @@ -235,15 +231,13 @@ BrailsInventoryGenerator::BrailsInventoryGenerator(VisualizationWidget* visWidge
QWidget* enabledAttributesWidget = new QWidget;
enabledAttributesWidgetLayout = new QGridLayout(enabledAttributesWidget);

QSettings settings("SimCenter", "BRAILS-Buildings_Widget");
int counter = 0;
foreach(QString attr, attributes) {
int nrow = counter / 6;
int ncol = counter % 6;
++counter;

QCheckBox* checkbox = new QCheckBox(attr, enabledAttributesWidget);
settings.setValue(attr, checkbox->isChecked());
checkbox->setChecked(false);
enabledAttributesWidgetLayout->addWidget(checkbox, nrow, ncol);
}
Expand All @@ -262,14 +256,16 @@ BrailsInventoryGenerator::BrailsInventoryGenerator(VisualizationWidget* visWidge
int numRow = 0;
QStringList unitList; unitList << "m" << "ft";
units = new SC_ComboBox("units", unitList);
units->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mainLayout->addWidget(new QLabel("Output units"), numRow, 0);
mainLayout->addWidget(units, numRow, 1);

// Define the combo box that prompts for query area definition:
numRow++;
QStringList locationList; locationList << "Bounding box" << "Region name";
location = new SC_ComboBox("location", locationList);
mainLayout->addWidget(new QLabel("Query area definition"), numRow, 0);
location->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mainLayout->addWidget(new QLabel("Query area definition"), numRow, 0);
mainLayout->addWidget(location, numRow, 1);

// Connect the query area definition combo box to the stacked widget for location input:
Expand All @@ -283,6 +279,7 @@ BrailsInventoryGenerator::BrailsInventoryGenerator(VisualizationWidget* visWidge
numRow++;
QStringList footprintSources; footprintSources << "Microsoft Global Building Footprints" << "OpenStreetMap" << "FEMA USA Structures" << "User-defined";
footprintSource = new SC_ComboBox("footprint", footprintSources);
footprintSource->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mainLayout->addWidget(new QLabel("Footprint source"), numRow, 0);
mainLayout->addWidget(footprintSource, numRow, 1);

Expand All @@ -298,6 +295,7 @@ BrailsInventoryGenerator::BrailsInventoryGenerator(VisualizationWidget* visWidge
numRow++;
QStringList baselineInventories; baselineInventories << "None" << "National Structure Inventory" << "User-defined";
baselineInvSelection = new SC_ComboBox("baseline", baselineInventories);
baselineInvSelection->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mainLayout->addWidget(new QLabel("Baseline inventory selection"), numRow, 0);
mainLayout->addWidget(baselineInvSelection, numRow, 1);
connect(RawNSIInventoryButton, &QPushButton::clicked, this, [this]() {getBaselineInv("raw"); });
Expand All @@ -313,6 +311,7 @@ BrailsInventoryGenerator::BrailsInventoryGenerator(VisualizationWidget* visWidge
numRow++;
QStringList requestedAttributes; requestedAttributes << "All" << "HAZUS seismic attributes" << "Select from enabled attributes";
attributeSelection = new SC_ComboBox("attributes", requestedAttributes);
attributeSelection->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mainLayout->addWidget(new QLabel("Requested attributes"), numRow, 0);
mainLayout->addWidget(attributeSelection, numRow, 1);

Expand All @@ -339,6 +338,7 @@ BrailsInventoryGenerator::BrailsInventoryGenerator(VisualizationWidget* visWidge
numRow++;
QStringList imputationAlgos; imputationAlgos << "None";
imputationAlgoCombo = new SC_ComboBox("imputation", imputationAlgos);
imputationAlgoCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mainLayout->addWidget(new QLabel("Imputation algorithm"), numRow, 0);
mainLayout->addWidget(imputationAlgoCombo, numRow, 1, 1, 3);

Expand Down Expand Up @@ -387,11 +387,11 @@ BrailsInventoryGenerator::getBRAILSAttributes(void) {
std::time(&now);
std::tm ptm;

#ifdef _WIN32
localtime_s(&ptm, &now);
#else
localtime_r(&now, &ptm);
#endif
#ifdef _WIN32
localtime_s(&ptm, &now);
#else
localtime_r(&now, &ptm);
#endif

std::string datestr = std::to_string(ptm.tm_year + 1900) + "-" + std::to_string(ptm.tm_mon + 1) + "-" + std::to_string(ptm.tm_mday);
QString date = QString::fromStdString(datestr);
Expand Down

0 comments on commit c4a3ae3

Please sign in to comment.