mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Correctly style the first tab (contentManager)
It would be nice to be able to style it using css (QTabBar::tab:first) but I can't figure how :/ We need to : - hardcore the size of the tabs using `tabSizeHint`. - "deactivate" the tab button with `setTabButton` - set the size of the icons. Fix #73
This commit is contained in:
parent
4b9cc80f66
commit
3f9072f978
@ -123,10 +123,6 @@ QTabWidget::pane {
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
min-width: 205px;
|
||||
max-width: 205px;
|
||||
min-height: 40px;
|
||||
max-height: 40px;
|
||||
border: none;
|
||||
border-right: 2px solid #ccc;
|
||||
border-bottom: 2px solid #ccc;
|
||||
|
@ -15,6 +15,7 @@ TabBar::TabBar(QWidget *parent) :
|
||||
setElideMode(Qt::ElideNone);
|
||||
setDocumentMode(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
setIconSize(QSize(30, 30));
|
||||
connect(this, &QTabBar::tabCloseRequested, this, &TabBar::closeTab);
|
||||
connect(this, &QTabBar::currentChanged, this, &TabBar::onCurrentChanged);
|
||||
auto app = KiwixApp::instance();
|
||||
@ -76,6 +77,7 @@ void TabBar::setContentManagerView(ContentManagerView* view)
|
||||
mp_stackedWidget->addWidget(mp_contentManagerView);
|
||||
mp_stackedWidget->show();
|
||||
addTab(QIcon(":/icons/kiwix/app_icon.svg"), "");
|
||||
setTabButton(0, RightSide, nullptr);
|
||||
}
|
||||
|
||||
WebView* TabBar::createNewTab(bool setCurrent)
|
||||
@ -152,6 +154,12 @@ QString TabBar::currentArticleTitle()
|
||||
return currentWidget()->title();
|
||||
}
|
||||
|
||||
QSize TabBar::tabSizeHint(int index) const {
|
||||
if (index)
|
||||
return QSize(205, 40);
|
||||
return QSize(40, 40);
|
||||
}
|
||||
|
||||
void TabBar::triggerWebPageAction(QWebEnginePage::WebAction action, WebView *webView)
|
||||
{
|
||||
CURRENTIFNULL(webView);
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
void triggerWebPageAction(QWebEnginePage::WebAction action, WebView* webView=nullptr);
|
||||
QString currentArticleUrl();
|
||||
QString currentArticleTitle();
|
||||
virtual QSize tabSizeHint(int index) const;
|
||||
signals:
|
||||
void webActionEnabledChanged(QWebEnginePage::WebAction action, bool enabled);
|
||||
void currentZimIdChanged(const QString& zimId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user