added alt+arrowkeys back
This commit is contained in:
@@ -137,10 +137,19 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ResizingTextEdit::focusInEvent(QFocusEvent *event)
|
||||
{
|
||||
QTextEdit::focusInEvent(event);
|
||||
|
||||
if (event->gotFocus()) {
|
||||
this->focused.invoke();
|
||||
}
|
||||
}
|
||||
|
||||
void ResizingTextEdit::setCompleter(QCompleter *c)
|
||||
{
|
||||
if (this->completer) {
|
||||
QObject::disconnect(this->completer, 0, this, 0);
|
||||
QObject::disconnect(this->completer, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
this->completer = c;
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
bool hasHeightForWidth() const override;
|
||||
|
||||
pajlada::Signals::Signal<QKeyEvent *> keyPressed;
|
||||
pajlada::Signals::NoArgSignal focused;
|
||||
|
||||
void setCompleter(QCompleter *c);
|
||||
QCompleter *getCompleter() const;
|
||||
@@ -23,6 +24,8 @@ protected:
|
||||
int heightForWidth(int) const override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
void focusInEvent(QFocusEvent *event) override;
|
||||
|
||||
private:
|
||||
QCompleter *completer = nullptr;
|
||||
bool completionInProgress = false;
|
||||
|
||||
@@ -165,16 +165,11 @@ void SplitInput::installKeyPressedEvent()
|
||||
return;
|
||||
}
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
SplitContainer *page = this->split->getContainer();
|
||||
|
||||
// page->requestFocus();
|
||||
// int reqX = page->currentX;
|
||||
// int reqY = page->lastRequestedY[reqX] - 1;
|
||||
|
||||
// qDebug() << "Alt+Down to" << reqX << "/" << reqY;
|
||||
|
||||
// page->requestFocus(reqX, reqY);
|
||||
if (page != nullptr) {
|
||||
page->selectNextSplit(SplitContainer::Above);
|
||||
}
|
||||
} else {
|
||||
if (this->prevMsg.size() && this->prevIndex) {
|
||||
if (this->prevIndex == (this->prevMsg.size())) {
|
||||
@@ -194,15 +189,11 @@ void SplitInput::installKeyPressedEvent()
|
||||
return;
|
||||
}
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
SplitContainer *page = this->split->getContainer();
|
||||
|
||||
// int reqX = page->currentX;
|
||||
// int reqY = page->lastRequestedY[reqX] + 1;
|
||||
|
||||
// qDebug() << "Alt+Down to" << reqX << "/" << reqY;
|
||||
|
||||
// page->requestFocus(reqX, reqY);
|
||||
if (page != nullptr) {
|
||||
page->selectNextSplit(SplitContainer::Below);
|
||||
}
|
||||
} else {
|
||||
if (this->prevIndex != (this->prevMsg.size() - 1) &&
|
||||
this->prevIndex != this->prevMsg.size()) {
|
||||
@@ -219,27 +210,19 @@ void SplitInput::installKeyPressedEvent()
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Left) {
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
SplitContainer *page = this->split->getContainer();
|
||||
|
||||
// int reqX = page->currentX - 1;
|
||||
// int reqY = page->lastRequestedY[reqX];
|
||||
|
||||
// qDebug() << "Alt+Left to" << reqX << "/" << reqY;
|
||||
|
||||
// page->requestFocus(reqX, reqY);
|
||||
if (page != nullptr) {
|
||||
page->selectNextSplit(SplitContainer::Left);
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Right) {
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
// SplitContainer *page =
|
||||
// static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||
SplitContainer *page = this->split->getContainer();
|
||||
|
||||
// int reqX = page->currentX + 1;
|
||||
// int reqY = page->lastRequestedY[reqX];
|
||||
|
||||
// qDebug() << "Alt+Right to" << reqX << "/" << reqY;
|
||||
|
||||
// page->requestFocus(reqX, reqY);
|
||||
if (page != nullptr) {
|
||||
page->selectNextSplit(SplitContainer::Right);
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Tab) {
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
|
||||
@@ -52,12 +52,6 @@ private:
|
||||
} ui;
|
||||
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
// QHBoxLayout hbox;
|
||||
// QVBoxLayout vbox;
|
||||
// QHBoxLayout editContainer;
|
||||
// ResizingTextEdit textInput;
|
||||
// QLabel textLengthLabel;
|
||||
// RippleEffectLabel emotesLabel;
|
||||
QStringList prevMsg;
|
||||
QString currMsg;
|
||||
int prevIndex = 0;
|
||||
|
||||
Reference in New Issue
Block a user