opt: make the searchPanel can resize to a smaller width

🎨 apply clang-format changes

opt: make the searchPanel can resize to a smaller width

🎨 apply clang-format changes

fix:remove group label in docker
This commit is contained in:
YiFang Xiao 2023-05-23 07:50:37 +08:00
parent 58654a687a
commit a8b6fbc754
4 changed files with 27 additions and 26 deletions

View file

@ -40,7 +40,7 @@ protected:
/// Work around the never-changing QComboBox::minimumSizeHint(), which prevents
/// reducing the width of a group combobox beyond the value at application start.
virtual QSize minimumSizeHint() const { return sizeHint(); }
// virtual QSize minimumSizeHint() const { return sizeHint(); }
private slots:

View file

@ -107,7 +107,7 @@ void MainWindow::changeWebEngineViewFont()
MainWindow::MainWindow( Config::Class & cfg_ ):
trayIcon( 0 ),
groupLabel( &searchPaneTitleBar ),
// groupLabel( &searchPaneTitleBar ),
foundInDictsLabel( &dictsPaneTitleBar ),
escAction( this ),
focusTranslateLineAction( this ),
@ -129,21 +129,24 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
history( History::Load(), cfg_.preferences.maxStringsInHistory, cfg_.maxHeadwordSize ),
dictionaryBar( this, configEvents, cfg.editDictionaryCommandLine, cfg.preferences.maxDictionaryRefsInContextMenu ),
articleMaker( dictionaries, groupInstances, cfg.preferences ),
articleNetMgr( this, dictionaries, articleMaker,
cfg.preferences.disallowContentFromOtherSites, cfg.preferences.hideGoldenDictHeader ),
articleNetMgr( this,
dictionaries,
articleMaker,
cfg.preferences.disallowContentFromOtherSites,
cfg.preferences.hideGoldenDictHeader ),
dictNetMgr( this ),
audioPlayerFactory( cfg.preferences ),
wordFinder( this ),
newReleaseCheckTimer( this ),
latestReleaseReply( 0 ),
wordListSelChanged( false )
, wasMaximized( false )
, blockUpdateWindowTitle( false )
, headwordsDlg( 0 )
, ftsIndexing( dictionaries )
, ftsDlg( 0 )
, starIcon( ":/icons/star.svg" )
, blueStarIcon( ":/icons/star_blue.svg" )
wordListSelChanged( false ),
wasMaximized( false ),
blockUpdateWindowTitle( false ),
headwordsDlg( 0 ),
ftsIndexing( dictionaries ),
ftsDlg( 0 ),
starIcon( ":/icons/star.svg" ),
blueStarIcon( ":/icons/star_blue.svg" )
{
if( QThreadPool::globalInstance()->maxThreadCount() < MIN_THREAD_COUNT )
QThreadPool::globalInstance()->setMaxThreadCount( MIN_THREAD_COUNT );
@ -304,11 +307,11 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
menuButtonAction->setVisible( cfg.preferences.hideMenubar );
// Make the search pane's titlebar
groupLabel.setText( tr( "Look up in:" ) );
// groupLabel.setText( tr( "Look up in:" ) );
groupListInDock = new GroupComboBox( &searchPaneTitleBar );
searchPaneTitleBarLayout.setContentsMargins( 8, 5, 8, 4 );
searchPaneTitleBarLayout.addWidget( &groupLabel );
// searchPaneTitleBarLayout.addWidget( &groupLabel );
searchPaneTitleBarLayout.addWidget( groupListInDock );
searchPaneTitleBarLayout.addStretch();
@ -1471,7 +1474,7 @@ void MainWindow::updateGroupList()
groupList->setVisible( haveGroups );
groupLabel.setText( haveGroups ? tr( "Look up in:" ) : tr( "Look up:" ) );
// groupLabel.setText( haveGroups ? tr( "Look up in:" ) : tr( "Look up:" ) );
// currentIndexChanged() signal is very trigger-happy. To avoid triggering
// it, we disconnect it while we're clearing and filling back groups.

View file

@ -70,7 +70,7 @@
<x>0</x>
<y>0</y>
<width>653</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -186,12 +186,6 @@
</property>
<item>
<widget class="QLineEdit" name="translateLine">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="frame">
<bool>true</bool>
</property>

View file

@ -12,12 +12,16 @@ class SearchPaneWidget: public QWidget
{
public:
SearchPaneWidget( QWidget * parent = 0 ): QWidget( parent )
{}
SearchPaneWidget( QWidget * parent = nullptr ):
QWidget( parent )
{
setSizePolicy( QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Expanding );
}
virtual QSize sizeHint() const
{ return QSize( 204, 204 ); }
{
return QSize( 10, 204 );
}
};
#endif