mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
Merge commit 'refs/merge-requests/15' of git://gitorious.org/goldendict/goldendict
This commit is contained in:
commit
b8b7bffb13
|
@ -499,6 +499,18 @@ bool ArticleView::eventFilter( QObject * obj, QEvent * ev )
|
||||||
{
|
{
|
||||||
if ( obj == ui.definition )
|
if ( obj == ui.definition )
|
||||||
{
|
{
|
||||||
|
if ( ev->type() == QEvent::MouseButtonPress ) {
|
||||||
|
QMouseEvent * event = static_cast< QMouseEvent * >( ev );
|
||||||
|
if ( event->button() == Qt::XButton1 ) {
|
||||||
|
back();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ( event->button() == Qt::XButton2 ) {
|
||||||
|
forward();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
if ( ev->type() == QEvent::KeyPress )
|
if ( ev->type() == QEvent::KeyPress )
|
||||||
{
|
{
|
||||||
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
|
QKeyEvent * keyEvent = static_cast< QKeyEvent * >( ev );
|
||||||
|
|
|
@ -377,7 +377,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
|
|
||||||
ui.translateLine->installEventFilter( this );
|
ui.translateLine->installEventFilter( this );
|
||||||
ui.wordList->installEventFilter( this );
|
ui.wordList->installEventFilter( this );
|
||||||
ui.dictsList->installEventFilter(this);
|
ui.wordList->viewport()->installEventFilter( this );
|
||||||
|
ui.dictsList->installEventFilter( this );
|
||||||
|
ui.dictsList->viewport()->installEventFilter( this );
|
||||||
|
|
||||||
if ( cfg.mainWindowGeometry.size() )
|
if ( cfg.mainWindowGeometry.size() )
|
||||||
restoreGeometry( cfg.mainWindowGeometry );
|
restoreGeometry( cfg.mainWindowGeometry );
|
||||||
|
@ -450,10 +452,17 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
|
|
||||||
void MainWindow::mousePressEvent( QMouseEvent *event)
|
void MainWindow::mousePressEvent( QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (handleBackForwardMouseButtons( event ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event->button() != Qt::MidButton)
|
if (event->button() != Qt::MidButton)
|
||||||
return QMainWindow::mousePressEvent(event);
|
return QMainWindow::mousePressEvent(event);
|
||||||
|
|
||||||
// middle clicked
|
// middle clicked
|
||||||
QString subtype = "plain";
|
QString subtype = "plain";
|
||||||
|
|
||||||
QString str = QApplication::clipboard()->text(subtype,
|
QString str = QApplication::clipboard()->text(subtype,
|
||||||
QClipboard::Selection);
|
QClipboard::Selection);
|
||||||
|
@ -1381,8 +1390,27 @@ void MainWindow::applyMutedDictionariesState()
|
||||||
view.updateMutedContents();
|
view.updateMutedContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::handleBackForwardMouseButtons ( QMouseEvent * event) {
|
||||||
|
if ( event->button() == Qt::XButton1 ) {
|
||||||
|
backClicked();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( event->button() == Qt::XButton2 ) {
|
||||||
|
forwardClicked();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
||||||
{
|
{
|
||||||
|
if ( ev->type() == QEvent::MouseButtonPress ) {
|
||||||
|
QMouseEvent * event = static_cast< QMouseEvent * >( ev );
|
||||||
|
return handleBackForwardMouseButtons( event );
|
||||||
|
}
|
||||||
|
|
||||||
if ( obj == ui.translateLine )
|
if ( obj == ui.translateLine )
|
||||||
{
|
{
|
||||||
if ( ev->type() == /*QEvent::KeyPress*/ 6 )
|
if ( ev->type() == /*QEvent::KeyPress*/ 6 )
|
||||||
|
|
|
@ -151,6 +151,9 @@ private:
|
||||||
|
|
||||||
void updateCurrentGroupProperty();
|
void updateCurrentGroupProperty();
|
||||||
|
|
||||||
|
/// Handles backward and forward mouse buttons and
|
||||||
|
/// returns true if the event is handled.
|
||||||
|
bool handleBackForwardMouseButtons(QMouseEvent *ev);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue