From 39f159b94bdf78ae423aa8c66886027e21b6a91a Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 28 Feb 2020 04:36:42 +0100 Subject: [PATCH] =?UTF-8?q?Make=20=E2=80=9CShow=20more=E2=80=9D=20button?= =?UTF-8?q?=20work.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/src/widget_post.cpp | 12 +++++++++--- gui/src/widget_post.hpp | 8 +++++--- gui/ui/widget_post.ui | 22 +++++++++++++++++++++- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/gui/src/widget_post.cpp b/gui/src/widget_post.cpp index e4dd006..b3de182 100644 --- a/gui/src/widget_post.cpp +++ b/gui/src/widget_post.cpp @@ -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 diff --git a/gui/src/widget_post.hpp b/gui/src/widget_post.hpp index efe76bf..1049a63 100644 --- a/gui/src/widget_post.hpp +++ b/gui/src/widget_post.hpp @@ -4,16 +4,15 @@ #include "../ui/ui_widget_post.h" #include -#include #include -#include -#include 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 diff --git a/gui/ui/widget_post.ui b/gui/ui/widget_post.ui index 5e058e6..5351aeb 100644 --- a/gui/ui/widget_post.ui +++ b/gui/ui/widget_post.ui @@ -217,5 +217,25 @@ - + + + button_more + toggled(bool) + PostWidget + toggled_button(bool) + + + 113 + 68 + + + 99 + 57 + + + + + + toggled_button(bool) +