Merge pull request #874 from ONLYOFFICE/feature/custom_tabbar

Add custom tabbar
This commit is contained in:
Oleg Kozhukharenko
2023-06-22 11:44:33 +03:00
committed by GitHub
12 changed files with 1269 additions and 1509 deletions

View File

@ -71,7 +71,6 @@ HEADERS += \
$$PWD/src/windows/ceditorwindow_p.h \
$$PWD/src/windows/cpresenterwindow.h \
$$PWD/src/components/asctabwidget.h \
$$PWD/src/components/ctabbarwrapper.h \
$$PWD/src/components/cdownloadwidget.h \
$$PWD/src/components/cpushbutton.h \
$$PWD/src/components/cfiledialog.h \
@ -122,7 +121,6 @@ SOURCES += \
$$PWD/src/components/cpushbutton.cpp \
$$PWD/src/components/cfiledialog.cpp \
$$PWD/src/components/cprintprogress.cpp \
$$PWD/src/components/ctabbarwrapper.cpp \
$$PWD/src/components/ctabbar.cpp \
$$PWD/src/components/cmessage.cpp \
$$PWD/src/components/canimatedicon.cpp \

View File

@ -1,275 +1,225 @@
CTabBar {background: #f1f1f1;}
CTabBar #tabArea {background: transparent;}
QTabWidget::pane {background-color: #f1f1f1; border: none; padding: 0px;}
QLabel[class=tab-icon] {padding:0 0 2px 4px;}
QTabBar {font-size: 11px; font-family: "Arial", "Helvetica", "Helvetica Neue", sans-serif; background-color: #f1f1f1;}
QTabBar::tear {width: 0px;}
QTabBar::scroller {width: 0px;}
QTabBar::tab {min-width: 41px; max-width: 135px; width: 135px; height: 28px; background-color: #f1f1f1; border: 0 none;
border-right: 1px solid #a5a5a5; margin: 0 0 0 0; padding: 0px;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
QTabBar::tab:first {}
QTabBar::tab:only-one {}
QTabBar::tab:last {}
QTabBar::tab::selected {padding-left: 0px;}
QTabBar[active=false]::tab:selected {background-color: #f1f1f1;}
QTabBar[active=true]::tab:selected {background-color: #f1f1f1;}
QTabBar[active=false]::tab:selected:hover {background-color: #cecece;}
CTabBar #tabScroll {border: none; background: transparent;}
CTabBar #tabScroll>QToolButton {margin: 0px; border: none; background: #f1f1f1;}
CTabBar #tabScroll>QToolButton:hover {background: #cecece;}
CTabBar #tabScroll>QToolButton:pressed {background: #b7b7b7;}
CTabBar #tabScroll>#leftButton {image: url(:/tabbar/icons/scrolltab_ln.svg);}
CTabBar #tabScroll>#leftButton:disabled {image: url(:/tabbar/icons/scrolltab_ld.svg);}
CTabBar #tabScroll>#leftButton:hover {image: url(:/tabbar/icons/scrolltab_lh.svg);}
CTabBar #tabScroll>#leftButton:pressed {image: url(:/tabbar/icons/scrolltab_lp.svg);}
QTabBar::close-button {
image: url(:/res/icons/tab_close_normal.svg);
margin-top: -1px;
icon-size:16px;
}
QTabBar::close-button:hover {
image: url(:/res/icons/tab_close_hover.svg);
}
QTabBar::close-button:pressed {
image: url(:/res/icons/tab_close_active.svg);
}
CTabBar #tabScroll>#rightButton {image: url(:/tabbar/icons/scrolltab_rn.svg);}
CTabBar #tabScroll>#rightButton:disabled {image: url(:/tabbar/icons/scrolltab_rd.svg);}
CTabBar #tabScroll>#rightButton:hover {image: url(:/tabbar/icons/scrolltab_rh.svg);}
CTabBar #tabScroll>#rightButton:pressed {image: url(:/tabbar/icons/scrolltab_rp.svg);}
QTabBar QToolButton,
QTabBar QToolButton:disabled {
background-color:#f1f1f1;
border:0 none;
width: 40px;
}
Tab {background: #f1f1f1; border: none; border-right: 1px solid #dfdfdf; margin: 0px; padding: 0px;}
Tab #tabIcon {background: transparent; /*image: url(:/tabbar/icons/res/icons/tabicon_oform_normal.svg);*/}
Tab #tabText {color: #444; background: transparent; font-family: "Arial", "Helvetica", "Helvetica Neue", sans-serif;}
Tab #tabButton {border: none; margin-top: 0px; image: none; background: transparent;}
QTabBar QToolButton[class=tab-close]{
background-color:rgba(255,255,255,0);
}
QTabBar QToolButton[class=tab-close]{
image: url(:/tabbar/icons/close_normal.svg);
}
QTabBar QToolButton[class=tab-close][state=active]{
image:url(:/tabbar/icons/close_active_normal.svg);
}
QTabBar QToolButton[class=tab-close]:hover{
image: url(:/tabbar/icons/close_hover.svg);
}
QTabBar QToolButton[class=tab-close][state=active]:hover{
image: url(:/tabbar/icons/close_active_hover.svg);
}
QTabBar QToolButton[class=tab-close]:pressed{
image: url(:/tabbar/icons/close_pressed.svg);
}
QTabBar QToolButton[class=tab-close][state=active]:pressed{
image: url(:/tabbar/icons/close_active_pressed.svg);
}
Tab[selected=true] {background: #446995; border-color: #446995;}
Tab[selected=true] #tabText {color: #fff;}
Tab[selected=true] #tabButton {image:url(:/tabbar/icons/close_active_normal.svg); /*background: #446995;*/}
Tab[selected=true] #tabButton:hover {image: url(:/tabbar/icons/close_active_hover.svg);}
Tab[selected=true] #tabButton:pressed {image: url(:/tabbar/icons/close_active_pressed.svg);}
#tabWrapper {margin: 0; padding: 0; background: #f1f1f1;}
#paddingWidget {min-width: 0px; max-width: 0px; border: none; background: transparent;}
CTabBar[active=false] Tab[selected=true] {background: #f1f1f1; border-color: #dfdfdf;}
CTabBar[active=false] Tab[selected=true] #tabText {color: #444;}
CTabBar[active=false] Tab[selected=true] #tabButton {image: none; /*background: #f1f1f1;*/}
#scrollerFrame {min-width: 32px; max-width: 32px; border: none; background: transparent;}
#scrollerFrame>QToolButton {max-height: 28px; margin: 0px; border: none; background-color: #f1f1f1;}
#scrollerFrame>QToolButton:hover {background-color: #cecece;}
#scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}
#scrollerFrame>QToolButton#leftButton {
image: url(:/tabbar/icons/scrolltab_ln.svg) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld.svg) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh.svg) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp.svg) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn.svg) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd.svg) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh.svg) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp.svg) center no-repeat;
}
Tab[selected=false][hovered=true],
CTabBar[active=false] Tab[selected=true][hovered=true] {background: #cecece;}
Tab[selected=false][hovered=true] #tabButton,
CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton {image: url(:/tabbar/icons/close_normal.svg); /*background: #cecece;*/}
Tab[selected=false][hovered=true] #tabButton:hover,
CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton:hover {image: url(:/tabbar/icons/close_hover.svg);}
Tab[selected=false][hovered=true] #tabButton:pressed,
CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton:pressed {image: url(:/tabbar/icons/close_pressed.svg);}
/* light */
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
#mainPanel[uitheme=theme-light] Tab {border-right-color: #dfdfdf;}
/* classic light */
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#mainPanel[uitheme=theme-classic-light] Tab {border-right-color: #cbcbcb;}
/* dark */
#mainPanel[uitheme=theme-dark] QTabBar,
#mainPanel[uitheme=theme-dark] #tabWrapper {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabBar QToolButton::left-arrow,
#mainPanel[uitheme=theme-dark] QTabBar QToolButton::right-arrow {background-color: #606060;}
#mainPanel[uitheme=theme-dark] QTabBar QToolButton:pressed {background-color: #606060;}
#mainPanel[uitheme=theme-dark] QTabWidget::pane {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabBar::tab {background-color: #404040; border-right-color: #505050;}
#mainPanel[uitheme=theme-dark] QTabBar::tab:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] QTabBar::tab:selected {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabBar[active=false]::tab:selected:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton {background-color: #404040;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #606060;}
#mainPanel[uitheme=theme-dark] CTabBar {background: #404040;}
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>QToolButton {background: #404040;}
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>QToolButton:hover {background: #555;}
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>QToolButton:pressed {background: #606060;}
#mainPanel[uitheme=theme-dark] Tab {background: #404040; border-right-color: #505050;}
#mainPanel[uitheme=theme-dark] Tab #tabText {color: #dfdfdf;}
#mainPanel[uitheme=theme-dark] Tab[selected=true] {background: #2a2a2a; border-color: #2a2a2a;}
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true] {background: #404040; border-color: #505050;}
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true][custom=true] #tabText {color: #dfdfdf;}
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true][custom=true] #tabButton {image: none;}
#mainPanel[uitheme=theme-dark] Tab[selected=false][hovered=true],
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true][hovered=true] {background: #555;}
#mainPanel[uitheme=theme-dark] Tab[selected=false][hovered=true] #tabButton,
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton {image: url(:/tabbar/icons/close_active_normal.svg);}
#mainPanel[uitheme=theme-dark] Tab[selected=false][hovered=true] #tabButton:hover,
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton:hover {image: url(:/tabbar/icons/close_active_hover.svg);}
#mainPanel[uitheme=theme-dark] Tab[selected=false][hovered=true] #tabButton:pressed,
#mainPanel[uitheme=theme-dark] CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton:pressed {image: url(:/tabbar/icons/close_active_pressed.svg);}
#mainPanel[uitheme=theme-dark] Tab[selected=true] #tabButton:pressed {background: #555;}
#mainPanel[uitheme=theme-dark] Tab[selected=true][custom=true] #tabButton:pressed {background: transparent;}
/* contrast-dark */
#mainPanel[uitheme=theme-contrast-dark] QTabBar,
#mainPanel[uitheme=theme-contrast-dark] #tabWrapper {background-color: #2a2a2a;}
#mainPanel[uitheme=theme-contrast-dark] QTabBar QToolButton::left-arrow,
#mainPanel[uitheme=theme-contrast-dark] QTabBar QToolButton::right-arrow {background-color: #f00;}
#mainPanel[uitheme=theme-contrast-dark] QTabBar QToolButton:pressed {background-color: #f00;}
#mainPanel[uitheme=theme-contrast-dark] QTabWidget::pane {background-color: #2a2a2a;}
#mainPanel[uitheme=theme-contrast-dark] QTabBar::tab {background-color: #2a2a2a; border-right-color: #414141;}
#mainPanel[uitheme=theme-contrast-dark] QTabBar::tab:hover {background-color: #424242;}
#mainPanel[uitheme=theme-contrast-dark] QTabBar::tab:selected {background-color: #2a2a2a;}
#mainPanel[uitheme=theme-contrast-dark] QTabBar[active=false]::tab:selected:hover {background-color: #424242;}
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton {background-color: #2a2a2a;}
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton:hover {background-color: #525252;}
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton:pressed {background-color: #424242;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar {background: #2a2a2a;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>QToolButton {background: #2a2a2a;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>QToolButton:hover {background: #525252;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>QToolButton:pressed {background: #424242;}
#mainPanel[uitheme=theme-contrast-dark] Tab {background: #2a2a2a; border-right-color: #414141;}
#mainPanel[uitheme=theme-contrast-dark] Tab #tabText {color: #fff;}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=true] {background: #1e1e1e; border-color: #1e1e1e;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true] {background: #2a2a2a; border-color: #414141;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true][custom=true] #tabText {color: #fff;}
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true][custom=true] #tabButton {image: none;}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=false][hovered=true],
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true][hovered=true] {background: #424242;}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=false][hovered=true] #tabButton,
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton {image: url(:/tabbar/icons/close_active_normal.svg);}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=false][hovered=true] #tabButton:hover,
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton:hover {image: url(:/tabbar/icons/close_active_hover.svg);}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=false][hovered=true] #tabButton:pressed,
#mainPanel[uitheme=theme-contrast-dark] CTabBar[active=false] Tab[selected=true][hovered=true] #tabButton:pressed {image: url(:/tabbar/icons/close_active_pressed.svg);}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=true] #tabButton:pressed {background: #424242;}
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=true][custom=true] #tabButton:pressed {background: transparent;}
/* portal */
Tab[selected=true][custom=true],
#mainPanel[uitheme=theme-dark] Tab[selected=true][custom=true],
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=true][custom=true] {background: #fff;}
Tab[selected=true][custom=true] #tabText,
#mainPanel[uitheme=theme-dark] Tab[selected=true][custom=true] #tabText,
#mainPanel[uitheme=theme-contrast-dark] Tab[selected=true][custom=true] #tabText {color: #444;}
Tab[selected=true][custom=true] #tabButton {image:url(:/tabbar/icons/close_normal.svg);}
Tab[selected=true][custom=true] #tabButton:hover {image: url(:/tabbar/icons/close_hover.svg);}
Tab[selected=true][custom=true] #tabButton:pressed {image: url(:/tabbar/icons/close_pressed.svg);}
/* dark, contrast-dark */
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#leftButton,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#leftButton {
image: url(:/tabbar/icons/scrolltab_ln_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#leftButton,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#leftButton {
image: url(:/tabbar/icons/scrolltab_ln_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#leftButton:disabled,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#leftButton:disabled,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#leftButton:hover,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#leftButton:hover,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#leftButton:pressed,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#leftButton:pressed,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#rightButton,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#rightButton,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#rightButton {
image: url(:/tabbar/icons/scrolltab_rn_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#rightButton:disabled,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#rightButton:disabled,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#rightButton:hover,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#rightButton:hover,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh_light.svg);
}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton#rightButton:pressed,
#mainPanel[uitheme=theme-contrast-dark] #scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp_light.svg) center no-repeat;
#mainPanel[uitheme=theme-dark] CTabBar #tabScroll>#rightButton:pressed,
#mainPanel[uitheme=theme-contrast-dark] CTabBar #tabScroll>#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp_light.svg);
}
/* 1x */
CTabBar #tabScroll {min-width: 32px; max-width: 32px;}
CTabBar #tabScroll>QToolButton {max-height: 28px;}
Tab {min-width: 41px; max-width: 135px; width: 135px; height: 28px;}
Tab #tabIcon {padding: 0px; min-width: 15px; min-height: 15px; max-width: 15px; max-height: 15px;}
Tab #tabText {font-size: 11px;}
Tab #tabButton {width: 16px; max-width: 16px; max-height: 16px; border-width: 2px;}
/* 1.25x */
#mainPanel[zoom="1.25x"] QLabel[class=tab-icon] {padding:0 0 2px 8px;}
#mainPanel[zoom="1.25x"] QTabBar {font-size: 14px;}
#mainPanel[zoom="1.25x"] QTabBar::tab {min-width: 51px; max-width: 169px; width: 169px; height: 35px; border-right-width: 1px;}
#mainPanel[zoom="1.25x"] QTabBar::close-button {margin-top: -1px; icon-size: 20px;}
#mainPanel[zoom="1.25x"] QTabBar QToolButton,
#mainPanel[zoom="1.25x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="1.25x"] #paddingWidget {min-width: 15px; max-width: 15px;}
#mainPanel[zoom="1.25x"] #scrollerFrame {min-width: 48px; max-width: 48px;}
#mainPanel[zoom="1.25x"] #scrollerFrame>QToolButton {max-height: 35px;}
#mainPanel[zoom="1.25x"] CTabBar #tabScroll {min-width: 48px; max-width: 48px;}
#mainPanel[zoom="1.25x"] CTabBar #tabScroll>QToolButton {max-height: 35px;}
#mainPanel[zoom="1.25x"] Tab {min-width: 51px; max-width: 169px; width: 169px; height: 35px; border-right-width: 1px;}
#mainPanel[zoom="1.25x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 19px; min-height: 19px; max-width: 19px; max-height: 19px;}
#mainPanel[zoom="1.25x"] Tab #tabText {font-size: 14px;}
#mainPanel[zoom="1.25x"] Tab #tabButton {width: 20px; max-width: 20px; max-height: 20px; border-width: 2px;}
/* 1.5x */
#mainPanel[zoom="1.5x"] QLabel[class=tab-icon] {padding:0 0 3px 9px;}
#mainPanel[zoom="1.5x"] QTabBar {font-size: 15px;}
#mainPanel[zoom="1.5x"] QTabBar::tab {min-width: 62px; max-width: 203px; width: 203px; height: 42px; border-right-width: 2px;}
#mainPanel[zoom="1.5x"] QTabBar::close-button {margin-top: -1px; icon-size: 24px;}
#mainPanel[zoom="1.5x"] QTabBar QToolButton,
#mainPanel[zoom="1.5x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="1.5x"] #paddingWidget {min-width: 15px; max-width: 15px;}
#mainPanel[zoom="1.5x"] #scrollerFrame {min-width: 48px; max-width: 48px;}
#mainPanel[zoom="1.5x"] #scrollerFrame>QToolButton {max-height: 42px;}
#mainPanel[zoom="1.5x"] CTabBar #tabScroll {min-width: 48px; max-width: 48px;}
#mainPanel[zoom="1.5x"] CTabBar #tabScroll>QToolButton {max-height: 42px;}
#mainPanel[zoom="1.5x"] Tab {min-width: 62px; max-width: 203px; width: 203px; height: 42px; border-right-width: 2px;}
#mainPanel[zoom="1.5x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 24px; min-height: 24px; max-width: 24px; max-height: 24px;}
#mainPanel[zoom="1.5x"] Tab #tabText {font-size: 15px;}
#mainPanel[zoom="1.5x"] Tab #tabButton {width: 24px; max-width: 24px; max-height: 24px; border-width: 2px;}
/* 1.75x */
#mainPanel[zoom="1.75x"] QLabel[class=tab-icon] {padding:0 0 4px 9px;}
#mainPanel[zoom="1.75x"] QTabBar {font-size: 18px;}
#mainPanel[zoom="1.75x"] QTabBar::tab {min-width: 72px; max-width: 236px; width: 236px; height: 49px; border-right-width: 2px;}
#mainPanel[zoom="1.75x"] QTabBar::close-button {margin-top: -2px; icon-size: 28px;}
#mainPanel[zoom="1.75x"] QTabBar QToolButton,
#mainPanel[zoom="1.75x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="1.75x"] #paddingWidget {min-width: 31px; max-width: 31px;}
#mainPanel[zoom="1.75x"] #scrollerFrame {min-width: 64px; max-width: 64px;}
#mainPanel[zoom="1.75x"] #scrollerFrame>QToolButton {max-height: 49px;}
#mainPanel[zoom="1.75x"] CTabBar #tabScroll {min-width: 64px; max-width: 64px;}
#mainPanel[zoom="1.75x"] CTabBar #tabScroll>QToolButton {max-height: 49px;}
#mainPanel[zoom="1.75x"] Tab {min-width: 72px; max-width: 236px; width: 236px; height: 49px; border-right-width: 2px;}
#mainPanel[zoom="1.75x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 28px; min-height: 28px; max-width: 28px; max-height: 28px;}
#mainPanel[zoom="1.75x"] Tab #tabText {font-size: 18px;}
#mainPanel[zoom="1.75x"] Tab #tabButton {width: 28px; max-width: 28px; max-height: 28px; border-width: 2px;}
/* 2x */
#mainPanel[zoom="2x"] QLabel[class=tab-icon] {padding:0 0 4px 12px;}
#mainPanel[zoom="2x"] QTabBar {font-size: 20px;}
#mainPanel[zoom="2x"] QTabBar::tab {min-width: 82px; max-width: 270px; width: 270px; height: 56px; border-right-width: 2px;}
#mainPanel[zoom="2x"] QTabBar::close-button {margin-top: -2px; icon-size: 32px;}
#mainPanel[zoom="2x"] QTabBar QToolButton,
#mainPanel[zoom="2x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="2x"] #paddingWidget {min-width: 31px; max-width: 31px;}
#mainPanel[zoom="2x"] #scrollerFrame {min-width: 64px; max-width: 64px;}
#mainPanel[zoom="2x"] #scrollerFrame>QToolButton {max-height: 56px;}
#mainPanel[zoom="2x"] CTabBar #tabScroll {min-width: 64px; max-width: 64px;}
#mainPanel[zoom="2x"] CTabBar #tabScroll>QToolButton {max-height: 56px;}
#mainPanel[zoom="2x"] Tab {min-width: 82px; max-width: 270px; width: 270px; height: 56px; border-right-width: 2px;}
#mainPanel[zoom="2x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 32px; min-height: 32px; max-width: 32px; max-height: 32px;}
#mainPanel[zoom="2x"] Tab #tabText {font-size: 20px;}
#mainPanel[zoom="2x"] Tab #tabButton {width: 32px; max-width: 32px; max-height: 32px; border-width: 2px;}
/* 2.5x */
#mainPanel[zoom="2.5x"] QLabel[class=tab-icon] {padding:0 0 5px 15px;}
#mainPanel[zoom="2.5x"] QTabBar {font-size: 25px;}
#mainPanel[zoom="2.5x"] QTabBar::tab {min-width: 103px; max-width: 338px; width: 338px; height: 70px; border-right-width: 3px;}
#mainPanel[zoom="2.5x"] QTabBar::close-button {margin-top: -3px; icon-size: 40px;}
#mainPanel[zoom="2.5x"] QTabBar QToolButton,
#mainPanel[zoom="2.5x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="2.5x"] #paddingWidget {min-width: 49px; max-width: 49px;}
#mainPanel[zoom="2.5x"] #scrollerFrame {min-width: 80px; max-width: 80px;}
#mainPanel[zoom="2.5x"] #scrollerFrame>QToolButton {max-height: 70px;}
#mainPanel[zoom="2.5x"] CTabBar #tabScroll {min-width: 80px; max-width: 80px;}
#mainPanel[zoom="2.5x"] CTabBar #tabScroll>QToolButton {max-height: 70px;}
#mainPanel[zoom="2.5x"] Tab {min-width: 103px; max-width: 338px; width: 338px; height: 70px; border-right-width: 3px;}
#mainPanel[zoom="2.5x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 40px; min-height: 40px; max-width: 40px; max-height: 40px;}
#mainPanel[zoom="2.5x"] Tab #tabText {font-size: 25px;}
#mainPanel[zoom="2.5x"] Tab #tabButton {width: 40px; max-width: 40px; max-height: 40px; border-width: 2px;}
/* 3x */
#mainPanel[zoom="3x"] QLabel[class=tab-icon] {padding:0 0 6px 18px;}
#mainPanel[zoom="3x"] QTabBar {font-size: 30px;}
#mainPanel[zoom="3x"] QTabBar::tab {min-width: 123px; max-width: 405px; width: 405px; height: 84px; border-right-width: 3px;}
#mainPanel[zoom="3x"] QTabBar::close-button {margin-top: -3px; icon-size: 48px;}
#mainPanel[zoom="3x"] QTabBar QToolButton,
#mainPanel[zoom="3x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="3x"] #paddingWidget {min-width: 65px; max-width: 65px;}
#mainPanel[zoom="3x"] #scrollerFrame {min-width: 96px; max-width: 96px;}
#mainPanel[zoom="3x"] #scrollerFrame>QToolButton {max-height: 84px;}
#mainPanel[zoom="3x"] CTabBar #tabScroll {min-width: 96px; max-width: 96px;}
#mainPanel[zoom="3x"] CTabBar #tabScroll>QToolButton {max-height: 84px;}
#mainPanel[zoom="3x"] Tab {min-width: 123px; max-width: 405px; width: 405px; height: 84px; border-right-width: 3px;}
#mainPanel[zoom="3x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 48px; min-height: 48px; max-width: 48px; max-height: 48px;}
#mainPanel[zoom="3x"] Tab #tabText {font-size: 30px;}
#mainPanel[zoom="3x"] Tab #tabButton {width: 48px; max-width: 48px; max-height: 48px; border-width: 2px;}
/* 3.5x */
#mainPanel[zoom="3.5x"] QLabel[class=tab-icon] {padding:0 0 7px 21px;}
#mainPanel[zoom="3.5x"] QTabBar {font-size: 35px;}
#mainPanel[zoom="3.5x"] QTabBar::tab {min-width: 144px; max-width: 473px; width: 473px; height: 98px; border-right-width: 4px;}
#mainPanel[zoom="3.5x"] QTabBar::close-button {margin-top: -4px; icon-size: 56px;}
#mainPanel[zoom="3.5x"] QTabBar QToolButton,
#mainPanel[zoom="3.5x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="3.5x"] #paddingWidget {min-width: 82px; max-width: 82px;}
#mainPanel[zoom="3.5x"] #scrollerFrame {min-width: 112px; max-width: 112px;}
#mainPanel[zoom="3.5x"] #scrollerFrame>QToolButton {max-height: 98px;}
#mainPanel[zoom="3.5x"] CTabBar #tabScroll {min-width: 112px; max-width: 112px;}
#mainPanel[zoom="3.5x"] CTabBar #tabScroll>QToolButton {max-height: 98px;}
#mainPanel[zoom="3.5x"] Tab {min-width: 144px; max-width: 473px; width: 473px; height: 98px; border-right-width: 4px;}
#mainPanel[zoom="3.5x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 56px; min-height: 56px; max-width: 56px; max-height: 56px;}
#mainPanel[zoom="3.5x"] Tab #tabText {font-size: 35px;}
#mainPanel[zoom="3.5x"] Tab #tabButton {width: 56px; max-width: 56px; max-height: 56px; border-width: 2px;}
/* 4x */
#mainPanel[zoom="4x"] QLabel[class=tab-icon] {padding:0 0 8px 24px;}
#mainPanel[zoom="4x"] QTabBar {font-size: 40px;}
#mainPanel[zoom="4x"] QTabBar::tab {min-width: 164px; max-width: 540px; width: 540px; height: 112px; border-right-width: 4px;}
#mainPanel[zoom="4x"] QTabBar::close-button {margin-top: -4px; icon-size: 64px;}
#mainPanel[zoom="4x"] QTabBar QToolButton,
#mainPanel[zoom="4x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="4x"] #paddingWidget {min-width: 98px; max-width: 98px;}
#mainPanel[zoom="4x"] #scrollerFrame {min-width: 128px; max-width: 128px;}
#mainPanel[zoom="4x"] #scrollerFrame>QToolButton {max-height: 112px;}
#mainPanel[zoom="4x"] CTabBar #tabScroll {min-width: 128px; max-width: 128px;}
#mainPanel[zoom="4x"] CTabBar #tabScroll>QToolButton {max-height: 112px;}
#mainPanel[zoom="4x"] Tab {min-width: 164px; max-width: 540px; width: 540px; height: 112px; border-right-width: 4px;}
#mainPanel[zoom="4x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 64px; min-height: 64px; max-width: 64px; max-height: 64px;}
#mainPanel[zoom="4x"] Tab #tabText {font-size: 40px;}
#mainPanel[zoom="4x"] Tab #tabButton {width: 64px; max-width: 64px; max-height: 64px; border-width: 2px;}
/* 4.5x */
#mainPanel[zoom="4.5x"] QLabel[class=tab-icon] {padding:0 0 9px 27px;}
#mainPanel[zoom="4.5x"] QTabBar {font-size: 45px;}
#mainPanel[zoom="4.5x"] QTabBar::tab {min-width: 185px; max-width: 608px; width: 608px; height: 126px; border-right-width: 5px;}
#mainPanel[zoom="4.5x"] QTabBar::close-button {margin-top: -5px; icon-size: 72px;}
#mainPanel[zoom="4.5x"] QTabBar QToolButton,
#mainPanel[zoom="4.5x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="4.5x"] #paddingWidget {min-width: 112px; max-width: 112px;}
#mainPanel[zoom="4.5x"] #scrollerFrame {min-width: 144px; max-width: 144px;}
#mainPanel[zoom="4.5x"] #scrollerFrame>QToolButton {max-height: 126px;}
#mainPanel[zoom="4.5x"] CTabBar #tabScroll {min-width: 144px; max-width: 144px;}
#mainPanel[zoom="4.5x"] CTabBar #tabScroll>QToolButton {max-height: 126px;}
#mainPanel[zoom="4.5x"] Tab {min-width: 185px; max-width: 608px; width: 608px; height: 126px; border-right-width: 5px;}
#mainPanel[zoom="4.5x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 72px; min-height: 72px; max-width: 72px; max-height: 72px;}
#mainPanel[zoom="4.5x"] Tab #tabText {font-size: 45px;}
#mainPanel[zoom="4.5x"] Tab #tabButton {width: 72px; max-width: 72px; max-height: 72px; border-width: 2px;}
/* 5x */
#mainPanel[zoom="5x"] QLabel[class=tab-icon] {padding:0 0 10px 30px;}
#mainPanel[zoom="5x"] QTabBar {font-size: 50px;}
#mainPanel[zoom="5x"] QTabBar::tab {min-width: 205px; max-width: 675px; width: 675px; height: 140px; border-right-width: 5px;}
#mainPanel[zoom="5x"] QTabBar::close-button {margin-top: -5px; icon-size: 80px;}
#mainPanel[zoom="5x"] QTabBar QToolButton,
#mainPanel[zoom="5x"] QTabBar QToolButton:disabled {/*margin-right: -2px;*/ border-width: 2px;}
#mainPanel[zoom="5x"] #paddingWidget {min-width: 130px; max-width: 130px;}
#mainPanel[zoom="5x"] #scrollerFrame {min-width: 160px; max-width: 160px;}
#mainPanel[zoom="5x"] #scrollerFrame>QToolButton {max-height: 140px;}
#mainPanel[zoom="5x"] CTabBar #tabScroll {min-width: 160px; max-width: 160px;}
#mainPanel[zoom="5x"] CTabBar #tabScroll>QToolButton {max-height: 140px;}
#mainPanel[zoom="5x"] Tab {min-width: 205px; max-width: 675px; width: 675px; height: 140px; border-right-width: 5px;}
#mainPanel[zoom="5x"] Tab #tabIcon {padding-left: 8px; padding-right: 8px; min-width: 80px; min-height: 80px; max-width: 80px; max-height: 80px;}
#mainPanel[zoom="5x"] Tab #tabText {font-size: 50px;}
#mainPanel[zoom="5x"] Tab #tabButton {width: 80px; max-width: 80px; max-height: 80px; border-width: 2px;}

View File

@ -32,36 +32,25 @@
#include "components/asctabwidget.h"
#include <QRegExp>
#include <QDebug>
#include <QHBoxLayout>
#include <QLabel>
#include <QStylePainter>
#include <QDesktopWidget>
#include <QFileInfo>
#include <QApplication>
#include <QTimer>
#include <regex>
#include "ctabstyle.h"
#include "casctabdata.h"
#include "common/Types.h"
#include "defines.h"
#include "utils.h"
#include "cfilechecker.h"
#include "components/canimatedicon.h"
#include "ceditortools.h"
#include "cascapplicationmanagerwrapper.h"
#include "ctabundockevent.h"
#include "OfficeFileFormats.h"
#include "private/qtabbar_p.h"
using namespace std;
/*
*
* Tab data
@ -141,7 +130,7 @@ auto panelfromwidget(QWidget * panelwidget) -> CTabPanel * {
}
CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
: QTabWidget(parent)
: QStackedWidget(parent)
, CScalingWrapper(parent)
, m_dataFullScreen(0)
, m_widthParams({{100, 135, 9}, 68, 3, 0, WINDOW_TITLE_MIN_WIDTH, 140, 0})
@ -150,43 +139,36 @@ CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
, m_tabIconSize(16, 16)
, m_pBar(_pBar)
{
QTabWidget::tabBar()->hide();
m_pBar->setObjectName("asc_editors_tabbar");
m_pBar->setTabTextColor(QPalette::Active, QColor(51, 51, 51));
m_pBar->setTabTextColor(QPalette::Inactive, QColor(51, 51, 51));
m_pBar->setMovable(true);
m_pBar->setExpanding(false);
m_pBar->setTabsClosable(true);
setIconSize(m_tabIconSize);
setProperty("active", false);
setProperty("empty", true);
m_pBar->setProperty("active", false);
static int _dropedindex = -1;
QObject::connect(this, &CAscTabWidget::currentChanged, this, [=](int index) {
if (index > -1) m_pBar->setCurrentIndex(index);
updateIcons();
QTimer::singleShot(0, this, [=]() {
updateIcons();
});
setFocusedView();
_dropedindex = -1;
});
QObject::connect(m_pBar, &CTabBar::tabUndock, this, [=](int index, bool * accept) {
QObject::connect(this, &CAscTabWidget::widgetRemoved, this, [=](int index) {
emit editorRemoved(index, count());
});
QObject::connect(m_pBar, &CTabBar::tabUndock, this, [=](int index, bool &accept) {
if (index == _dropedindex) return;
const CTabPanel * _panel = panel(index);
if ( _panel->data()->viewType() == cvwtEditor ) {
CTabUndockEvent event(index);
QObject * obj = qobject_cast<QObject *>(
static_cast<CAscApplicationManagerWrapper *>(&AscAppManager::getInstance()));
QObject * obj = qobject_cast<QObject*>(&AscAppManager::getInstance());
if ( QApplication::sendEvent(obj, &event) && event.isAccepted() ) {
_dropedindex = index;
*accept = true;
accept = true;
QTimer::singleShot(10, this, [=]() {
QTimer::singleShot(0, this, [=]() {
if (widget(index)) {
m_pBar->removeTab(index);
widget(index)->deleteLater();
}
});
@ -205,7 +187,11 @@ CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
turnOffAltHints(m_pBar->currentIndex(), index);
});
QObject::connect(m_pBar, &CTabBar::tabMoved, this, [=](int from, int to) {
QTabWidget::tabBar()->moveTab(from, to);
if (from < 0 || from >= count() || to < 0 || to >= count() || from == to)
return;
auto wgt = widget(from);
removeWidget(wgt);
insertWidget(to, wgt);
});
}
@ -267,10 +253,9 @@ int CAscTabWidget::addEditor(const COpenOptions& opts)
data->setChanged(opts.srctype == etRecoveryFile);
pView->setData(data);
tab_index = addTab(panelwidget, data->title());
tab_index = addWidget(panelwidget);
m_pBar->addTab(data->title());
//m_pBar->setTabToolTip(tab_index, data->title());
m_pBar->setTabProperty(tab_index, "ToolTip", data->title());
m_pBar->setTabToolTip(tab_index, data->title());
m_pBar->tabStartLoading(tab_index);
//m_pBar->setCurrentIndex(tab_index);
@ -315,7 +300,7 @@ void CAscTabWidget::closeEditorByIndex(int index, bool checkmodified)
int CAscTabWidget::count(int type) const
{
if ( type < 0 )
return QTabWidget::count();
return QStackedWidget::count();
else {
int _out(0);
for (int i(count()); i-- > 0; ) {
@ -329,7 +314,7 @@ int CAscTabWidget::count(int type) const
int CAscTabWidget::count(const wstring& portal, bool exclude)
{
if ( portal.empty() )
return QTabWidget::count();
return QStackedWidget::count();
else {
int _out(0);
for (int i(count()); i-- > 0; ) {
@ -392,14 +377,11 @@ int CAscTabWidget::addPortal(const QString& url, const QString& name, const QStr
int tab_index = -1;
tab_index = insertTab(tab_index, panelwidget, portal);
tab_index = insertWidget(tab_index, panelwidget);
m_pBar->insertTab(tab_index, portal);
//m_pBar->setTabToolTip(tab_index, _url);
m_pBar->setTabProperty(tab_index, "ToolTip", _url);
m_pBar->setTabTheme(tab_index, CTabBar::LightTab);
m_pBar->setTabToolTip(tab_index, _url);
m_pBar->setTabIconTheme(tab_index, CTabBar::LightTab);
m_pBar->tabStartLoading(tab_index);
//m_pBar->setCurrentIndex(tab_index);
// updateTabIcon(tabIndexByView(id));
return tab_index;
@ -434,13 +416,11 @@ int CAscTabWidget::addOAuthPortal(const QString& portal, const QString& type, co
int tab_index = -1;
tab_index = insertTab(tab_index, panelwidget, _portal);
tab_index = insertWidget(tab_index, panelwidget);
m_pBar->insertTab(tab_index, _portal);
//m_pBar->setTabToolTip(tab_index, portal);
m_pBar->setTabProperty(tab_index, "ToolTip", portal);
m_pBar->setTabTheme(tab_index, CTabBar::LightTab);
m_pBar->setTabToolTip(tab_index, portal);
m_pBar->setTabIconTheme(tab_index, CTabBar::LightTab);
m_pBar->tabStartLoading(tab_index);
//m_pBar->setCurrentIndex(tab_index);
return tab_index;
}
@ -456,24 +436,19 @@ int CAscTabWidget::insertPanel(QWidget * panel, int index)
QWidget * panelwidget = createTabPanel(this, _panel);
tabindex = insertTab(index, panelwidget, tabdata->title());
m_pBar->insertTab(index, tabdata->title());
//m_pBar->setTabToolTip(tabindex, tabdata->title());
m_pBar->setTabProperty(tabindex, "ToolTip", tabdata->title());
//m_pBar->setCurrentIndex(tabindex);
tabindex = insertWidget(index, panelwidget);
m_pBar->insertTab(tabindex, tabdata->title());
m_pBar->setTabToolTip(tabindex, tabdata->title());
}
return tabindex;
}
void CAscTabWidget::tabInserted(int index)
int CAscTabWidget::insertWidget(int index, QWidget* widget)
{
emit editorInserted(index, count());
}
void CAscTabWidget::tabRemoved(int index)
{
emit editorRemoved(index, count());
int actual_index = QStackedWidget::insertWidget(index, widget);
emit editorInserted(actual_index, count());
return actual_index;
}
void CAscTabWidget::setCustomWindowParams(bool iscustom)
@ -492,7 +467,7 @@ void CAscTabWidget::updateIcons()
void CAscTabWidget::updateTabIcon(int index)
{
if ( !(index < 0) ) {
if ( !(index < 0) && panel(index)) {
CCefViewEditor * pEditor = (CCefViewEditor *)panel(index)->cef();
if (pEditor) {
@ -514,7 +489,7 @@ void CAscTabWidget::updateTabIcon(int index)
default: tab_type = panel(index)->data()->contentType(); break;
}
if ( !isActiveWidget() || !(index == currentIndex()) ) {
if ( !is_active ) {
tab_theme = AscAppManager::themes().current().isDark() ? CTabBar::DarkTab : CTabBar::LightTab;
} else {
switch ( tab_type ) {
@ -534,19 +509,16 @@ void CAscTabWidget::updateTabIcon(int index)
break;
}
}
QString icon_name = is_active ? m_mapTabIcons.at(tab_type).second : m_mapTabIcons.at(tab_type).first;
m_pBar->setTabIcon(index, QIcon(icon_name));
// ((CTabBar *)tabBar())->changeTabTheme(index, _theme);
m_pBar->setTabTheme(index, tab_theme);
// m_pBar->setTabIconTheme(index, tab_theme);
if ( index == currentIndex() ) {
m_pBar->setActiveTabColor(active_tab_color);
// ((CTabBar *)tabBar())->setUseTabCustomPalette( !(tab_type == etPortal || tab_type == etUndefined) );
m_pBar->setTabTextColor(QPalette::Active, AscAppManager::themes().isColorDark(active_tab_color) ?
ui_theme.color(CTheme::ColorRole::ecrTextPressed) : ui_theme.color(CTheme::ColorRole::ecrTabSimpleActiveText));
if (tab_type == etPortal || tab_type == etNewPortal || tab_type == etUndefined)
m_pBar->setUseTabCustomPalette(index, true);
else {
m_pBar->setUseTabCustomPalette(index, false);
m_pBar->setActiveTabColor(index, active_tab_color);
}
}
}
}
@ -580,7 +552,6 @@ void CAscTabWidget::reloadTabIcons()
* Slots
*/
void CAscTabWidget::editorCloseRequest(int index)
{
panel(index)->data()->close();
@ -786,8 +757,7 @@ void CAscTabWidget::applyDocumentChanging(int viewId, const QString& name, const
}
m_pBar->setTabText(tabIndex, doc->title());
//m_pBar->setTabToolTip(tabIndex, path.isEmpty() ? doc->title() : path);
m_pBar->setTabProperty(tabIndex, "ToolTip", path.isEmpty() ? doc->title() : path);
m_pBar->setTabToolTip(tabIndex, path.isEmpty() ? doc->title() : path);
}
}
@ -806,8 +776,7 @@ void CAscTabWidget::applyDocumentChanging(int viewId, bool state)
if (doc->hasChanges() != state && (!doc->closed() || state)) {
doc->setChanged(state);
m_pBar->setTabText(tabIndex, doc->title());
//m_pBar->setTabToolTip(tabIndex, doc->title());
m_pBar->setTabProperty(tabIndex, "ToolTip", doc->title());
m_pBar->setTabToolTip(tabIndex, doc->title());
}
}
}
@ -878,8 +847,7 @@ void CAscTabWidget::setEditorOptions(int id, const wstring& option)
if (option.find(L"readonly\":") != wstring::npos) {
m_pBar->setTabText(tabIndex, doc->title());
//m_pBar->setTabToolTip(tabIndex, doc->title());
m_pBar->setTabProperty(tabIndex, "ToolTip", doc->title());
m_pBar->setTabToolTip(tabIndex, doc->title());
}
// if (std::regex_search(option, std::wregex(L"titlebuttons\":\\s?true"))) {
@ -924,13 +892,8 @@ void CAscTabWidget::activate(bool a)
this->setProperty("active", a);
m_pBar->setProperty("active", a);
}
updateTabIcon(currentIndex());
m_pBar->activate(a);
m_pBar->customColors().setCurrentColorGroup(a ? QPalette::Normal : QPalette::Disabled );
m_pBar->update();
//m_pBar->repaint();
updateIcons();
m_pBar->polish();
}
bool CAscTabWidget::isActiveWidget()
@ -1157,7 +1120,7 @@ void CAscTabWidget::setFullScreen(bool apply, int id)
_break_demonstration();
e->ignore();
// TODO: associate panel with reporter window and close both simultaneously
QTimer::singleShot(10, [=] {emit tabCloseRequested(m_dataFullScreen->tabindex());});
QTimer::singleShot(10, [=] {emit m_pBar->tabCloseRequested(m_dataFullScreen->tabindex());});
});
connect((CFullScrWidget*)m_dataFullScreen->parent, &CFullScrWidget::closeRequest, this, [=]() {
@ -1173,29 +1136,9 @@ QWidget * CAscTabWidget::fullScreenWidget()
return m_dataFullScreen ? m_dataFullScreen->widget() : nullptr;
}
void CAscTabWidget::updateScalingFactor(double f)
{
CScalingWrapper::updateScalingFactor(f);
double dpi_ratio = scaling();
setIconSize(m_tabIconSize * dpi_ratio);
m_pBar->setIconSize(m_tabIconSize * dpi_ratio);
updateIcons();
(m_widthParams = size_params(m_defWidthParams)).apply_scale(dpi_ratio);
if ( m_isCustomStyle )
m_widthParams.tools_width = int(50 * dpi_ratio),
m_widthParams.title_width = int(WINDOW_TITLE_MIN_WIDTH * dpi_ratio);
else
m_widthParams.tools_width = m_widthParams.title_width = 0;
m_pBar->updateScalingFactor(f);
}
void CAscTabWidget::setStyleSheet(const QString& stylesheet)
{
QTabWidget::setStyleSheet(stylesheet);
QStackedWidget::setStyleSheet(stylesheet);
auto _string_to_color = [](const QString& str) -> QColor {
int r = -1, g = -1, b = -1;
@ -1240,10 +1183,8 @@ void CAscTabWidget::applyUITheme(const std::wstring& theme)
{
reloadTabIcons();
updateIcons();
// _tabbar.setTabTextColor(QPalette::Active, AscAppManager::themes().color(theme, CThemes::ColorRole::ecrTextPressed));
m_pBar->setTabTextColor(QPalette::Inactive, AscAppManager::themes().current().color(CTheme::ColorRole::ecrTextNormal));
m_pBar->setUIThemeType(!AscAppManager::themes().current().isDark());
m_pBar->style()->polish(m_pBar);
m_pBar->setIgnoreActiveTabColor(AscAppManager::themes().current().isDark());
m_pBar->polish();
style()->polish(this);
QColor back_color = AscAppManager::themes().current().color(CTheme::ColorRole::ecrWindowBackground);

View File

@ -34,16 +34,13 @@
#define ASCTABWIDGET
#include <QResizeEvent>
//#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTabBar>
#include <QtWidgets/QPushButton>
#include "ctabbarwrapper.h"
#include <QStackedWidget>
#include "ctabbar.h"
#include "qcefview.h"
#include "cscalingwrapper.h"
#include "ctabpanel.h"
#include <QDebug>
#define etLocalFile AscEditorType(254)
#define etRecoveryFile AscEditorType(253)
#define etRecentFile AscEditorType(252)
@ -76,7 +73,7 @@ struct COpenOptions {
eOpenMode mode = eOpenMode::edit;
};
class CAscTabWidget : public QTabWidget, public CScalingWrapper
class CAscTabWidget : public QStackedWidget, public CScalingWrapper
{
Q_OBJECT
@ -118,8 +115,6 @@ class CAscTabWidget : public QTabWidget, public CScalingWrapper
typedef std::map< int, std::pair<QString, QString> > CTabIconSet;
using QTabWidget::tabBar;
private:
std::map<int, QCefView*> m_mapDownloads;
CFullScreenData * m_dataFullScreen;
@ -151,15 +146,13 @@ public:
void setStyleSheet(const QString&);
void applyUITheme(const std::wstring&);
using QTabWidget::count;
using QStackedWidget::count;
int count(int type) const;
int count(const std::wstring& portal, bool exclude = false);
bool hasForPortal(const QString&);
void updateScalingFactor(double) override;
protected:
void tabInserted(int index) override;
void tabRemoved(int index) override;
int insertWidget(int index, QWidget* widget);
void closeEditor(int, bool, bool);
public:

View File

@ -53,7 +53,8 @@ void CAnimatedIcon::startSvg(const QString& source, const QString& eid)
if ( !eid.isEmpty() ) m_svgElemId = eid;
if ( m_image ) delete m_image;
m_image = new QPixmap( m_svgSize );
int icon_size = qMin(width(), height());
m_image = new QPixmap(icon_size, icon_size);
connect(m_svg, &QSvgRenderer::repaintNeeded, this, &CAnimatedIcon::onSvgRepaint);
} else {

File diff suppressed because it is too large Load Diff

View File

@ -33,89 +33,75 @@
#ifndef CTABBAR_H
#define CTABBAR_H
#include <QTabBar>
#include <QToolButton>
#include <QFrame>
#include <QTimer>
#include <QWheelEvent>
#include "cscalingwrapper.h"
#include <math.h>
//class CTabBarPrivate;
class CTabBar : public QTabBar, public CScalingWrapper
class CTabBar : public QFrame
{
Q_OBJECT
public:
explicit CTabBar(QWidget * parent = nullptr);
virtual ~CTabBar();
void setTabTextColor(QPalette::ColorGroup, const QColor&);
void setUseTabCustomPalette(bool);
QPalette& customColors();
QVariant tabProperty(int index, const char *name);
void setTabProperty(int index, const char *name, const QVariant &value);
void setTabIcon(int index, const QIcon &icon);
void setTabLoading(int, bool);
void setActiveTabColor(const QString&);
void tabStartLoading(int, const QString& theme = QString());
void activate(bool);
void updateScalingFactor(double) override;
int draggedTabIndex();
CTabBar(QWidget *parent = nullptr);
~CTabBar();
enum TabTheme {
LightTab,
DarkTab
};
void changeTabTheme(int, TabTheme);
void setTabTheme(int, TabTheme);
void setUIThemeType(bool islight);
void initCustomScroll(QFrame *, QToolButton *, QToolButton *);
protected:
bool event(QEvent * e) override;
void mousePressEvent (QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseReleaseEvent (QMouseEvent *) override;
void wheelEvent(QWheelEvent *event) override;
void paintEvent(QPaintEvent *) override;
void resizeEvent(QResizeEvent *) override;
void tabInserted(int) override;
void tabRemoved(int index) override;
void drawTabCaption(QPainter *, const QString&, const QStyleOptionTab&);
void fillTabColor(QPainter *, const QStyleOptionTab&, uint, const QColor&);
QSize tabSizeHint(int index) const override;
void interruptTabMoving(int index);
private slots:
void onCloseButton();
void onCurrentChanged(int);
private:
QPalette m_palette;
bool m_usePalette = false;
int m_overIndex = -1;
int m_current = -1;
bool m_active = false;
bool m_isUIThemeDark = false;
bool m_tabWasMoved = false;
QString m_activeColor = "none";
int addTab(const QString &text);
int addTab(const QIcon &icon, const QString &text);
int count() const;
int currentIndex() const;
Qt::TextElideMode elideMode() const;
QSize iconSize() const;
int insertTab(int index, const QString &text);
int insertTab(int index, const QIcon &icon, const QString &text);
void moveTab(int from, int to);
void removeTab(int index);
void setElideMode(Qt::TextElideMode mode);
void setIconSize(const QSize &size);
void setTabIconLabel(int index, QWidget *widget);
void setTabButton(int index, QWidget *widget);
// void setTabData(int index, const QVariant &data);
void setTabIcon(int index, const QIcon &icon);
void setTabText(int index, const QString &text);
void setTabToolTip(int index, const QString &text);
void setCurrentIndex(int index);
void setActiveTabColor(int index, const QString&);
void setUseTabCustomPalette(int, bool);
void setTabLoading(int, bool);
void setTabIconTheme(int, TabTheme);
void tabStartLoading(int, const QString& theme = QString());
void setIgnoreActiveTabColor(bool ignore);
bool ignoreActiveTabColor();
void polish();
int tabIndexAt(const QPoint &pos) const;
QWidget* tabIconLabel(int index) const;
QWidget* tabButton(int index) const;
// QVariant tabData(int index) const;
QIcon tabIcon(int index) const;
QRect tabRect(int index) const;
QString tabText(int index) const;
QVariant tabProperty(int index, const char *name);
virtual void tabInserted(int index);
signals:
void tabUndock(int, bool *);
void currentChanged(int index);
void onCurrentChangedByWhell(int index);
void tabBarClicked(int index);
void tabBarDoubleClicked(int index);
void tabCloseRequested(int index);
void tabMoved(int from, int to);
void tabUndock(int index, bool &accepted);
protected:
virtual void resizeEvent(QResizeEvent *event) override;
virtual void wheelEvent(QWheelEvent *event) override;
virtual bool eventFilter(QObject*, QEvent*) override;
private:
Q_DECLARE_PRIVATE(QTabBar)
int m_scrollPos;
QFrame *m_pScrollerFrame;
QToolButton *m_pLeftButton,
*m_pRightButton;
void changeCustomScrollerState();
class CTabBarPrivate;
CTabBarPrivate* d = nullptr;
};
#endif // CTABBAR_H

View File

@ -1,97 +0,0 @@
#include "components/ctabbarwrapper.h"
#include <QGridLayout>
#include <QToolButton>
CTabBarWrapper::CTabBarWrapper(QWidget *parent):
QFrame(parent)
{
setObjectName(QString::fromUtf8("tabWrapper"));
setFrameShape(QFrame::NoFrame);
setFrameShadow(QFrame::Plain);
QGridLayout *_pTabFrameLayout = new QGridLayout(this);
_pTabFrameLayout->setSpacing(0);
_pTabFrameLayout->setContentsMargins(0,0,0,0);
this->setLayout(_pTabFrameLayout);
// Bypassing the bug with tab scroller
m_pScrollerFrame = new QFrame(this);
m_pScrollerFrame->setObjectName("scrollerFrame");
QHBoxLayout *_pScrollerLayout = new QHBoxLayout(m_pScrollerFrame);
_pScrollerLayout->setSpacing(0);
_pScrollerLayout->setContentsMargins(0,0,0,0);
m_pScrollerFrame->setLayout(_pScrollerLayout);
QToolButton* _pLeftButton = new QToolButton(m_pScrollerFrame);
QToolButton* _pRightButton = new QToolButton(m_pScrollerFrame);
_pLeftButton->setObjectName("leftButton");
_pRightButton->setObjectName("rightButton");
_pScrollerLayout->addWidget(_pLeftButton);
_pScrollerLayout->addWidget(_pRightButton);
_pLeftButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
_pRightButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
_pLeftButton->installEventFilter(this);
_pRightButton->installEventFilter(this);
_pLeftButton->setMouseTracking(true);
_pRightButton->setMouseTracking(true);
_pLeftButton->setAttribute(Qt::WA_Hover, true);
_pRightButton->setAttribute(Qt::WA_Hover, true); // End bypassing the bug
m_pBar = new CTabBar(this);
m_pBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
QWidget *_pPaddingWidget = new QWidget(this);
_pPaddingWidget->setObjectName("paddingWidget");
_pPaddingWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
QHBoxLayout *_pTabLayout = new QHBoxLayout();
#if (QT_VERSION < QT_VERSION_CHECK(5, 12, 2))
_pTabLayout->setSpacing(0);
#else
_pTabLayout->setSpacing(32);
#endif
_pTabLayout->setContentsMargins(0,0,0,0);
_pTabLayout->addWidget(m_pBar);
_pTabLayout->addWidget(_pPaddingWidget);
_pTabFrameLayout->addLayout(_pTabLayout, 0, 0, 1, 1);
_pTabFrameLayout->addWidget(m_pScrollerFrame, 0, 0, 1, 1, Qt::AlignRight);
m_pBar->initCustomScroll(m_pScrollerFrame, _pLeftButton, _pRightButton);
}
CTabBarWrapper::~CTabBarWrapper()
{
}
CTabBar *CTabBarWrapper::tabBar()
{
return m_pBar;
}
void CTabBarWrapper::applyTheme(const QString &style)
{
this->setStyleSheet(style);
m_pScrollerFrame->setStyleSheet(style);
m_pBar->setStyleSheet(style);
}
bool CTabBarWrapper::eventFilter(QObject *object, QEvent *event)
{
switch (event->type()) {
case QEvent::HoverEnter: {
if (object->objectName() == QString("leftButton") ||
object->objectName() == QString("rightButton")) {
m_pScrollerFrame->setCursor(QCursor(Qt::ArrowCursor));
}
break;
}
default:
break;
}
return QWidget::eventFilter(object, event);
}

View File

@ -1,23 +0,0 @@
#ifndef CTABBARWRAPPER_H
#define CTABBARWRAPPER_H
#include <QFrame>
#include "ctabbar.h"
class CTabBarWrapper: public QFrame
{
Q_OBJECT
public:
explicit CTabBarWrapper(QWidget *parent = nullptr);
~CTabBarWrapper();
CTabBar *tabBar();
void applyTheme(const QString &style);
private:
QFrame *m_pScrollerFrame;
CTabBar *m_pBar;
bool eventFilter(QObject *, QEvent *);
};
#endif // CTABBARWRAPPER_H

View File

@ -87,16 +87,7 @@ using namespace NSEditorApi;
CMainWindow::CMainWindow(const QRect &rect) :
CWindowPlatform(rect),
CScalingWrapper(m_dpiRatio),
m_pTabBarWrapper(nullptr),
m_pTabs(nullptr),
m_pButtonMain(nullptr),
m_pMainWidget(nullptr),
m_pButtonProfile(nullptr),
m_pWidgetDownload(nullptr),
m_savePortal(QString()),
m_isMaximized(false),
m_saveAction(0),
m_printData(nullptr)
m_savePortal(QString())
{
setObjectName("MainWindow");
m_pMainPanel = createMainPanel(this);
@ -117,8 +108,7 @@ CMainWindow::CMainWindow(const QRect &rect) :
CMainWindow::~CMainWindow()
{
if (m_printData)
delete m_printData, m_printData = nullptr;
}
/** Public **/
@ -185,7 +175,7 @@ int CMainWindow::attachEditor(QWidget * panel, const QPoint& pt)
_pt_local -= windowRect().topLeft();
# endif
#endif
int _index = tabWidget()->tabBar()->tabAt(_pt_local);
int _index = tabWidget()->tabBar()->tabIndexAt(_pt_local);
if ( !(_index < 0) ) {
QRect _rc_tab = tabWidget()->tabBar()->tabRect(_index);
if ( _pt_local.x() > _rc_tab.left() + (_rc_tab.width() / 2) ) ++_index;
@ -228,7 +218,7 @@ void CMainWindow::applyTheme(const std::wstring& theme)
}
}
m_boxTitleBtns->style()->polish(m_boxTitleBtns);
m_pTabBarWrapper->style()->polish(m_pTabBarWrapper);
m_pTabs->tabBar()->style()->polish(m_pTabs->tabBar());
m_pButtonMain->style()->polish(m_pButtonMain);
if (m_pTopButtons[BtnType::Btn_Minimize]) {
foreach (auto btn, m_pTopButtons)
@ -379,14 +369,17 @@ QWidget* CMainWindow::createMainPanel(QWidget *parent)
mainPanel->setLayout(_pMainGridLayout);
// Set custom TabBar
m_pTabBarWrapper = new CTabBarWrapper(mainPanel);
m_pTabBarWrapper->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
_pMainGridLayout->addWidget(m_pTabBarWrapper, 0, 1, 1, 1);
CTabBar *pTabBar = new CTabBar(mainPanel);
_pMainGridLayout->addWidget(pTabBar, 0, 1, 1, 1);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(1);
pTabBar->setSizePolicy(sizePolicy);
// QSize wide_btn_size(29*g_dpi_ratio, TOOLBTN_HEIGHT*g_dpi_ratio);
m_boxTitleBtns = createTopPanel(mainPanel);
m_boxTitleBtns->setObjectName("CX11Caption");
_pMainGridLayout->addWidget(m_boxTitleBtns, 0, 2, 1, 1);
m_boxTitleBtns->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
#ifdef __DONT_WRITE_IN_APP_TITLE
QLabel * label = new QLabel(m_boxTitleBtns);
@ -421,16 +414,16 @@ QWidget* CMainWindow::createMainPanel(QWidget *parent)
}
// m_pTabs->setAutoFillBackground(true);
// Set TabWidget
m_pTabs = new CAscTabWidget(mainPanel, tabBar());
m_pTabs = new CAscTabWidget(mainPanel, pTabBar);
m_pTabs->setObjectName(QString::fromUtf8("ascTabWidget"));
_pMainGridLayout->addWidget(m_pTabs, 1, 0, 1, 4);
_pMainGridLayout->addWidget(m_pTabs, 1, 0, 1, 3);
m_pTabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_pTabs->activate(false);
m_pTabs->applyUITheme(AscAppManager::themes().current().id());
connect(tabWidget(), SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
connect(tabBar(), SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)));
connect(tabBar(), SIGNAL(tabCloseRequested(int)), this, SLOT(onTabCloseRequest(int)));
connect(m_pTabs, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
connect(pTabBar, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)));
connect(pTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabCloseRequest(int)));
connect(m_pTabs, &CAscTabWidget::editorInserted, bind(&CMainWindow::onTabsCountChanged, this, _2, _1, 1));
connect(m_pTabs, &CAscTabWidget::editorRemoved, bind(&CMainWindow::onTabsCountChanged, this, _2, _1, -1));
m_pTabs->setPalette(palette);
@ -448,7 +441,7 @@ void CMainWindow::attachStartPanel(QCefView * const view)
QGridLayout *_pMainGridLayout = dynamic_cast<QGridLayout*>(m_pMainPanel->layout());
Q_ASSERT(_pMainGridLayout != nullptr);
if (_pMainGridLayout)
_pMainGridLayout->addWidget(m_pMainWidget, 1, 0, 1, 4);
_pMainGridLayout->addWidget(m_pMainWidget, 1, 0, 1, 3);
m_pMainWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
if (!m_pTabs->isActiveWidget())
m_pMainWidget->show();
@ -546,9 +539,9 @@ void CMainWindow::onEditorAllowedClose(int uid)
int _index = m_pTabs->tabIndexByView(uid);
if ( !(_index < 0) ) {
QWidget * _view = m_pTabs->widget(_index);
m_pTabs->removeWidget(_view);
_view->deleteLater();
m_pTabs->removeTab(_index);
//m_pTabs->adjustTabsSize();
onTabChanged(m_pTabs->currentIndex());
@ -1141,7 +1134,6 @@ void CMainWindow::onDocumentPrint(void * opts)
if ( !AscAppManager::printData().isQuickPrint() )
AscAppManager::printData().setPrinterInfo(*printer);
// m_printData->_print_range = dialog->printRange();
QVector<PageRanges> page_ranges;
#ifdef Q_OS_LINUX
@ -1379,9 +1371,9 @@ void CMainWindow::updateScalingFactor(double dpiratio)
m_pMainPanel->setProperty("zoom", QString::number(dpiratio) + "x");
std::vector<std::string> _files{":/styles/tabbar.qss"};
QString _style = Utils::readStylesheets(&_files);
m_pTabBarWrapper->applyTheme(_style);
m_pTabs->tabBar()->setStyleSheet(_style);
m_pTabs->setStyleSheet(_style);
m_pTabs->updateScalingFactor(dpiratio);
// m_pTabs->updateScalingFactor(dpiratio);
m_pTabs->reloadTabIcons();
m_pButtonMain->setIcon(MAIN_ICON_PATH, AscAppManager::themes().current().isDark() ? "logo-light" : "logo-dark");
m_pButtonMain->setIconSize(MAIN_ICON_SIZE * dpiratio);
@ -1437,11 +1429,6 @@ CAscTabWidget * CMainWindow::tabWidget()
return m_pTabs;
}
CTabBar *CMainWindow::tabBar()
{
return m_pTabBarWrapper->tabBar();
}
void CMainWindow::showEvent(QShowEvent * e)
{
CWindowPlatform::showEvent(e);

View File

@ -147,20 +147,16 @@ public slots:
private:
QWidget * createMainPanel(QWidget *parent);
inline CTabBar *tabBar();
int trySaveDocument(int);
CTabBarWrapper* m_pTabBarWrapper;
CAscTabWidget * m_pTabs;
CSVGPushButton* m_pButtonMain;
QWidget* m_pMainWidget;
QPushButton* m_pButtonProfile;
CDownloadWidget* m_pWidgetDownload;
CAscTabWidget * m_pTabs = nullptr;
CSVGPushButton* m_pButtonMain = nullptr;
QWidget* m_pMainWidget = nullptr;
QPushButton* m_pButtonProfile = nullptr;
CDownloadWidget* m_pWidgetDownload = nullptr;
QString m_savePortal;
bool m_isMaximized;
int m_saveAction;
struct printdata;
printdata* m_printData;
bool m_isMaximized = false;
int m_saveAction = 0;
bool m_isCloseAll = false;

View File

@ -226,11 +226,7 @@ bool CWindowBase::event(QEvent *event)
QWidget *wgt = qApp->widgetAt(hlp->globalPos());
if (wgt && !findChild<CToolTip*>()) {
QString text("");
CTabBar *bar = dynamic_cast<CTabBar*>(wgt);
if (bar) {
int index = bar->tabAt(bar->mapFromGlobal(hlp->globalPos()));
text = bar->tabProperty(index, "ToolTip").toString();
} else
if (wgt->property("ToolTip").isValid())
text = wgt->property("ToolTip").toString();
if (m_pMainPanel && !text.isEmpty()) {
CToolTip *tool = new CToolTip(m_pMainPanel, text, hlp->globalPos());