Skip to content

Commit dc62e82

Browse files
Nerixyzpajlada
andauthored
Add (invisible) resize handle to frameless usercards and reply threads (#4795)
* feat: add resize handle to usercards&reply threads * Add changelog entry --------- Co-authored-by: Rasmus Karlsson <[email protected]>
1 parent f13a3b9 commit dc62e82

File tree

6 files changed

+59
-4
lines changed

6 files changed

+59
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
66
- Minor: The account switcher is now styled to match your theme. (#4817)
7+
- Minor: Add an invisible resize handle to the bottom of frameless user info popups and reply thread popups. (#4795)
78
- Bugfix: Fixed a performance issue when displaying replies to certain messages. (#4807)
89
- Bugfix: Fixed a data race when disconnecting from Twitch PubSub. (#4771)
910
- Bugfix: Fixed `/shoutout` command not working with usernames starting with @'s (e.g. `/shoutout @forsen`). (#4800)

src/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ set(SOURCE_FILES
538538
widgets/helper/EditableModelView.hpp
539539
widgets/helper/EffectLabel.cpp
540540
widgets/helper/EffectLabel.hpp
541+
widgets/helper/InvisibleSizeGrip.cpp
542+
widgets/helper/InvisibleSizeGrip.hpp
541543
widgets/helper/NotebookButton.cpp
542544
widgets/helper/NotebookButton.hpp
543545
widgets/helper/NotebookTab.cpp

src/widgets/dialogs/ReplyThreadPopup.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "util/LayoutCreator.hpp"
1414
#include "widgets/helper/Button.hpp"
1515
#include "widgets/helper/ChannelView.hpp"
16+
#include "widgets/helper/InvisibleSizeGrip.hpp"
1617
#include "widgets/Scrollbar.hpp"
1718
#include "widgets/splits/Split.hpp"
1819
#include "widgets/splits/SplitInput.hpp"
@@ -120,8 +121,10 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
120121
}
121122
});
122123

123-
auto layout = LayoutCreator<QWidget>(this->getLayoutContainer())
124-
.setLayoutType<QVBoxLayout>();
124+
auto layers = LayoutCreator<QWidget>(this->getLayoutContainer())
125+
.setLayoutType<QGridLayout>()
126+
.withoutMargin();
127+
auto layout = layers.emplace<QVBoxLayout>();
125128

126129
layout->setSpacing(0);
127130
// provide draggable margin if frameless
@@ -174,6 +177,13 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
174177

175178
layout->addWidget(this->ui_.threadView, 1);
176179
layout->addWidget(this->ui_.replyInput);
180+
181+
// size grip
182+
if (closeAutomatically)
183+
{
184+
layers->addWidget(new InvisibleSizeGrip(this), 0, 0,
185+
Qt::AlignRight | Qt::AlignBottom);
186+
}
177187
}
178188

179189
void ReplyThreadPopup::setThread(std::shared_ptr<MessageThread> thread)

src/widgets/dialogs/UserInfoPopup.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "util/StreamerMode.hpp"
2727
#include "widgets/helper/ChannelView.hpp"
2828
#include "widgets/helper/EffectLabel.hpp"
29+
#include "widgets/helper/InvisibleSizeGrip.hpp"
2930
#include "widgets/helper/Line.hpp"
3031
#include "widgets/Label.hpp"
3132
#include "widgets/Scrollbar.hpp"
@@ -246,8 +247,10 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
246247
this->shortcuts_ = getApp()->hotkeys->shortcutsForCategory(
247248
HotkeyCategory::PopupWindow, actions, this);
248249

249-
auto layout = LayoutCreator<QWidget>(this->getLayoutContainer())
250-
.setLayoutType<QVBoxLayout>();
250+
auto layers = LayoutCreator<QWidget>(this->getLayoutContainer())
251+
.setLayoutType<QGridLayout>()
252+
.withoutMargin();
253+
auto layout = layers.emplace<QVBoxLayout>();
251254

252255
// first line
253256
auto head = layout.emplace<QHBoxLayout>().withoutMargin();
@@ -552,6 +555,13 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
552555
logs->setAlignment(this->ui_.noMessagesLabel, Qt::AlignHCenter);
553556
}
554557

558+
// size grip
559+
if (closeAutomatically)
560+
{
561+
layers->addWidget(new InvisibleSizeGrip(this), 0, 0,
562+
Qt::AlignRight | Qt::AlignBottom);
563+
}
564+
555565
this->installEvents();
556566
this->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Policy::Ignored);
557567
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "widgets/helper/InvisibleSizeGrip.hpp"
2+
3+
namespace chatterino {
4+
5+
InvisibleSizeGrip::InvisibleSizeGrip(QWidget *parent)
6+
: QSizeGrip(parent)
7+
{
8+
// required on Windows to prevent this from being ignored when dragging
9+
this->setMouseTracking(true);
10+
}
11+
12+
void InvisibleSizeGrip::paintEvent(QPaintEvent *event)
13+
{
14+
}
15+
16+
} // namespace chatterino
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
#include <QSizeGrip>
4+
5+
namespace chatterino {
6+
7+
class InvisibleSizeGrip : public QSizeGrip
8+
{
9+
public:
10+
explicit InvisibleSizeGrip(QWidget *parent = nullptr);
11+
12+
protected:
13+
void paintEvent(QPaintEvent *event) override;
14+
};
15+
16+
} // namespace chatterino

0 commit comments

Comments
 (0)