mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +00:00
opt: group widget remove all tabs (#892)
* opt: remove all group widget tabs * 🎨 apply clang-format changes * opt: does not elide text on tab name * 🎨 apply clang-format changes --------- Co-authored-by: xiaoyifang <xiaoyifang@users.noreply.github.com>
This commit is contained in:
parent
04a58d6418
commit
ef594117c3
|
@ -126,7 +126,7 @@
|
||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="elideMode">
|
<property name="elideMode">
|
||||||
<enum>Qt::ElideRight</enum>
|
<enum>Qt::ElideNone</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_4">
|
<widget class="QWidget" name="tab_4">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|
|
@ -551,6 +551,9 @@ DictGroupsWidget::DictGroupsWidget( QWidget * parent ):
|
||||||
setMovable( true );
|
setMovable( true );
|
||||||
setContextMenuPolicy( Qt::CustomContextMenu );
|
setContextMenuPolicy( Qt::CustomContextMenu );
|
||||||
connect( this, &QWidget::customContextMenuRequested, this, &DictGroupsWidget::contextMenu );
|
connect( this, &QWidget::customContextMenuRequested, this, &DictGroupsWidget::contextMenu );
|
||||||
|
|
||||||
|
setElideMode( Qt::ElideNone );
|
||||||
|
setUsesScrollButtons( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -575,8 +578,7 @@ void DictGroupsWidget::populate( Config::Groups const & groups,
|
||||||
vector< sptr< Dictionary::Class > > const & allDicts_,
|
vector< sptr< Dictionary::Class > > const & allDicts_,
|
||||||
vector< sptr< Dictionary::Class > > const & activeDicts_ )
|
vector< sptr< Dictionary::Class > > const & activeDicts_ )
|
||||||
{
|
{
|
||||||
while( count() )
|
removeAllGroups();
|
||||||
removeCurrentGroup();
|
|
||||||
|
|
||||||
allDicts = &allDicts_;
|
allDicts = &allDicts_;
|
||||||
activeDicts = &activeDicts_;
|
activeDicts = &activeDicts_;
|
||||||
|
@ -597,8 +599,6 @@ void DictGroupsWidget::populate( Config::Groups const & groups,
|
||||||
nextId = groups.nextId;
|
nextId = groups.nextId;
|
||||||
|
|
||||||
setCurrentIndex( 0 );
|
setCurrentIndex( 0 );
|
||||||
|
|
||||||
setUsesScrollButtons( count() > 3 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates groups from what is currently set up
|
/// Creates groups from what is currently set up
|
||||||
|
@ -666,8 +666,6 @@ void DictGroupsWidget::addNewGroup( QString const & name )
|
||||||
QString toolTipStr = "\"" + tabText( idx ) + "\"\n" + tr( "Dictionaries: " )
|
QString toolTipStr = "\"" + tabText( idx ) + "\"\n" + tr( "Dictionaries: " )
|
||||||
+ QString::number( getCurrentModel()->getCurrentDictionaries().size() );
|
+ QString::number( getCurrentModel()->getCurrentDictionaries().size() );
|
||||||
setTabToolTip( idx, toolTipStr );
|
setTabToolTip( idx, toolTipStr );
|
||||||
|
|
||||||
setUsesScrollButtons( count() > 3 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DictGroupsWidget::addUniqueGroup( const QString & name )
|
int DictGroupsWidget::addUniqueGroup( const QString & name )
|
||||||
|
@ -950,8 +948,6 @@ void DictGroupsWidget::removeCurrentGroup()
|
||||||
removeTab( current );
|
removeTab( current );
|
||||||
delete w;
|
delete w;
|
||||||
}
|
}
|
||||||
|
|
||||||
setUsesScrollButtons( count() > 3 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DictGroupsWidget::removeAllGroups()
|
void DictGroupsWidget::removeAllGroups()
|
||||||
|
|
Loading…
Reference in a new issue