//! Displays list of words found in dictionaries
/*!
- It allow user to select word to see it's translation or to mark it as "star"
+ It allow user to select word to see it's translation or to mark or unmark
+ it as "star" (add/remove from bookmarks). It inherit from QTreeView
+ to allow display two columns, one with words and second with stars.
+ Star is normal checkable item. To get effect of star we need to set
+ style (WordListProxyStyle) for this widget.
*/
class WordListWidget : public QTreeView {
Q_OBJECT
void unlockList();
protected:
+ //! Reimplemented standard mouseReleaseEvent to check if user clicked on
+ //! word on it's star to emit suitable signal
void mouseReleaseEvent(QMouseEvent *event);
+
+ //! Resize the size of columns to assure that stars are always on right
+ //! side next to scroll bar
void resizeEvent(QResizeEvent *event);
private Q_SLOTS:
+ //! Emits signal to show translation of clicked item. Signal is emitted
+ //! only when word was clicked.
void wordClicked(QModelIndex index);
+
+ //! Emits signal to show add or remove word from bookmarks.
+ //! Signal is emitted only when star was clicked.
void wordChecked(QModelIndex index);
private:
+ //! Adds word to model. Row is row in the model
void addWord(QString word, int row);
+
QStandardItemModel* model;
+ //! Describes width of star checkbox in pixels
int checkBoxWidth;
+
+ //! Resizes sizes of colums after adding new words or after resize event.
void resizeColumns();
+ //! Association between words and their's translations
QHash<QString, QList<Translation*> > searchResult;
};