Skip to content

Commit 0043889

Browse files
committed
Consistency in documentation panel of doxywizard
Make the documentation panel of the doxywizard more consistent: - repeat field name (and corresponding mdash) in all cases - highlight field name before the input field when text is part of search text.
1 parent 79d657a commit 0043889

7 files changed

Lines changed: 26 additions & 6 deletions

File tree

addon/doxywizard/expert.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,13 @@ void Expert::createOptionCard(GroupEntry &group, const QDomElement &child)
516516
docsLabel->setOpenExternalLinks(true);
517517
docsLabel->setContentsMargins(0, 2, 0, 4);
518518
// Use a smaller, muted style for the description text
519-
docsLabel->setText(SMALL_FONT_START + docs + SMALL_FONT_END);
519+
QString display = SMALL_FONT_START + SA("<b>") + id + SA("</b>");
520+
if (!docs.isEmpty())
521+
{
522+
display += SA(" &mdash; ") + docs;
523+
}
524+
display += SMALL_FONT_END;
525+
docsLabel->setText(display);
520526
// Dim the label using PlaceholderText, which is calibrated for readable
521527
// secondary text in both light and dark modes (available since Qt 5.12).
522528
QColor textColor = docsLabel->palette().color(QPalette::Text);
@@ -1138,7 +1144,14 @@ void Expert::filterChanged(const QString &text)
11381144
}
11391145
if (opt.docsLabel && opt.labelHighlighted)
11401146
{
1141-
opt.docsLabel->setText(SMALL_FONT_START + opt.docs + SMALL_FONT_END);
1147+
QString display = SMALL_FONT_START + SA("<b>") + opt.id + SA("</b>");
1148+
if (!opt.docs.isEmpty())
1149+
{
1150+
display += SA(" &mdash; ") + opt.docs;
1151+
}
1152+
display += SMALL_FONT_END;
1153+
opt.docsLabel->setText(display);
1154+
opt.input->setText(opt.id);
11421155
opt.labelHighlighted = false;
11431156
}
11441157
}
@@ -1177,6 +1190,7 @@ void Expert::filterChanged(const QString &text)
11771190
{
11781191
QString hiDocs = matchesDocs ? highlightInHtml(opt.docs, filter) : opt.docs;
11791192
QString hiId = matchesId ? highlightInHtml(opt.id, filter) : opt.id;
1193+
opt.input->setText(hiId);
11801194
QString display = SMALL_FONT_START + SA("<b>") + hiId + SA("</b>");
11811195
if (!opt.docs.isEmpty())
11821196
{

addon/doxywizard/input.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Input
4444
virtual bool isDefault() = 0;
4545
virtual void writeValue(QTextStream &t,TextCodecAdapter *codec,bool convert) = 0;
4646
virtual void setTemplateDocs(const QString &docs) = 0;
47+
virtual void setText(const QString &txt) = 0;
4748
virtual bool isEmpty() { return false; };
4849
};
4950

addon/doxywizard/inputbool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
#include "input.h"
1717
#include <QObject>
18+
#include <QLabel>
1819

1920
class QCheckBox;
2021
class QGridLayout;
21-
class QLabel;
2222

2323
class InputBool : public QObject, public Input
2424
{
@@ -41,6 +41,7 @@ class InputBool : public QObject, public Input
4141
bool isDefault();
4242
void writeValue(QTextStream &t,TextCodecAdapter *codec,bool convert);
4343
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
44+
void setText(const QString &txt) { m_lab->setText(txt); }
4445
static bool convertToBool(const QVariant &v,bool &isValid);
4546

4647
public slots:

addon/doxywizard/inputint.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
#include "input.h"
1717
#include <QObject>
18+
#include <QLabel>
1819

1920
class QGridLayout;
20-
class QLabel;
2121
class QSpinBox;
2222

2323
class InputInt : public QObject, public Input
@@ -44,6 +44,7 @@ class InputInt : public QObject, public Input
4444
bool isDefault();
4545
void writeValue(QTextStream &t,TextCodecAdapter *codec,bool convert);
4646
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
47+
void setText(const QString &txt) { m_lab->setText(txt); }
4748

4849
public slots:
4950
void reset();

addon/doxywizard/inputobsolete.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class InputObsolete : public Input
3232
bool isDefault() { return false; }
3333
void writeValue(QTextStream &,TextCodecAdapter *,bool) {}
3434
void setTemplateDocs(const QString &) {}
35+
void setText(const QString &txt) {}
3536
bool isEmpty() { return false; };
3637
Kind orgKind() const { return m_orgKind; }
3738
private:

addon/doxywizard/inputstring.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <QObject>
1919
#include <QMap>
2020
#include <QStringList>
21+
#include <QLabel>
2122

22-
class QLabel;
2323
class QLineEdit;
2424
class QToolBar;
2525
class QComboBox;
@@ -62,6 +62,7 @@ class InputString : public QObject, public Input
6262
bool isDefault();
6363
void writeValue(QTextStream &t,TextCodecAdapter *codec,bool convert);
6464
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
65+
void setText(const QString &txt) { m_lab->setText(txt); }
6566
bool isEmpty() { return m_str.isEmpty(); }
6667
QString checkEnumVal(const QString &value);
6768

addon/doxywizard/inputstrlist.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
#include <QObject>
1919
#include <QStringList>
20+
#include <QLabel>
2021

21-
class QLabel;
2222
class QLineEdit;
2323
class QPushButton;
2424
class QListWidget;
@@ -53,6 +53,7 @@ class InputStrList : public QObject, public Input
5353
bool isDefault();
5454
void writeValue(QTextStream &t,TextCodecAdapter *codec,bool convert);
5555
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
56+
void setText(const QString &txt) { m_lab->setText(txt); }
5657
bool isEmpty();
5758

5859
public slots:

0 commit comments

Comments
 (0)