Change header color when split is active

Colors might need to change but they work for now

Fix #495
This commit is contained in:
Rasmus Karlsson
2018-06-23 11:54:00 +00:00
parent 5ae671dc14
commit b2f454aca4
8 changed files with 24 additions and 4 deletions
+9
View File
@@ -146,6 +146,15 @@ void ResizingTextEdit::focusInEvent(QFocusEvent *event)
}
}
void ResizingTextEdit::focusOutEvent(QFocusEvent *event)
{
QTextEdit::focusOutEvent(event);
if (event->lostFocus()) {
this->focusLost.invoke();
}
}
void ResizingTextEdit::setCompleter(QCompleter *c)
{
if (this->completer) {
+2
View File
@@ -16,6 +16,7 @@ public:
pajlada::Signals::Signal<QKeyEvent *> keyPressed;
pajlada::Signals::NoArgSignal focused;
pajlada::Signals::NoArgSignal focusLost;
void setCompleter(QCompleter *c);
QCompleter *getCompleter() const;
@@ -25,6 +26,7 @@ protected:
void keyPressEvent(QKeyEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
private:
QCompleter *completer = nullptr;
+9 -1
View File
@@ -30,6 +30,9 @@ SplitHeader::SplitHeader(Split *_split)
: BaseWidget(_split)
, split(_split)
{
this->split->focused.connect([this]() { this->themeRefreshEvent(); });
this->split->focusLost.connect([this]() { this->themeRefreshEvent(); });
auto app = getApp();
util::LayoutCreator<SplitHeader> layoutCreator(this);
@@ -370,7 +373,12 @@ void SplitHeader::rightButtonClicked()
void SplitHeader::themeRefreshEvent()
{
QPalette palette;
palette.setColor(QPalette::Foreground, this->themeManager->splits.header.text);
if (this->split->hasFocus()) {
palette.setColor(QPalette::Foreground, this->themeManager->splits.header.activeText);
} else {
palette.setColor(QPalette::Foreground, this->themeManager->splits.header.text);
}
// this->dropdownButton->setPalette(palette);
this->titleLabel->setPalette(palette);
+1
View File
@@ -143,6 +143,7 @@ Split::Split(QWidget *parent)
});
this->input.ui_.textEdit->focused.connect([this] { this->focused.invoke(); });
this->input.ui_.textEdit->focusLost.connect([this] { this->focusLost.invoke(); });
}
Split::~Split()
+1
View File
@@ -47,6 +47,7 @@ public:
pajlada::Signals::NoArgSignal channelChanged;
pajlada::Signals::NoArgSignal focused;
pajlada::Signals::NoArgSignal focusLost;
ChannelView &getChannelView();
SplitContainer *getContainer();