mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +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 )
|
||||
{
|
||||
m_cfg = cfg;
|
||||
m_favoritesTree = findChild< QTreeView * >( "favoritesTree" );
|
||||
m_favoritesTree = findChild< TreeView * >( "favoritesTree" );
|
||||
QDockWidget * favoritesPane = qobject_cast< QDockWidget * >( parentWidget() );
|
||||
m_favoritesTree->setHeaderHidden( true );
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <QWidget>
|
||||
#include <QSize>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QTreeView>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMenu>
|
||||
|
@ -17,6 +16,7 @@
|
|||
|
||||
#include <config.hh>
|
||||
#include "delegate.hh"
|
||||
#include "treeview.hh"
|
||||
|
||||
class FavoritesModel;
|
||||
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
virtual bool eventFilter( QObject *, QEvent * );
|
||||
|
||||
Config::Class * m_cfg ;
|
||||
QTreeView * m_favoritesTree;
|
||||
TreeView * m_favoritesTree;
|
||||
QMenu * m_favoritesMenu;
|
||||
QAction * m_deleteSelectedAction;
|
||||
QAction * m_separator;
|
||||
|
|
|
@ -360,7 +360,8 @@ HEADERS += folding.hh \
|
|||
gls.hh \
|
||||
splitfile.hh \
|
||||
favoritespanewidget.hh \
|
||||
cpp_features.hh
|
||||
cpp_features.hh \
|
||||
treeview.hh
|
||||
|
||||
FORMS += groups.ui \
|
||||
dictgroupwidget.ui \
|
||||
|
@ -490,7 +491,8 @@ SOURCES += folding.cc \
|
|||
ripemd.cc \
|
||||
gls.cc \
|
||||
splitfile.cc \
|
||||
favoritespanewidget.cc
|
||||
favoritespanewidget.cc \
|
||||
treeview.cc
|
||||
|
||||
win32 {
|
||||
FORMS += texttospeechsource.ui
|
||||
|
|
|
@ -333,7 +333,7 @@
|
|||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeView" name="favoritesTree"/>
|
||||
<widget class="TreeView" name="favoritesTree"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -704,6 +704,11 @@
|
|||
<header>favoritespanewidget.hh</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>treeview.hh</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<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