mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Only close texture goto when focus is lost
* Previously this closed as soon as the mouse left the bounds.
This commit is contained in:
@@ -37,3 +37,9 @@ void RDDoubleSpinBox::keyPressEvent(QKeyEvent *e)
|
||||
emit keyPress(e);
|
||||
QDoubleSpinBox::keyPressEvent(e);
|
||||
}
|
||||
|
||||
void RDDoubleSpinBox::focusOutEvent(QFocusEvent *e)
|
||||
{
|
||||
emit focusOut(e);
|
||||
QDoubleSpinBox::focusOutEvent(e);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ public:
|
||||
|
||||
signals:
|
||||
void keyPress(QKeyEvent *e);
|
||||
void focusOut(QFocusEvent *e);
|
||||
|
||||
private:
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
void focusOutEvent(QFocusEvent *e) override;
|
||||
};
|
||||
|
||||
@@ -79,6 +79,9 @@ TextureGoto::TextureGoto(QWidget *parent, std::function<void(QPoint)> callback)
|
||||
QObject::connect(m_X, &RDDoubleSpinBox::keyPress, this, &TextureGoto::location_keyPress);
|
||||
QObject::connect(m_Y, &RDDoubleSpinBox::keyPress, this, &TextureGoto::location_keyPress);
|
||||
|
||||
QObject::connect(m_X, &RDDoubleSpinBox::focusOut, this, &TextureGoto::focusOut);
|
||||
QObject::connect(m_Y, &RDDoubleSpinBox::focusOut, this, &TextureGoto::focusOut);
|
||||
|
||||
gridLayout->addWidget(m_Y, 1, 1, 1, 1);
|
||||
|
||||
setTabOrder(m_X, m_Y);
|
||||
@@ -108,11 +111,27 @@ void TextureGoto::show(QWidget *showParent, QPoint p)
|
||||
|
||||
void TextureGoto::leaveEvent(QEvent *event)
|
||||
{
|
||||
}
|
||||
|
||||
void TextureGoto::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
focusOut(event);
|
||||
}
|
||||
|
||||
void TextureGoto::focusOut(QFocusEvent *event)
|
||||
{
|
||||
if(QApplication::focusWidget() == m_X || QApplication::focusWidget() == m_Y || isHidden())
|
||||
return;
|
||||
|
||||
QDialog::hide();
|
||||
}
|
||||
|
||||
void TextureGoto::location_keyPress(QKeyEvent *event)
|
||||
{
|
||||
if(event->key() == Qt::Key_Escape)
|
||||
{
|
||||
QDialog::hide();
|
||||
}
|
||||
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
|
||||
{
|
||||
m_Callback(point());
|
||||
|
||||
@@ -42,9 +42,11 @@ signals:
|
||||
|
||||
public slots:
|
||||
void location_keyPress(QKeyEvent *);
|
||||
void focusOut(QFocusEvent *event);
|
||||
|
||||
private:
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
|
||||
RDDoubleSpinBox *m_X, *m_Y;
|
||||
std::function<void(QPoint)> m_Callback;
|
||||
|
||||
Reference in New Issue
Block a user