blob: c67ebe46965bfe83bafbca1c3cacb23114ded693 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef CARDSIDEVIEW_H
#define CARDSIDEVIEW_H
#include <QLabel>
class CardPack;
class FieldStyle;
class Field;
class CardSideView : public QLabel
{
Q_OBJECT
public:
CardSideView( bool aMode = QstMode );
void setPack( const CardPack* pack );
void setQstAnsr( const QString aQuestion, const QStringList aAnswers );
void setQuestion( const QString aQuestion );
void setShowMode( bool aMode );
QSize sizeHint() const;
QString getFormattedText() const;
void showNewIcon(bool visible);
public:
static const bool QstMode = true;
static const bool AnsMode = false;
public slots:
void setEnabled( bool aEnabled );
protected:
void resizeEvent(QResizeEvent* event);
private:
void updateText();
void setBackgroundVisible( bool aVisible );
QString formattedField( const QString aField, const QString aStyle ) const;
QString highlightKeyword( const QString aText, const FieldStyle& fieldStyle ) const;
QString getHighlighting(const FieldStyle& fieldStyle) const;
QString getFormattedQuestion() const;
QString getFormattedAnswer() const;
QString getFormattedAnswerField(const Field* field, int index) const;
void updateNewIconPos();
private:
bool m_showMode;
const CardPack* cardPack;
QString m_question;
QStringList m_answers;
QLabel* newIcon;
};
#endif
|