Add action buttons to PostWidget.

This commit is contained in:
tastytea 2020-03-02 00:01:05 +01:00
parent a6ef2aca31
commit bc293a2c61
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 85 additions and 7 deletions

View File

@ -23,7 +23,7 @@ void PostWidget::show_hide_elements()
{
const bool has_subject{!label_subject->text().isEmpty()};
label_subject->setVisible(has_subject);
button_more->setVisible(has_subject);
button_show_more->setVisible(has_subject);
label_content->setHidden(has_subject);
if (label_avatar->pixmap() == nullptr)
@ -32,7 +32,7 @@ void PostWidget::show_hide_elements()
}
}
void PostWidget::toggled_button(const bool &toggled)
void PostWidget::toggled_button_show_more(const bool &toggled)
{
label_content->setVisible(toggled);
}

View File

@ -60,7 +60,7 @@ public:
void show_hide_elements();
private slots:
void toggled_button(const bool &toggled);
void toggled_button_show_more(const bool &toggled);
};
} // namespace FediPotato

View File

@ -157,7 +157,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="button_more">
<widget class="QPushButton" name="button_show_more">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -212,6 +212,84 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hbox_buttons">
<item>
<widget class="QPushButton" name="button_boost">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>🔁</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_fav">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>⭐</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_bookmark">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>🔖</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_more_actions">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -219,10 +297,10 @@
<resources/>
<connections>
<connection>
<sender>button_more</sender>
<sender>button_show_more</sender>
<signal>toggled(bool)</signal>
<receiver>PostWidget</receiver>
<slot>toggled_button(bool)</slot>
<slot>toggled_button_show_more(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>113</x>
@ -236,6 +314,6 @@
</connection>
</connections>
<slots>
<slot>toggled_button(bool)</slot>
<slot>toggled_button_show_more(bool)</slot>
</slots>
</ui>