Refactor New Tab Button

Set proper size. Added new persistent new tab button.
This commit is contained in:
ShaopengLin 2024-09-14 22:40:33 -04:00
parent e84f60b2e7
commit 999f37fcb3
4 changed files with 31 additions and 4 deletions

View File

@ -201,12 +201,13 @@ QTabBar::tab:first {
border-radius: 3px;
}
#nextTabButton, #prevTabButton {
#nextTabButton, #prevTabButton, #newTabSideButton {
border: 1px solid #ccc;
}
#closeTabButton:hover, #newTabButton:hover,
#nextTabButton:hover, #prevTabButton:hover{
#nextTabButton:hover, #prevTabButton:hover,
#newTabSideButton:hover {
border: 1px solid #3366CC;
background-color: #D9E9FF;
border-radius: 3px;

View File

@ -27,6 +27,7 @@ MainWindow::MainWindow(QWidget *parent) :
addAction(app->getAction(KiwixApp::NextTabAction));
addAction(app->getAction(KiwixApp::PreviousTabAction));
mp_ui->newTabSideButton->setDefaultAction(app->getAction(KiwixApp::NewTabAction));
mp_ui->nextTabButton->setDefaultAction(app->getAction(KiwixApp::ScrollNextTabAction));
mp_ui->prevTabButton->setDefaultAction(app->getAction(KiwixApp::ScrollPreviousTabAction));

View File

@ -252,7 +252,7 @@ QSize TabBar::tabSizeHint(int index) const
{
QWidget *w = mp_stackedWidget->widget(index);
if (w && qobject_cast<ContentManagerView*>(w))
if ((w && qobject_cast<ContentManagerView*>(w)) || index >= count() - 1)
return QSize(40, 40); // the "Library" tab is only icon
return QSize(205, 40); // "Settings" and content tabs have text

View File

@ -71,6 +71,29 @@
<item>
<widget class="TabBar" name="tabBar" native="true"/>
</item>
<item>
<widget class="QToolButton" name="newTabSideButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/kiwix.qrc">
<normaloff>:/icons/new-tab-icon.svg</normaloff>:/icons/new-tab-icon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="nextTabButton">
<property name="maximumSize">
@ -179,6 +202,8 @@
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../resources/kiwix.qrc"/>
</resources>
<connections/>
</ui>