Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Nov 4, 2024
1 parent c1327f1 commit 35ba6a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/ui/groups_widgets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 {};
Expand All @@ -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 ) );
}
Expand Down
3 changes: 0 additions & 3 deletions src/ui/groups_widgets.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35ba6a9

Please sign in to comment.