2024-02-08 Fred Gleason <fredg@paravelsystems.com>

* Added 'RDTimeEdit::Mode' enumeration.
	* Added 'RDTimeEdit::mode()', 'RDTimeEdit::setMode()',
	'RDTimeEdit::length()' and 'RDTimeEdit::setLength()' methods.
	* Fixed a regression in rdlibrary(1) that caused the 'Forced Length'
	control in the 'Edit Cart' dialog to be misformatted when the
	system was configured to use 12 hour time format.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2024-02-08 10:04:46 -05:00
parent ae5d20cbe9
commit 38ef094ba3
5 changed files with 95 additions and 49 deletions

View File

@@ -2,7 +2,7 @@
//
// A QTimeEdit with tenth-second precision.
//
// (C) Copyright 2003-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2003-2024 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -28,15 +28,20 @@ class RDTimeEdit : public QTimeEdit
{
Q_OBJECT
public:
enum Mode {TimeMode=0,LengthMode=1};
RDTimeEdit(QWidget *parent=0);
Mode mode() const;
void setMode(Mode mode);
bool showHours() const;
void setShowHours(bool state);
bool showTenths() const;
void setShowTenths(bool state);
bool isReadOnly() const;
int length() const;
public slots:
void setReadOnly(bool state);
void setLength(int msec);
void setReadOnly(bool state);
protected:
QValidator::State validate(QString &input,int &pos) const;
@@ -51,6 +56,7 @@ class RDTimeEdit : public QTimeEdit
int d_width_variance;
QAbstractSpinBox::StepEnabled d_step_enabled;
bool d_read_only;
Mode d_mode;
};