chore: make split header menu button drawn (#6372)
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@
|
||||
- Dev: Simplified string literals to be a re-export of Qt functions. (#6175)
|
||||
- Dev: Fixed incorrect lua generation of static methods for typescript plugins. (#6190, #6223)
|
||||
- Dev: Merged top/bottom and left/right notebook layouts. (#6215)
|
||||
- Dev: Refactored `Button` and friends. (#6102, #6255, #6266, #6302, #6268, #6334, #6371)
|
||||
- Dev: Refactored `Button` and friends. (#6102, #6255, #6266, #6302, #6268, #6334, #6371, #6372)
|
||||
- Dev: Made "add split" button (part of the split header) a natively rendered button. (#6349)
|
||||
- Dev: Made Settings & Account button on Linux/macOS SVGs. (#6267)
|
||||
- Dev: Some more setting widget refactors. (#6317)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 90 B |
Binary file not shown.
|
Before Width: | Height: | Size: 328 B |
@@ -42,6 +42,24 @@ void DrawnButton::themeChangedEvent()
|
||||
o.foregroundHover = this->theme->messages.textColors.regular;
|
||||
}
|
||||
break;
|
||||
|
||||
case Symbol::Kebab: {
|
||||
o.padding = 2;
|
||||
o.thickness = 2;
|
||||
|
||||
if (this->theme->isLightTheme())
|
||||
{
|
||||
// TODO: This should use its own theme color (e.g. theme->button->regular)
|
||||
o.foreground = QColor("#424242");
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: This should use its own theme color (e.g. theme->button->regular)
|
||||
o.foreground = QColor("#c0c0c0");
|
||||
}
|
||||
o.foregroundHover = this->theme->messages.textColors.regular;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this->invalidateContent();
|
||||
@@ -104,6 +122,28 @@ void DrawnButton::paintContent(QPainter &painter)
|
||||
painter.drawLine(horizontal);
|
||||
}
|
||||
break;
|
||||
|
||||
case Symbol::Kebab: {
|
||||
QPen pen;
|
||||
pen.setColor(fg);
|
||||
pen.setWidth(thickness);
|
||||
painter.setPen(pen);
|
||||
|
||||
QRect centerBox;
|
||||
centerBox.setSize({thickness, thickness});
|
||||
centerBox.moveCenter(rect().center());
|
||||
|
||||
painter.fillRect(centerBox, fg);
|
||||
|
||||
// NOTE: Technically a misuse of padding
|
||||
auto bottomBox = centerBox.translated(0, thickness + padding);
|
||||
painter.fillRect(bottomBox, fg);
|
||||
|
||||
// NOTE: Technically a misuse of padding
|
||||
auto topBox = centerBox.translated(0, -(thickness + padding));
|
||||
painter.fillRect(topBox, fg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ public:
|
||||
/// Padding: 2px
|
||||
/// Thickness: 1px
|
||||
Plus,
|
||||
|
||||
/// kebab menu (3 dots underneath eachother)
|
||||
Kebab,
|
||||
};
|
||||
|
||||
struct Options {
|
||||
|
||||
@@ -296,6 +296,15 @@ void SplitHeader::initializeLayout()
|
||||
},
|
||||
this);
|
||||
|
||||
this->dropdownButton_ =
|
||||
new DrawnButton(DrawnButton::Symbol::Kebab, {}, this);
|
||||
|
||||
/// XXX: this never gets disconnected
|
||||
QObject::connect(this->dropdownButton_, &Button::leftMousePress, this,
|
||||
[this] {
|
||||
this->dropdownButton_->setMenu(this->createMainMenu());
|
||||
});
|
||||
|
||||
auto *layout = makeLayout<QHBoxLayout>({
|
||||
// space
|
||||
makeWidget<BaseWidget>([](auto w) {
|
||||
@@ -362,12 +371,7 @@ void SplitHeader::initializeLayout()
|
||||
});
|
||||
}),
|
||||
// dropdown
|
||||
this->dropdownButton_ = makeWidget<PixmapButton>([&](auto w) {
|
||||
/// XXX: this never gets disconnected
|
||||
QObject::connect(w, &Button::leftMousePress, this, [this] {
|
||||
this->dropdownButton_->setMenu(this->createMainMenu());
|
||||
});
|
||||
}),
|
||||
this->dropdownButton_,
|
||||
// add split
|
||||
this->addButton_,
|
||||
});
|
||||
@@ -1085,12 +1089,10 @@ void SplitHeader::themeChangedEvent()
|
||||
if (this->theme->isLightTheme())
|
||||
{
|
||||
this->chattersButton_->setPixmap(getResources().buttons.chattersDark);
|
||||
this->dropdownButton_->setPixmap(getResources().buttons.menuDark);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->chattersButton_->setPixmap(getResources().buttons.chattersLight);
|
||||
this->dropdownButton_->setPixmap(getResources().buttons.menuLight);
|
||||
}
|
||||
|
||||
this->update();
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
std::chrono::steady_clock::time_point lastReloadedSubEmotes_;
|
||||
|
||||
// ui
|
||||
PixmapButton *dropdownButton_{};
|
||||
DrawnButton *dropdownButton_{};
|
||||
Label *titleLabel_{};
|
||||
|
||||
LabelButton *modeButton_{};
|
||||
|
||||
Reference in New Issue
Block a user