This commit is contained in:
YiFang Xiao 2024-11-04 21:04:46 +08:00 committed by xiaoyifang
parent 5ef4190b75
commit 5954a5ce2a
2 changed files with 4 additions and 8 deletions

View file

@ -648,6 +648,7 @@ int DictGroupsWidget::addNewGroup( QString const & name )
Config::Group newGroup;
newGroup.id = nextId++;
newGroup.name = name;
const auto gr = new DictGroupWidget( this, *allDicts, newGroup );
const int idx = insertTab( currentIndex() + 1, gr, Utils::escapeAmps( name ) );
@ -909,15 +910,13 @@ void DictGroupsWidget::groupsByMetadata()
addGroupBasedOnMap( groupToDicts );
}
QString DictGroupsWidget::getCurrentGroupName() const
{
const int current = currentIndex();
if ( current >= 0 ) {
auto w = dynamic_cast< DictGroupWidget & >( *widget( current ) );
return w.name();
auto * w = dynamic_cast< DictGroupWidget * >( widget( current ) );
return w->name();
}
return {};
@ -928,7 +927,7 @@ void DictGroupsWidget::renameCurrentGroup( QString const & name )
const int current = currentIndex();
if ( current >= 0 ) {
auto w = dynamic_cast< DictGroupWidget & >( *widget( current ) );
auto * w = dynamic_cast< DictGroupWidget * >( widget( current ) );
w->setName( name );
setTabText( current, Utils::escapeAmps( name ) );
}

View file

@ -121,9 +121,6 @@ class DictGroupWidget: public QWidget
public:
DictGroupWidget( QWidget * parent, std::vector< sptr< Dictionary::Class > > const &, Config::Group const & );
/// Makes the group's configuration out of the data currently held.
/// Since the group's name is not part of the widget by design right now
/// (it is known by the containing tab widget only), it is returned as empty.
Config::Group makeGroup() const;
DictListModel * getModel() const