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()
|
||||
{
|
||||
const bool has_subject{label_subject->text().isEmpty()};
|
||||
label_subject->setHidden(has_subject);
|
||||
button_more->setHidden(has_subject);
|
||||
const bool has_subject{!label_subject->text().isEmpty()};
|
||||
label_subject->setVisible(has_subject);
|
||||
button_more->setVisible(has_subject);
|
||||
label_content->setHidden(has_subject);
|
||||
|
||||
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
|
||||
|
|
|
@ -4,16 +4,15 @@
|
|||
#include "../ui/ui_widget_post.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QResizeEvent>
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <QTreeWidget>
|
||||
|
||||
namespace FediPotato
|
||||
{
|
||||
|
||||
class PostWidget : public QWidget, private Ui::PostWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Default constructor
|
||||
explicit PostWidget(QWidget *parent = nullptr)
|
||||
|
@ -59,6 +58,9 @@ public:
|
|||
}
|
||||
|
||||
void show_hide_elements();
|
||||
|
||||
private slots:
|
||||
void toggled_button(const bool &toggled);
|
||||
};
|
||||
|
||||
} // namespace FediPotato
|
||||
|
|
|
@ -217,5 +217,25 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<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>
|
||||
|
|
Reference in New Issue