mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
fix: dictionaries order , dictionary icon size
This commit is contained in:
parent
5071b480c9
commit
3a50805cea
|
@ -38,28 +38,28 @@ void ArticleWebView::triggerPageAction( QWebEnginePage::WebAction action, bool c
|
|||
|
||||
QWebEngineView * ArticleWebView::createWindow( QWebEnginePage::WebWindowType type )
|
||||
{
|
||||
QMainWindow * dlg = new QMainWindow( this );
|
||||
QWebEngineView * view = new QWebEngineView( dlg );
|
||||
dlg->setCentralWidget(view);
|
||||
dlg->resize(400,400);
|
||||
dlg->show();
|
||||
if(type==QWebEnginePage::WebWindowType::WebDialog)
|
||||
{
|
||||
QMainWindow * dlg = new QMainWindow( this );
|
||||
QWebEngineView * view = new QWebEngineView( dlg );
|
||||
dlg->setCentralWidget(view);
|
||||
dlg->resize(400,400);
|
||||
dlg->show();
|
||||
|
||||
return view;
|
||||
return view;
|
||||
}
|
||||
return QWebEngineView::createWindow(type);
|
||||
}
|
||||
|
||||
bool ArticleWebView::event( QEvent * event )
|
||||
{
|
||||
if (event->type() == QEvent::ChildAdded) {
|
||||
QChildEvent *child_ev = static_cast<QChildEvent *>(event);
|
||||
if( event->type() == QEvent::ChildAdded )
|
||||
{
|
||||
QChildEvent * child_ev = static_cast< QChildEvent * >( event );
|
||||
child_ev->child()->installEventFilter( this );
|
||||
}
|
||||
|
||||
// // 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);
|
||||
}
|
||||
|
||||
return QWebEngineView::event(event);
|
||||
return QWebEngineView::event( event );
|
||||
}
|
||||
|
||||
void ArticleWebView::linkClickedInHtml(QUrl const& ){
|
||||
|
|
|
@ -261,7 +261,7 @@ QVariant DictListModel::data( QModelIndex const & index, int role ) const
|
|||
|
||||
case Qt::DecorationRole:
|
||||
// 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:;
|
||||
}
|
||||
|
|
10
instances.cc
10
instances.cc
|
@ -23,6 +23,7 @@ Group::Group( Config::Group const & cfgGroup,
|
|||
iconData = iconFromData( cfgGroup.iconData );
|
||||
|
||||
QMap<string, sptr< Dictionary::Class > > groupDicts;
|
||||
QVector<string> dictOrderList;
|
||||
|
||||
for( unsigned x = 0; x < (unsigned)cfgGroup.dictionaries.size(); ++x )
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ Group::Group( Config::Group const & cfgGroup,
|
|||
|
||||
if(allDictionaries.contains(id)){
|
||||
groupDicts.insert(id, allDictionaries[ id ] );
|
||||
dictOrderList.push_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,12 +41,14 @@ Group::Group( Config::Group const & cfgGroup,
|
|||
set< string > inactiveSet;
|
||||
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