mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-08 22:59:58 +01:00
Master element : comment is displayed even if there isn't slave linked
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3414 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -70,6 +70,20 @@ bool ElementInfoPartWidget::mustShow() const {
|
||||
return (ui->checkBox->isChecked());
|
||||
}
|
||||
|
||||
void ElementInfoPartWidget::setShow(bool s) {
|
||||
/**
|
||||
* @brief ElementInfoPartWidget::setShow
|
||||
* Check or not the ckeck box
|
||||
* @param s true-> checked
|
||||
*/
|
||||
void ElementInfoPartWidget::setShow(const bool &s) {
|
||||
ui->checkBox->setChecked(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementInfoPartWidget::setHideShow
|
||||
* Hide or not the check box
|
||||
* @param hide true -> hidden
|
||||
*/
|
||||
void ElementInfoPartWidget::setHideShow(const bool &hide) {
|
||||
ui -> checkBox -> setHidden(hide);
|
||||
}
|
||||
|
||||
@@ -27,20 +27,22 @@ namespace Ui {
|
||||
class ElementInfoPartWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
//METHODS
|
||||
public:
|
||||
explicit ElementInfoPartWidget(QString key, QString translated_key, QWidget *parent = 0);
|
||||
~ElementInfoPartWidget();
|
||||
QString key() const {return key_;}
|
||||
void setText(const QString &);
|
||||
QString text() const;
|
||||
bool mustShow() const;
|
||||
void setShow(bool);
|
||||
//METHODS
|
||||
public:
|
||||
explicit ElementInfoPartWidget(QString key, QString translated_key, QWidget *parent = 0);
|
||||
~ElementInfoPartWidget();
|
||||
|
||||
//ATTRIBUTES
|
||||
private:
|
||||
Ui::ElementInfoPartWidget *ui;
|
||||
QString key_;
|
||||
QString key () const {return key_;}
|
||||
void setText (const QString &);
|
||||
QString text () const;
|
||||
bool mustShow () const;
|
||||
void setShow (const bool &);
|
||||
void setHideShow (const bool &);
|
||||
|
||||
//ATTRIBUTES
|
||||
private:
|
||||
Ui::ElementInfoPartWidget *ui;
|
||||
QString key_;
|
||||
};
|
||||
|
||||
#endif // ELEMENTINFOPARTWIDGET_H
|
||||
|
||||
@@ -81,12 +81,17 @@ void ElementInfoWidget::buildInterface() {
|
||||
*/
|
||||
void ElementInfoWidget::fillInfo() {
|
||||
foreach (ElementInfoPartWidget *eipw, eipw_list) {
|
||||
eipw->setText(elmt_info[eipw->key()].toString());
|
||||
eipw->setShow(elmt_info.keyMustShow(eipw->key()));
|
||||
//check "show" if this eipw is label and if elmt_info haven't got value for label.
|
||||
if (eipw->key() == "label" && (elmt_info["label"].toString().isEmpty()))
|
||||
eipw->setShow(true);
|
||||
else if (eipw->key() == "comment" && (elmt_info["comment"].toString().isEmpty()))
|
||||
eipw->setShow(true);
|
||||
|
||||
eipw -> setText (elmt_info[eipw->key()].toString());
|
||||
eipw -> setShow (elmt_info.keyMustShow(eipw->key()));
|
||||
|
||||
//If the current eipw is for label or comment and the text is empty
|
||||
//we force the checkbox to ckecked
|
||||
if (eipw -> key() == "label" || eipw -> key() == "comment") {
|
||||
if (elmt_info[eipw->key()].toString().isEmpty())
|
||||
eipw->setShow(true);
|
||||
}
|
||||
else //< for other eipw we hide the checkbox
|
||||
eipw->setHideShow(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user