mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-04 07:54:06 +00:00
Favorites: Fix blocking of illegal move operations for Qt4 (issue #1059)
This commit is contained in:
parent
c55b32e32a
commit
5559b5fe48
|
@ -20,7 +20,7 @@
|
||||||
void FavoritesPaneWidget::setUp( Config::Class * cfg, QMenu * menu )
|
void FavoritesPaneWidget::setUp( Config::Class * cfg, QMenu * menu )
|
||||||
{
|
{
|
||||||
m_cfg = cfg;
|
m_cfg = cfg;
|
||||||
m_favoritesTree = findChild< QTreeView * >( "favoritesTree" );
|
m_favoritesTree = findChild< TreeView * >( "favoritesTree" );
|
||||||
QDockWidget * favoritesPane = qobject_cast< QDockWidget * >( parentWidget() );
|
QDockWidget * favoritesPane = qobject_cast< QDockWidget * >( parentWidget() );
|
||||||
m_favoritesTree->setHeaderHidden( true );
|
m_favoritesTree->setHeaderHidden( true );
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QTreeView>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -17,6 +16,7 @@
|
||||||
|
|
||||||
#include <config.hh>
|
#include <config.hh>
|
||||||
#include "delegate.hh"
|
#include "delegate.hh"
|
||||||
|
#include "treeview.hh"
|
||||||
|
|
||||||
class FavoritesModel;
|
class FavoritesModel;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
virtual bool eventFilter( QObject *, QEvent * );
|
virtual bool eventFilter( QObject *, QEvent * );
|
||||||
|
|
||||||
Config::Class * m_cfg ;
|
Config::Class * m_cfg ;
|
||||||
QTreeView * m_favoritesTree;
|
TreeView * m_favoritesTree;
|
||||||
QMenu * m_favoritesMenu;
|
QMenu * m_favoritesMenu;
|
||||||
QAction * m_deleteSelectedAction;
|
QAction * m_deleteSelectedAction;
|
||||||
QAction * m_separator;
|
QAction * m_separator;
|
||||||
|
|
|
@ -360,7 +360,8 @@ HEADERS += folding.hh \
|
||||||
gls.hh \
|
gls.hh \
|
||||||
splitfile.hh \
|
splitfile.hh \
|
||||||
favoritespanewidget.hh \
|
favoritespanewidget.hh \
|
||||||
cpp_features.hh
|
cpp_features.hh \
|
||||||
|
treeview.hh
|
||||||
|
|
||||||
FORMS += groups.ui \
|
FORMS += groups.ui \
|
||||||
dictgroupwidget.ui \
|
dictgroupwidget.ui \
|
||||||
|
@ -490,7 +491,8 @@ SOURCES += folding.cc \
|
||||||
ripemd.cc \
|
ripemd.cc \
|
||||||
gls.cc \
|
gls.cc \
|
||||||
splitfile.cc \
|
splitfile.cc \
|
||||||
favoritespanewidget.cc
|
favoritespanewidget.cc \
|
||||||
|
treeview.cc
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
FORMS += texttospeechsource.ui
|
FORMS += texttospeechsource.ui
|
||||||
|
|
|
@ -333,7 +333,7 @@
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="favoritesTree"/>
|
<widget class="TreeView" name="favoritesTree"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -704,6 +704,11 @@
|
||||||
<header>favoritespanewidget.hh</header>
|
<header>favoritespanewidget.hh</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>TreeView</class>
|
||||||
|
<extends>QTreeView</extends>
|
||||||
|
<header>treeview.hh</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>translateLine</tabstop>
|
<tabstop>translateLine</tabstop>
|
||||||
|
|
17
treeview.cc
Normal file
17
treeview.cc
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/* This file is (c) 2008-2018 Abs62
|
||||||
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||||
|
|
||||||
|
#include <QDropEvent>
|
||||||
|
#include "treeview.hh"
|
||||||
|
|
||||||
|
void TreeView::dropEvent( QDropEvent * event )
|
||||||
|
{
|
||||||
|
QTreeView::dropEvent( event );
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
// Qt 4 don't check success of drop operation. Add turnaround.
|
||||||
|
|
||||||
|
if( !event->isAccepted() )
|
||||||
|
event->setDropAction( Qt::IgnoreAction );
|
||||||
|
#endif
|
||||||
|
}
|
20
treeview.hh
Normal file
20
treeview.hh
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* This file is (c) 2008-2018 Abs62
|
||||||
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||||
|
|
||||||
|
#ifndef __TREEVIEW_HH__INCLUDED
|
||||||
|
#define __TREEVIEW_HH__INCLUDED
|
||||||
|
|
||||||
|
#include <QTreeView>
|
||||||
|
|
||||||
|
class TreeView : public QTreeView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TreeView( QWidget * parent = 0 ) :
|
||||||
|
QTreeView( parent )
|
||||||
|
{}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void dropEvent( QDropEvent * event );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TREEVIEW_HH
|
Loading…
Reference in a new issue