fix: cursor is always IBeam
This commit is contained in:
parent
4634c0fbbc
commit
23c6f7f702
|
@ -137,6 +137,8 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(this, &QWidget::customContextMenuRequested,
|
connect(this, &QWidget::customContextMenuRequested,
|
||||||
pMainWindow, &MainWindow::onEditorContextMenu);
|
pMainWindow, &MainWindow::onEditorContextMenu);
|
||||||
|
|
||||||
|
mOldHintCursor = Qt::IBeamCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::~Editor() {
|
Editor::~Editor() {
|
||||||
|
@ -771,17 +773,13 @@ bool Editor::event(QEvent *event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug()<<s<<" -- "<<(int)reason;
|
|
||||||
// Don't rescan the same stuff over and over again (that's slow)
|
|
||||||
// if (s = fCurrentWord) and (fText.Hint<>'') then
|
|
||||||
s = s.trimmed();
|
s = s.trimmed();
|
||||||
if ((s == mCurrentWord) && (mCurrentTipType == reason)) {
|
if ((s == mCurrentWord) && (mCurrentTipType == reason)) {
|
||||||
// QApplication* app = dynamic_cast<QApplication *>(QApplication::instance());
|
|
||||||
// if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) {
|
|
||||||
if (helpEvent->modifiers() == Qt::ControlModifier) {
|
if (helpEvent->modifiers() == Qt::ControlModifier) {
|
||||||
|
mOldHintCursor = cursor();
|
||||||
setCursor(Qt::PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
} else {
|
} else if (cursor() == Qt::PointingHandCursor) {
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(mOldHintCursor);
|
||||||
}
|
}
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return true; // do NOT remove hint when subject stays the same
|
return true; // do NOT remove hint when subject stays the same
|
||||||
|
@ -828,13 +826,17 @@ bool Editor::event(QEvent *event)
|
||||||
// QApplication* app = dynamic_cast<QApplication *>(QApplication::instance());
|
// QApplication* app = dynamic_cast<QApplication *>(QApplication::instance());
|
||||||
// if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) {
|
// if (app->keyboardModifiers().testFlag(Qt::ControlModifier)) {
|
||||||
if (helpEvent->modifiers() == Qt::ControlModifier) {
|
if (helpEvent->modifiers() == Qt::ControlModifier) {
|
||||||
|
mOldHintCursor = cursor();
|
||||||
setCursor(Qt::PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
} else {
|
} else if (cursor() == Qt::PointingHandCursor) {
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(mOldHintCursor);
|
||||||
}
|
}
|
||||||
QToolTip::showText(mapToGlobal(helpEvent->pos()),hint);
|
QToolTip::showText(mapToGlobal(helpEvent->pos()),hint);
|
||||||
event->ignore();
|
event->ignore();
|
||||||
} else {
|
} else {
|
||||||
|
if (cursor() == Qt::PointingHandCursor) {
|
||||||
|
setCursor(mOldHintCursor);
|
||||||
|
}
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2143,7 +2145,8 @@ void Editor::cancelHint()
|
||||||
QToolTip::hideText();
|
QToolTip::hideText();
|
||||||
mCurrentWord = "";
|
mCurrentWord = "";
|
||||||
mCurrentTipType = TipType::None;
|
mCurrentTipType = TipType::None;
|
||||||
setCursor(Qt::IBeamCursor);
|
if (cursor() == Qt::PointingHandCursor)
|
||||||
|
setCursor(mOldHintCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Editor::getFileHint(const QString &s)
|
QString Editor::getFileHint(const QString &s)
|
||||||
|
|
|
@ -229,6 +229,7 @@ private:
|
||||||
TipType mCurrentTipType;
|
TipType mCurrentTipType;
|
||||||
QString mOldSelectionWord;
|
QString mOldSelectionWord;
|
||||||
QString mSelectionWord;
|
QString mSelectionWord;
|
||||||
|
QCursor mOldHintCursor;
|
||||||
|
|
||||||
bool mSaving;
|
bool mSaving;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue