2012-12-24 11:30:03 +00:00
|
|
|
/* This file is (c) 2012 Tvangeste <i.4m.l33t@yandex.ru>
|
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
2024-11-07 03:53:04 +00:00
|
|
|
#pragma once
|
2012-12-24 11:30:03 +00:00
|
|
|
|
2023-03-05 22:41:42 +00:00
|
|
|
#include <QLineEdit>
|
2012-12-24 11:30:03 +00:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QListWidget>
|
|
|
|
#include <QFocusEvent>
|
2023-06-05 13:22:20 +00:00
|
|
|
#include <QCompleter>
|
2012-12-24 11:30:03 +00:00
|
|
|
|
|
|
|
class TranslateBox: public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-06-05 13:22:20 +00:00
|
|
|
explicit TranslateBox( QWidget * parent = nullptr );
|
2012-12-24 11:30:03 +00:00
|
|
|
QLineEdit * translateLine();
|
2023-06-05 13:22:20 +00:00
|
|
|
QWidget * completerWidget();
|
|
|
|
void setText( const QString & text, bool showPopup = true );
|
|
|
|
void setSizePolicy( QSizePolicy policy );
|
|
|
|
void setSizePolicy( QSizePolicy::Policy hor, QSizePolicy::Policy ver );
|
2012-12-24 11:30:03 +00:00
|
|
|
|
2023-06-05 13:22:20 +00:00
|
|
|
void setModel( QStringList & _words );
|
2012-12-24 11:30:03 +00:00
|
|
|
|
|
|
|
public slots:
|
2013-01-17 09:08:53 +00:00
|
|
|
void setPopupEnabled( bool enable );
|
2012-12-24 11:30:03 +00:00
|
|
|
|
2023-09-10 09:52:18 +00:00
|
|
|
signals:
|
|
|
|
void returnPressed();
|
|
|
|
|
2012-12-24 11:30:03 +00:00
|
|
|
private slots:
|
|
|
|
void showPopup();
|
|
|
|
void rightButtonClicked();
|
|
|
|
|
|
|
|
private:
|
2023-03-05 22:41:42 +00:00
|
|
|
QLineEdit * translate_line;
|
2013-01-17 09:08:53 +00:00
|
|
|
bool m_popupEnabled;
|
2023-06-05 13:22:20 +00:00
|
|
|
QCompleter * completer;
|
|
|
|
QStringList words;
|
2012-12-24 11:30:03 +00:00
|
|
|
};
|