Commit 09160f9c authored by Huff, Israel's avatar Huff, Israel
Browse files

aptens line edit fields now select all when they get focus

parent af1f38c0
Pipeline #97631 failed with stages
in 37 seconds
......@@ -9,11 +9,11 @@
#include <QApplication>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QInputDialog>
#include <QLabel>
#include <QMessageBox>
#include <QTabWidget>
#include <QTimer>
#include "radixbug/bug.hh"
using namespace rsm;
......@@ -460,6 +460,25 @@ QGroupBox::title {
)foo");
}
// ----------------------------------------------------------------------------
LineEditFocusSelectAll::LineEditFocusSelectAll(QWidget *parent)
: QLineEdit(parent)
{
}
LineEditFocusSelectAll::LineEditFocusSelectAll(const QString &text,
QWidget *parent)
: QLineEdit(text, parent)
{
}
void LineEditFocusSelectAll::focusInEvent(QFocusEvent *event)
{
QLineEdit::focusInEvent(event);
QTimer::singleShot(0, this, &QLineEdit::selectAll);
}
// ----------------------------------------------------------------------------
APTEnsWidget::APTEnsWidget(QWidget *parent)
: QWidget(parent)
......@@ -491,9 +510,9 @@ APTEnsWidget::APTEnsWidget(QWidget *parent)
mAltLabel = new StyledLabel("Altitude", mEventDefBox);
mSoilTypeLabel = new StyledLabel("Soil Type", mEventDefBox);
mFissionIDLabel = new StyledLabel("Fission ID", mEventDefBox);
mLatLineEdit = new QLineEdit(mEventDefBox);
mLonLineEdit = new QLineEdit(mEventDefBox);
mAltLineEdit = new QLineEdit(mEventDefBox);
mLatLineEdit = new LineEditFocusSelectAll(mEventDefBox);
mLonLineEdit = new LineEditFocusSelectAll(mEventDefBox);
mAltLineEdit = new LineEditFocusSelectAll(mEventDefBox);
mSoilTypeComboBox = new QComboBox(mEventDefBox);
mFissionIDComboBox = new QComboBox(mEventDefBox);
mSoilTypeComboBox->setEditable(true);
......@@ -523,14 +542,14 @@ APTEnsWidget::APTEnsWidget(QWidget *parent)
// build yield ensemble box
QGridLayout *yeLayout = new QGridLayout(mYieldEnsBox);
mTotalYieldLabel = new StyledLabel("Total Yield", mYieldEnsBox);
mTotalYieldLineEdit = new QLineEdit(mYieldEnsBox);
mTotalYieldLineEdit = new LineEditFocusSelectAll(mYieldEnsBox);
mYieldDefineEnsCheckBox = new QCheckBox("Define Ensemble", mYieldEnsBox);
mNumYieldsLabel = new StyledLabel("# of Yields", mYieldEnsBox);
mNumYieldsLineEdit = new QLineEdit(mYieldEnsBox);
mNumYieldsLineEdit = new LineEditFocusSelectAll(mYieldEnsBox);
mMinYieldLabel = new StyledLabel("Min Yield", mYieldEnsBox);
mMinYieldLineEdit = new QLineEdit(mYieldEnsBox);
mMinYieldLineEdit = new LineEditFocusSelectAll(mYieldEnsBox);
mMaxYieldLabel = new StyledLabel("Max Yield", mYieldEnsBox);
mMaxYieldLineEdit = new QLineEdit(mYieldEnsBox);
mMaxYieldLineEdit = new LineEditFocusSelectAll(mYieldEnsBox);
mYieldSamplingLabel = new StyledLabel("Sampling", mYieldEnsBox);
mYieldSamplingComboBox = new QComboBox(mYieldEnsBox);
mYieldSamplingComboBox->addItem("uniform");
......@@ -551,15 +570,15 @@ APTEnsWidget::APTEnsWidget(QWidget *parent)
// build height of burst ensemble box
QGridLayout *hobLayout = new QGridLayout(mHeightOfBurstEnsBox);
mHOBLabel = new StyledLabel("Height of Burst", mHeightOfBurstEnsBox);
mHOBLineEdit = new QLineEdit(mHeightOfBurstEnsBox);
mHOBLineEdit = new LineEditFocusSelectAll(mHeightOfBurstEnsBox);
mHOBDefineEnsCheckBox =
new QCheckBox("Define Ensemble", mHeightOfBurstEnsBox);
mNumHOBsLabel = new StyledLabel("# of HoB", mHeightOfBurstEnsBox);
mNumHOBsLineEdit = new QLineEdit(mHeightOfBurstEnsBox);
mNumHOBsLineEdit = new LineEditFocusSelectAll(mHeightOfBurstEnsBox);
mMinHOBLabel = new StyledLabel("Min HoB", mHeightOfBurstEnsBox);
mMinHOBLineEdit = new QLineEdit(mHeightOfBurstEnsBox);
mMinHOBLineEdit = new LineEditFocusSelectAll(mHeightOfBurstEnsBox);
mMaxHOBLabel = new StyledLabel("Max HoB", mHeightOfBurstEnsBox);
mMaxHOBLineEdit = new QLineEdit(mHeightOfBurstEnsBox);
mMaxHOBLineEdit = new LineEditFocusSelectAll(mHeightOfBurstEnsBox);
mHOBSamplingLabel = new StyledLabel("Sampling", mHeightOfBurstEnsBox);
mHOBSamplingComboBox = new QComboBox(mHeightOfBurstEnsBox);
mHOBSamplingComboBox->addItem("uniform");
......@@ -616,7 +635,7 @@ APTEnsWidget::APTEnsWidget(QWidget *parent)
// turbulence ensemble box
QGridLayout *teLayout = new QGridLayout(mTurbEnsBox);
mTurbEnsNumLabel = new StyledLabel("Number", mTurbEnsBox);
mTurbEnsNumLineEdit = new QLineEdit(mTurbEnsBox);
mTurbEnsNumLineEdit = new LineEditFocusSelectAll(mTurbEnsBox);
QWidget *teSpacer = new QWidget(mTurbEnsBox);
teSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
teLayout->addWidget(mTurbEnsNumLabel, 0, 0);
......@@ -626,7 +645,7 @@ APTEnsWidget::APTEnsWidget(QWidget *parent)
// meteorology ensemble box
QGridLayout *meLayout = new QGridLayout(mMetEnsBox);
mMetEnsNumLabel = new StyledLabel("Number", mMetEnsBox);
mMetEnsNumLineEdit = new QLineEdit(mMetEnsBox);
mMetEnsNumLineEdit = new LineEditFocusSelectAll(mMetEnsBox);
QWidget *meSpacer = new QWidget(mMetEnsBox);
meSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
meLayout->addWidget(mMetEnsNumLabel, 0, 0);
......@@ -687,7 +706,8 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow() {}
/******************************************************************************/
/******************************** MAIN PROGRAM ********************************/
/******************************** MAIN PROGRAM
* ********************************/
/******************************************************************************/
int main(int argc, char **argv)
......
#ifndef RSM_RSMWIDGETS_EXAMPLE_RSMPORTALEXAMPLE_HH_
#define RSM_RSMWIDGETS_EXAMPLE_RSMPORTALEXAMPLE_HH_
#include <QAbstractTableModel>
#include <QButtonGroup>
#include <QCheckBox>
#include <QComboBox>
......@@ -114,6 +113,16 @@ class LeftTitleGroupBox : public QGroupBox
LeftTitleGroupBox(const QString &title, QWidget *parent = Q_NULLPTR);
};
class LineEditFocusSelectAll : public QLineEdit
{
public:
LineEditFocusSelectAll(QWidget *parent = Q_NULLPTR);
LineEditFocusSelectAll(const QString &text, QWidget *parent = Q_NULLPTR);
protected:
void focusInEvent(QFocusEvent *event) override;
};
class APTEnsDataModel
{
private:
......@@ -221,35 +230,35 @@ class APTEnsWidget : public QWidget
StyledLabel *mAltLabel;
StyledLabel *mSoilTypeLabel;
StyledLabel *mFissionIDLabel;
QLineEdit *mLatLineEdit;
QLineEdit *mLonLineEdit;
QLineEdit *mAltLineEdit;
LineEditFocusSelectAll *mLatLineEdit;
LineEditFocusSelectAll *mLonLineEdit;
LineEditFocusSelectAll *mAltLineEdit;
QComboBox *mSoilTypeComboBox;
QComboBox *mFissionIDComboBox;
StyledLabel *mTotalYieldLabel;
QLineEdit *mTotalYieldLineEdit;
LineEditFocusSelectAll *mTotalYieldLineEdit;
// TODO: enable/disable all other controls in group box
QCheckBox *mYieldDefineEnsCheckBox;
StyledLabel *mNumYieldsLabel;
QLineEdit *mNumYieldsLineEdit;
LineEditFocusSelectAll *mNumYieldsLineEdit;
StyledLabel *mMinYieldLabel;
QLineEdit *mMinYieldLineEdit;
LineEditFocusSelectAll *mMinYieldLineEdit;
StyledLabel *mMaxYieldLabel;
QLineEdit *mMaxYieldLineEdit;
LineEditFocusSelectAll *mMaxYieldLineEdit;
StyledLabel *mYieldSamplingLabel;
QComboBox *mYieldSamplingComboBox;
StyledLabel *mHOBLabel;
QLineEdit *mHOBLineEdit;
LineEditFocusSelectAll *mHOBLineEdit;
// TODO: enable/disable all other controls in group box
QCheckBox *mHOBDefineEnsCheckBox;
StyledLabel *mNumHOBsLabel;
QLineEdit *mNumHOBsLineEdit;
LineEditFocusSelectAll *mNumHOBsLineEdit;
StyledLabel *mMinHOBLabel;
QLineEdit *mMinHOBLineEdit;
LineEditFocusSelectAll *mMinHOBLineEdit;
StyledLabel *mMaxHOBLabel;
QLineEdit *mMaxHOBLineEdit;
LineEditFocusSelectAll *mMaxHOBLineEdit;
StyledLabel *mHOBSamplingLabel;
QComboBox *mHOBSamplingComboBox;
......@@ -266,10 +275,10 @@ class APTEnsWidget : public QWidget
QPushButton *mSetupCfgsRemoveButton;
StyledLabel *mTurbEnsNumLabel;
QLineEdit *mTurbEnsNumLineEdit;
LineEditFocusSelectAll *mTurbEnsNumLineEdit;
StyledLabel *mMetEnsNumLabel;
QLineEdit *mMetEnsNumLineEdit;
LineEditFocusSelectAll *mMetEnsNumLineEdit;
void readInputsFromDM();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment