mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 03:14:06 +00:00
fix: dictionaries order , dictionary icon size
This commit is contained in:
parent
5071b480c9
commit
3a50805cea
|
@ -37,6 +37,8 @@ void ArticleWebView::triggerPageAction( QWebEnginePage::WebAction action, bool c
|
||||||
}
|
}
|
||||||
|
|
||||||
QWebEngineView * ArticleWebView::createWindow( QWebEnginePage::WebWindowType type )
|
QWebEngineView * ArticleWebView::createWindow( QWebEnginePage::WebWindowType type )
|
||||||
|
{
|
||||||
|
if(type==QWebEnginePage::WebWindowType::WebDialog)
|
||||||
{
|
{
|
||||||
QMainWindow * dlg = new QMainWindow( this );
|
QMainWindow * dlg = new QMainWindow( this );
|
||||||
QWebEngineView * view = new QWebEngineView( dlg );
|
QWebEngineView * view = new QWebEngineView( dlg );
|
||||||
|
@ -46,16 +48,14 @@ QWebEngineView * ArticleWebView::createWindow( QWebEnginePage::WebWindowType typ
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
return QWebEngineView::createWindow(type);
|
||||||
|
}
|
||||||
|
|
||||||
bool ArticleWebView::event( QEvent * event )
|
bool ArticleWebView::event( QEvent * event )
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::ChildAdded) {
|
if( event->type() == QEvent::ChildAdded )
|
||||||
|
{
|
||||||
QChildEvent * child_ev = static_cast< QChildEvent * >( event );
|
QChildEvent * child_ev = static_cast< QChildEvent * >( event );
|
||||||
|
|
||||||
// // there is also QObject child that should be ignored here;
|
|
||||||
// // use only QOpenGLWidget child
|
|
||||||
// QOpenGLWidget *w = static_cast<QOpenGLWidget*>(child_ev->child());
|
|
||||||
|
|
||||||
child_ev->child()->installEventFilter( this );
|
child_ev->child()->installEventFilter( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ QVariant DictListModel::data( QModelIndex const & index, int role ) const
|
||||||
|
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
// make all icons of the same size to avoid visual size/alignment problems
|
// make all icons of the same size to avoid visual size/alignment problems
|
||||||
return item->getIcon().pixmap( 32 ).scaledToHeight( 21, Qt::SmoothTransformation );
|
return item->getIcon();
|
||||||
|
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
|
10
instances.cc
10
instances.cc
|
@ -23,6 +23,7 @@ Group::Group( Config::Group const & cfgGroup,
|
||||||
iconData = iconFromData( cfgGroup.iconData );
|
iconData = iconFromData( cfgGroup.iconData );
|
||||||
|
|
||||||
QMap<string, sptr< Dictionary::Class > > groupDicts;
|
QMap<string, sptr< Dictionary::Class > > groupDicts;
|
||||||
|
QVector<string> dictOrderList;
|
||||||
|
|
||||||
for( unsigned x = 0; x < (unsigned)cfgGroup.dictionaries.size(); ++x )
|
for( unsigned x = 0; x < (unsigned)cfgGroup.dictionaries.size(); ++x )
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,7 @@ Group::Group( Config::Group const & cfgGroup,
|
||||||
|
|
||||||
if(allDictionaries.contains(id)){
|
if(allDictionaries.contains(id)){
|
||||||
groupDicts.insert(id, allDictionaries[ id ] );
|
groupDicts.insert(id, allDictionaries[ id ] );
|
||||||
|
dictOrderList.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +41,14 @@ Group::Group( Config::Group const & cfgGroup,
|
||||||
set< string > inactiveSet;
|
set< string > inactiveSet;
|
||||||
for( int i = 0; i < inactiveGroup.dictionaries.size(); i++ )
|
for( int i = 0; i < inactiveGroup.dictionaries.size(); i++ )
|
||||||
{
|
{
|
||||||
groupDicts.remove(inactiveGroup.dictionaries[ i ].id.toStdString());
|
string id=inactiveGroup.dictionaries[ i ].id.toStdString();
|
||||||
|
groupDicts.remove(id);
|
||||||
|
dictOrderList.removeOne(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(const auto & dict : groupDicts)
|
for(const auto & dictId : dictOrderList)
|
||||||
{
|
{
|
||||||
dictionaries.push_back(dict);
|
dictionaries.push_back(groupDicts[dictId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue