Improve code style, Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-16 14:24:12 +02:00
parent 928b56f2bf
commit 3b3ce2cb7c
3 changed files with 70 additions and 64 deletions

View File

@@ -59,7 +59,7 @@ void TitleBlockTemplateCellWidget::initWidgets() {
name_input_ = new QLineEdit(); name_input_ = new QLineEdit();
// widgets specific to empty cells // widgets specific to empty cells
empty_label_ = new QLabel(tr("Attention : les bordures des cellules vides n'apparaissent pas lors du rendu final sur le folio.")); empty_label_ = new QLabel(tr("Attention : les bordures des cellules vides n'apparaissent pas lors du rendu final sur le folio."));
// widgets specific to logo cells // widgets specific to logo cells
logo_label_ = new QLabel(tr("Logo")); logo_label_ = new QLabel(tr("Logo"));

View File

@@ -25,6 +25,7 @@ class TitleBlockCell;
class NamesList; class NamesList;
/** /**
@brief The TitleBlockTemplateCellWidget class
This class implements an edition widget for cells that compose a title This class implements an edition widget for cells that compose a title
block template. block template.
*/ */
@@ -33,86 +34,91 @@ class TitleBlockTemplateCellWidget : public QWidget {
// constructor, destructor // constructor, destructor
public: public:
TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr, QWidget * = nullptr); TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr,
~TitleBlockTemplateCellWidget() override; QWidget * = nullptr);
~TitleBlockTemplateCellWidget() override;
private: private:
TitleBlockTemplateCellWidget(const TitleBlockTemplateCellWidget &); TitleBlockTemplateCellWidget(
const TitleBlockTemplateCellWidget &);
// attributes // attributes
private: private:
/// is the template read-only? /// is the template read-only?
bool read_only_; bool read_only_;
QLabel *cell_type_label_; QLabel *cell_type_label_;
QComboBox *cell_type_input_; QComboBox *cell_type_input_;
QLabel *empty_label_; QLabel *empty_label_;
QLabel *logo_label_; QLabel *logo_label_;
QComboBox *logo_input_; QComboBox *logo_input_;
QPushButton *add_logo_input_; QPushButton *add_logo_input_;
QLabel *name_label_; QLabel *name_label_;
QLineEdit *name_input_; QLineEdit *name_input_;
QCheckBox *label_checkbox_; QCheckBox *label_checkbox_;
QLineEdit *label_input_; QLineEdit *label_input_;
QPushButton *label_edit_; QPushButton *label_edit_;
QLabel *value_label_; QLabel *value_label_;
QLineEdit *value_input_; QLineEdit *value_input_;
QPushButton *value_edit_; QPushButton *value_edit_;
QLabel *align_label_; QLabel *align_label_;
QLabel *horiz_align_label_; QLabel *horiz_align_label_;
QComboBox *horiz_align_input_; QComboBox *horiz_align_input_;
QHash<int, int> horiz_align_indexes_; QHash<int, int> horiz_align_indexes_;
QLabel *vert_align_label_; QLabel *vert_align_label_;
QComboBox *vert_align_input_; QComboBox *vert_align_input_;
QHash<int, int> vert_align_indexes_; QHash<int, int> vert_align_indexes_;
QLabel *font_size_label_; QLabel *font_size_label_;
QSpinBox *font_size_input_; QSpinBox *font_size_input_;
QCheckBox *font_adjust_input_; QCheckBox *font_adjust_input_;
QVBoxLayout *cell_editor_layout_; QVBoxLayout *cell_editor_layout_;
QHBoxLayout *cell_editor_type_and_name_layout_; QHBoxLayout *cell_editor_type_and_name_layout_;
QGridLayout *cell_editor_text_layout_; QGridLayout *cell_editor_text_layout_;
QHBoxLayout *cell_editor_image_layout_; QHBoxLayout *cell_editor_image_layout_;
TitleBlockCell *edited_cell_; TitleBlockCell *edited_cell_;
// methods // methods
public: public:
int horizontalAlignment() const; int horizontalAlignment() const;
int verticalAlignment() const; int verticalAlignment() const;
int alignment() const; int alignment() const;
bool isReadOnly() const; bool isReadOnly() const;
protected: protected:
void editTranslatableValue(NamesList &, const QString &, const QString &) const; void editTranslatableValue(NamesList &,
void emitModification(const QString &, const QVariant &) const; const QString &,
QString defaultVariablesString() const; const QString &) const;
QString labelValueInformationString() const; void emitModification(const QString &,
const QVariant &) const;
QString defaultVariablesString() const;
QString labelValueInformationString() const;
private: private:
void initWidgets(); void initWidgets();
public slots: public slots:
void updateFormType(int); void updateFormType(int);
void edit(TitleBlockCell *); void edit(TitleBlockCell *);
void editType(); void editType();
void editName(); void editName();
void editLabelDisplayed(); void editLabelDisplayed();
void editLabel(); void editLabel();
void editValue(); void editValue();
void editAlignment(); void editAlignment();
void editFontSize(); void editFontSize();
void editAdjust(); void editAdjust();
void editLogo(); void editLogo();
void updateLogosComboBox(const TitleBlockTemplate *); void updateLogosComboBox(const TitleBlockTemplate *);
void setReadOnly(bool); void setReadOnly(bool);
private slots: private slots:
signals: signals:
void logoEditionRequested(); void logoEditionRequested();
void cellModified(ModifyTitleBlockCellCommand *) const; void cellModified(ModifyTitleBlockCellCommand *) const;
}; };
#endif #endif

View File

@@ -422,7 +422,7 @@ void TitleBlockTemplateView::drawBackground(QPainter *painter, const QRectF &rec
@return the selected logical cells, not including the spanned ones. @return the selected logical cells, not including the spanned ones.
*/ */
QList<TitleBlockCell *> TitleBlockTemplateView::selectedCells() const { QList<TitleBlockCell *> TitleBlockTemplateView::selectedCells() const {
return(selectedCellsSet().cells(false).values()); return(selectedCellsSet().cells(false).values());
} }
/** /**