QCodeEdit hide f1

This commit is contained in:
2020-09-14 14:47:42 +03:00
parent a65549d7e8
commit 596ec969c6
2 changed files with 10 additions and 2 deletions

View File

@@ -49,7 +49,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
widget_help->setFrameShape(QFrame::StyledPanel); widget_help->setFrameShape(QFrame::StyledPanel);
widget_help->setLayout(new QBoxLayout(QBoxLayout::TopToBottom)); widget_help->setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
widget_help->layout()->setContentsMargins(0, 0, 0, 0); widget_help->layout()->setContentsMargins(0, 0, 0, 0);
for (int i = 0; i < 3; ++i) { for (int i = 0; i < lh_last; ++i) {
lbl_help[i] = new IconedLabel(); lbl_help[i] = new IconedLabel();
lbl_help[i]->setFrameShadow(QFrame::Plain); lbl_help[i]->setFrameShadow(QFrame::Plain);
lbl_help[i]->setFrameShape(QFrame::NoFrame); lbl_help[i]->setFrameShape(QFrame::NoFrame);
@@ -58,6 +58,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
} }
lbl_help[lhF1]->setIcon(QIcon(":/icons/f1.png")); lbl_help[lhF1]->setIcon(QIcon(":/icons/f1.png"));
lbl_help[lhF1]->setText(tr("Press F1 for details")); lbl_help[lhF1]->setText(tr("Press F1 for details"));
lbl_help[lhF1]->setVisible(false);
completer = new QCodeEditCompleter(); completer = new QCodeEditCompleter();
ui->textCode->setCursorWidth(qMax<int>(qRound(fontHeight() / 10.), 1)); ui->textCode->setCursorWidth(qMax<int>(qRound(fontHeight() / 10.), 1));
@@ -235,6 +236,11 @@ bool QCodeEdit::showLineNumbers() const {
} }
void QCodeEdit::setHelpHintVisible(bool on) {
lbl_help[lhF1]->setVisible(on);
}
void QCodeEdit::setEditorFont(QFont f) { void QCodeEdit::setEditorFont(QFont f) {
ui->textCode->setFont(f); ui->textCode->setFont(f);
ui->textLines->setFont(f); ui->textLines->setFont(f);

View File

@@ -79,6 +79,7 @@ public:
QStringList cursorScope() const; QStringList cursorScope() const;
bool showSpaces() const {return spaces_;} bool showSpaces() const {return spaces_;}
bool showLineNumbers() const; bool showLineNumbers() const;
void setHelpHintVisible(bool on);
void setEditorFont(QFont f); void setEditorFont(QFont f);
QFont editorFont() const; QFont editorFont() const;
@@ -124,7 +125,8 @@ private:
enum LabelHelpType { enum LabelHelpType {
lhMain, lhMain,
lhHint, lhHint,
lhF1 lhF1,
lh_last
}; };
QCodeEditCompleter * completer; QCodeEditCompleter * completer;