Make “Show more” button work.
This commit is contained in:
parent
142cbf5ea0
commit
39f159b94b
|
@ -21,9 +21,10 @@ namespace FediPotato
|
||||||
|
|
||||||
void PostWidget::show_hide_elements()
|
void PostWidget::show_hide_elements()
|
||||||
{
|
{
|
||||||
const bool has_subject{label_subject->text().isEmpty()};
|
const bool has_subject{!label_subject->text().isEmpty()};
|
||||||
label_subject->setHidden(has_subject);
|
label_subject->setVisible(has_subject);
|
||||||
button_more->setHidden(has_subject);
|
button_more->setVisible(has_subject);
|
||||||
|
label_content->setHidden(has_subject);
|
||||||
|
|
||||||
if (label_avatar->pixmap() == nullptr)
|
if (label_avatar->pixmap() == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -31,4 +32,9 @@ void PostWidget::show_hide_elements()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostWidget::toggled_button(const bool &toggled)
|
||||||
|
{
|
||||||
|
label_content->setVisible(toggled);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FediPotato
|
} // namespace FediPotato
|
||||||
|
|
|
@ -4,16 +4,15 @@
|
||||||
#include "../ui/ui_widget_post.h"
|
#include "../ui/ui_widget_post.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QResizeEvent>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
|
||||||
#include <QTreeWidget>
|
|
||||||
|
|
||||||
namespace FediPotato
|
namespace FediPotato
|
||||||
{
|
{
|
||||||
|
|
||||||
class PostWidget : public QWidget, private Ui::PostWidget
|
class PostWidget : public QWidget, private Ui::PostWidget
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
explicit PostWidget(QWidget *parent = nullptr)
|
explicit PostWidget(QWidget *parent = nullptr)
|
||||||
|
@ -59,6 +58,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_hide_elements();
|
void show_hide_elements();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void toggled_button(const bool &toggled);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace FediPotato
|
} // namespace FediPotato
|
||||||
|
|
|
@ -217,5 +217,25 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>button_more</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>PostWidget</receiver>
|
||||||
|
<slot>toggled_button(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>113</x>
|
||||||
|
<y>68</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>99</x>
|
||||||
|
<y>57</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot>toggled_button(bool)</slot>
|
||||||
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Reference in New Issue