mirror of
https://github.com/leozide/leocad
synced 2024-11-17 07:47:55 +01:00
Sort part counts numerically.
This commit is contained in:
parent
9f5782294e
commit
0282a88c87
4 changed files with 30 additions and 32 deletions
|
@ -3,19 +3,10 @@
|
|||
#include "lc_math.h"
|
||||
#include "lc_array.h"
|
||||
#include "lc_application.h"
|
||||
#include "lc_model.h"
|
||||
#include "lc_category.h"
|
||||
#include "lc_shortcuts.h"
|
||||
#include "image.h"
|
||||
|
||||
struct lcPropertiesDialogOptions
|
||||
{
|
||||
lcModelProperties Properties;
|
||||
bool SetDefault;
|
||||
|
||||
lcPartsList PartsList;
|
||||
};
|
||||
|
||||
struct lcPreferencesDialogOptions
|
||||
{
|
||||
lcPreferences Preferences;
|
||||
|
|
|
@ -4264,7 +4264,6 @@ void lcModel::ShowPropertiesDialog()
|
|||
lcPropertiesDialogOptions Options;
|
||||
|
||||
Options.Properties = mProperties;
|
||||
Options.SetDefault = false;
|
||||
|
||||
GetPartsList(gDefaultColor, true, false, Options.PartsList);
|
||||
|
||||
|
@ -4272,9 +4271,6 @@ void lcModel::ShowPropertiesDialog()
|
|||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
if (Options.SetDefault)
|
||||
Options.Properties.SaveDefaults();
|
||||
|
||||
if (mProperties == Options.Properties)
|
||||
return;
|
||||
|
||||
|
|
|
@ -24,27 +24,31 @@ public:
|
|||
if (((const lcPartsTableWidgetItem&)Other).mLast)
|
||||
return true;
|
||||
|
||||
if (column() > 0)
|
||||
{
|
||||
int Count = text().toInt();
|
||||
int OtherCount = Other.text().toInt();
|
||||
return Count < OtherCount;
|
||||
}
|
||||
|
||||
return QTableWidgetItem::operator<(Other);
|
||||
}
|
||||
|
||||
bool mLast;
|
||||
};
|
||||
|
||||
lcQPropertiesDialog::lcQPropertiesDialog(QWidget* Parent, void* Data)
|
||||
: QDialog(Parent),
|
||||
ui(new Ui::lcQPropertiesDialog)
|
||||
lcQPropertiesDialog::lcQPropertiesDialog(QWidget* Parent, lcPropertiesDialogOptions* Options)
|
||||
: QDialog(Parent), mOptions(Options), ui(new Ui::lcQPropertiesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
options = (lcPropertiesDialogOptions*)Data;
|
||||
setWindowTitle(tr("%1 Properties").arg(mOptions->Properties.mFileName));
|
||||
|
||||
setWindowTitle(tr("%1 Properties").arg(options->Properties.mFileName));
|
||||
ui->descriptionEdit->setText(mOptions->Properties.mDescription);
|
||||
ui->authorEdit->setText(mOptions->Properties.mAuthor);
|
||||
ui->commentsEdit->setText(mOptions->Properties.mComments);
|
||||
|
||||
ui->descriptionEdit->setText(options->Properties.mDescription);
|
||||
ui->authorEdit->setText(options->Properties.mAuthor);
|
||||
ui->commentsEdit->setText(options->Properties.mComments);
|
||||
|
||||
const lcPartsList& PartsList = options->PartsList;
|
||||
const lcPartsList& PartsList = mOptions->PartsList;
|
||||
QStringList horizontalLabels;
|
||||
|
||||
QVector<bool> ColorsUsed(gNumUserColors);
|
||||
|
@ -141,9 +145,9 @@ lcQPropertiesDialog::~lcQPropertiesDialog()
|
|||
|
||||
void lcQPropertiesDialog::accept()
|
||||
{
|
||||
options->Properties.mDescription = ui->descriptionEdit->text();
|
||||
options->Properties.mAuthor = ui->authorEdit->text();
|
||||
options->Properties.mComments = ui->commentsEdit->toPlainText();
|
||||
mOptions->Properties.mDescription = ui->descriptionEdit->text();
|
||||
mOptions->Properties.mAuthor = ui->authorEdit->text();
|
||||
mOptions->Properties.mComments = ui->commentsEdit->toPlainText();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
struct lcPropertiesDialogOptions;
|
||||
#include "lc_model.h"
|
||||
|
||||
namespace Ui {
|
||||
struct lcPropertiesDialogOptions
|
||||
{
|
||||
lcModelProperties Properties;
|
||||
|
||||
lcPartsList PartsList;
|
||||
};
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class lcQPropertiesDialog;
|
||||
}
|
||||
|
||||
|
@ -12,15 +19,15 @@ class lcQPropertiesDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
lcQPropertiesDialog(QWidget* Parent, void* Data);
|
||||
lcQPropertiesDialog(QWidget* Parent, lcPropertiesDialogOptions* Options);
|
||||
~lcQPropertiesDialog();
|
||||
|
||||
lcPropertiesDialogOptions *options;
|
||||
lcPropertiesDialogOptions* mOptions;
|
||||
|
||||
public slots:
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
Ui::lcQPropertiesDialog *ui;
|
||||
Ui::lcQPropertiesDialog* ui;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue