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: 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: Fixed incorrect lua generation of static methods for typescript plugins. (#6190, #6223)
|
||||||
- Dev: Merged top/bottom and left/right notebook layouts. (#6215)
|
- 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 "add split" button (part of the split header) a natively rendered button. (#6349)
|
||||||
- Dev: Made Settings & Account button on Linux/macOS SVGs. (#6267)
|
- Dev: Made Settings & Account button on Linux/macOS SVGs. (#6267)
|
||||||
- Dev: Some more setting widget refactors. (#6317)
|
- 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;
|
o.foregroundHover = this->theme->messages.textColors.regular;
|
||||||
}
|
}
|
||||||
break;
|
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();
|
this->invalidateContent();
|
||||||
@@ -104,6 +122,28 @@ void DrawnButton::paintContent(QPainter &painter)
|
|||||||
painter.drawLine(horizontal);
|
painter.drawLine(horizontal);
|
||||||
}
|
}
|
||||||
break;
|
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
|
/// Padding: 2px
|
||||||
/// Thickness: 1px
|
/// Thickness: 1px
|
||||||
Plus,
|
Plus,
|
||||||
|
|
||||||
|
/// kebab menu (3 dots underneath eachother)
|
||||||
|
Kebab,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
|
|||||||
@@ -296,6 +296,15 @@ void SplitHeader::initializeLayout()
|
|||||||
},
|
},
|
||||||
this);
|
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>({
|
auto *layout = makeLayout<QHBoxLayout>({
|
||||||
// space
|
// space
|
||||||
makeWidget<BaseWidget>([](auto w) {
|
makeWidget<BaseWidget>([](auto w) {
|
||||||
@@ -362,12 +371,7 @@ void SplitHeader::initializeLayout()
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
// dropdown
|
// dropdown
|
||||||
this->dropdownButton_ = makeWidget<PixmapButton>([&](auto w) {
|
this->dropdownButton_,
|
||||||
/// XXX: this never gets disconnected
|
|
||||||
QObject::connect(w, &Button::leftMousePress, this, [this] {
|
|
||||||
this->dropdownButton_->setMenu(this->createMainMenu());
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
// add split
|
// add split
|
||||||
this->addButton_,
|
this->addButton_,
|
||||||
});
|
});
|
||||||
@@ -1085,12 +1089,10 @@ void SplitHeader::themeChangedEvent()
|
|||||||
if (this->theme->isLightTheme())
|
if (this->theme->isLightTheme())
|
||||||
{
|
{
|
||||||
this->chattersButton_->setPixmap(getResources().buttons.chattersDark);
|
this->chattersButton_->setPixmap(getResources().buttons.chattersDark);
|
||||||
this->dropdownButton_->setPixmap(getResources().buttons.menuDark);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->chattersButton_->setPixmap(getResources().buttons.chattersLight);
|
this->chattersButton_->setPixmap(getResources().buttons.chattersLight);
|
||||||
this->dropdownButton_->setPixmap(getResources().buttons.menuLight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ private:
|
|||||||
std::chrono::steady_clock::time_point lastReloadedSubEmotes_;
|
std::chrono::steady_clock::time_point lastReloadedSubEmotes_;
|
||||||
|
|
||||||
// ui
|
// ui
|
||||||
PixmapButton *dropdownButton_{};
|
DrawnButton *dropdownButton_{};
|
||||||
Label *titleLabel_{};
|
Label *titleLabel_{};
|
||||||
|
|
||||||
LabelButton *modeButton_{};
|
LabelButton *modeButton_{};
|
||||||
|
|||||||
Reference in New Issue
Block a user