Fix bug with tab bar

This commit is contained in:
SimplestStudio
2022-02-10 10:34:16 +02:00
parent 2aa196b9b3
commit 54402aa2ec
25 changed files with 855 additions and 603 deletions

View File

@ -65,6 +65,7 @@ INCLUDEPATH += \
HEADERS += \
$$PWD/src/asctabwidget.h \
$$PWD/src/ctabbarwrapper.h \
$$PWD/src/version.h \
$$PWD/src/defines.h \
$$PWD/src/cdownloadwidget.h \
@ -109,6 +110,7 @@ HEADERS += \
SOURCES += \
$$PWD/src/csplash.cpp \
$$PWD/src/ctabbarwrapper.cpp \
$$PWD/src/main.cpp \
$$PWD/src/asctabwidget.cpp\
$$PWD/src/cdownloadwidget.cpp \

View File

@ -1,18 +1,74 @@
#mainPanel {
margin: 0;
padding: 0;
#mainPanel,
#tabWrapper {
margin: 0;
padding: 0;
background: #f1f1f1;
}
#centralWidget {
#CX11Caption {
min-width: 200px;
background: #f1f1f1;
}
#labelAppTitle {
color: #444;
background: transparent;
margin-top: -2px;
font-size: 11px;
}
#paddingWidget {
min-width: 0px;
max-width: 0px;
border: none; background: transparent;
}
#scrollerFrame {
min-width: 32px;
max-width: 32px;
border: none; background: transparent;
}
#scrollerFrame>QToolButton {
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.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp.png) center no-repeat;
}
QPushButton#toolButtonMaximize, QPushButton#toolButtonMain,
QPushButton#toolButtonMinimize, QPushButton#toolButtonClose,
QPushButton#toolButtonDownload {
@ -187,7 +243,10 @@ QPushButton#toolButtonDownload::menu-indicator {
/* dark theme definitions */
/**************************/
#mainPanel[uitheme=theme-dark], #mainPanel[uitheme=theme-dark] #centralWidget {
#mainPanel[uitheme=theme-dark],
#mainPanel[uitheme=theme-dark] #tabWrapper,
#mainPanel[uitheme=theme-dark] #CX11Caption,
#mainPanel[uitheme=theme-dark] QTabBar {
background-color: #404040;
}
@ -359,12 +418,10 @@ QPushButton#toolButtonDownload::menu-indicator {
QTabBar {
font-size: 11px;
background-color: #f1f1f1;
}
QTabBar::tab {
/*padding-left: 7px;*/
/*padding-right: 2px;*/
}
QTabBar::tab { }
QTabBar::tab::selected {
padding-left: 0px;
@ -378,12 +435,10 @@ QTabBar::tab:last { }
QTabBar::close-button {
image: url(:/res/icons/tab_close_normal.png);
margin-top: -1px;
/*padding: 7px;*/
icon-size:16px;
/*background-color: rgba(255, 255, 255, 0);*/
}
CAscTabBar::close-button:hover {
QTabBar::close-button:hover {
image:url(:/res/icons/tab_close_hover.png);
}
@ -398,64 +453,8 @@ QTabBar QToolButton,
width: 40px;
}
QTabBar QToolButton:hover {
background-color:#cecece;
}
QTabBar QToolButton:pressed {
background-color:#b7b7b7;
}
QTabBar QToolButton::left-arrow {
border-image: url(:/tabbar/icons/scrolltab_ln.png) 0 0 0 0 repeat;
border-width: 8px 0 8px 1px;
}
QTabBar QToolButton::left-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_ld.png) 0 0 0 0 repeat;
}
QTabBar QToolButton::left-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_lh.png) 0 0 0 0 repeat;
}
QTabBar QToolButton::left-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_lp.png) 0 0 0 0 repeat;
}
QTabBar QToolButton::right-arrow {
border-image: url(:/tabbar/icons/scrolltab_rn.png) 0 0 0 0 repeat;
border-width: 8px 0 8px 3px;
}
QTabBar QToolButton::right-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_rd.png) 0 0 0 0 repeat;
}
QTabBar QToolButton::right-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_rh.png) 0 0 0 0 repeat;
}
QTabBar QToolButton::right-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_rp.png) 0 0 0 0 repeat;
}
QTabBar::scroller {
/*padding-left: 0px;*/
/*margin-left: 0px;*/
/*background-color:#0f0;*/
width:16px;
}
QTabBar[scroll=var2] QToolButton::left-arrow {
border-width: 8px 12px 8px 8px;
}
QTabBar[scroll=var2] QToolButton::right-arrow {
border-width: 8px 8px 8px 12px;
}
QTabBar[scroll=var2]::scroller {
width:32px;
width 0px;
}
QLabel[class=tab-icon] {

View File

@ -1,9 +1,60 @@
#CX11Caption {
min-width: 250px;
}
#labelAppTitle {
margin-top: -2px;
font-size: 14px;
}
#paddingWidget {
min-width: 15px;
max-width: 15px;
}
#scrollerFrame {
min-width: 48px;
max-width: 48px;
}
#scrollerFrame>QToolButton {
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_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh_1.25x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp_1.25x.png) center no-repeat;
}
QPushButton#toolButtonDownload {
padding: 7px;
}
@ -100,46 +151,9 @@ QTabBar QToolButton,
border-width:2px;
}
QTabBar[scroll=var2] QToolButton::left-arrow,
QTabBar QToolButton::left-arrow {
border-image: url(:/tabbar/icons/scrolltab_ln_1.25x.png) 0;
border-width:10px 1px 10px 1px;
}
QTabBar QToolButton::left-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_ld_1.25x.png) 0;
}
QTabBar QToolButton::left-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_lh_1.25x.png) 0;
}
QTabBar QToolButton::left-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_lp_1.25x.png) 0;
}
QTabBar[scroll=var2] QToolButton::right-arrow,
QTabBar QToolButton::right-arrow {
border-image: url(:/tabbar/icons/scrolltab_rn_1.25x.png) 0;
/*border-width:12px;*/
border-width:10px 1px 10px 20px;
width:12px;
}
QTabBar QToolButton::right-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_rd_1.25x.png) 0;
}
QTabBar QToolButton::right-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_rh_1.25x.png) 0;
}
QTabBar QToolButton::right-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_rp_1.25x.png) 0;
}
QTabBar[scroll=var2]::scroller,
QTabBar::scroller {
width:40px;
width: 0px;
}
QTabBar QToolButton[class=tab-close]{

View File

@ -1,9 +1,60 @@
#CX11Caption {
min-width: 300px;
}
#labelAppTitle {
margin-top: -3px;
font-size: 17px;
}
#paddingWidget {
min-width: 15px;
max-width: 15px;
}
#scrollerFrame {
min-width: 48px;
max-width: 48px;
}
#scrollerFrame>QToolButton {
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_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh_1.5x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp_1.5x.png) center no-repeat;
}
QPushButton#toolButtonDownload {
padding: 9px;
}
@ -101,46 +152,9 @@ QTabBar QToolButton,
border-width:2px;
}
QTabBar[scroll=var2] QToolButton::left-arrow,
QTabBar QToolButton::left-arrow {
border-image: url(:/tabbar/icons/scrolltab_ln_1.5x.png) 0;
border-width:12px 2px 12px 2px;
}
QTabBar QToolButton::left-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_ld_1.5x.png) 0;
}
QTabBar QToolButton::left-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_lh_1.5x.png) 0;
}
QTabBar QToolButton::left-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_lp_1.5x.png) 0;
}
QTabBar[scroll=var2] QToolButton::right-arrow,
QTabBar QToolButton::right-arrow {
border-image: url(:/tabbar/icons/scrolltab_rn_1.5x.png) 0;
/*border-width:12px;*/
border-width:12px 2px 12px 24px;
width:12px;
}
QTabBar QToolButton::right-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_rd_1.5x.png) 0;
}
QTabBar QToolButton::right-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_rh_1.5x.png) 0;
}
QTabBar QToolButton::right-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_rp_1.5x.png) 0;
}
QTabBar[scroll=var2]::scroller,
QTabBar::scroller {
width:48px;
width: 0px;
}
QTabBar QToolButton[class=tab-close]{

View File

@ -1,9 +1,62 @@
#CX11Caption {
min-width: 350px;
}
#labelAppTitle {
margin-top: -4px;
font-size: 20px;
}
#paddingWidget {
min-width: 31px;
max-width: 31px;
}
#scrollerFrame {
min-width: 64px;
max-width: 64px;
}
#scrollerFrame>QToolButton {
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_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh_1.75x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp_1.75x.png) center no-repeat;
}
QPushButton#toolButtonDownload {
padding: 11px;
}
@ -101,46 +154,9 @@ QTabBar QToolButton,
border-width:2px;
}
QTabBar[scroll=var2] QToolButton::left-arrow,
QTabBar QToolButton::left-arrow {
border-image: url(:/tabbar/icons/scrolltab_ln_1.75x.png) 0;
border-width:14px 2px 14px 2px;
}
QTabBar QToolButton::left-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_ld_1.75x.png) 0;
}
QTabBar QToolButton::left-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_lh_1.75x.png) 0;
}
QTabBar QToolButton::left-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_lp_1.75x.png) 0;
}
QTabBar[scroll=var2] QToolButton::right-arrow,
QTabBar QToolButton::right-arrow {
border-image: url(:/tabbar/icons/scrolltab_rn_1.75x.png) 0;
/*border-width:12px;*/
border-width:14px 2px 14px 28px;
width:12px;
}
QTabBar QToolButton::right-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_rd_1.75x.png) 0;
}
QTabBar QToolButton::right-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_rh_1.75x.png) 0;
}
QTabBar QToolButton::right-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_rp_1.75x.png) 0;
}
QTabBar[scroll=var2]::scroller,
QTabBar::scroller {
width:48px;
width: 0px;
}
QTabBar QToolButton[class=tab-close]{

View File

@ -1,9 +1,60 @@
#CX11Caption {
min-width: 350px;
}
#labelAppTitle {
margin-top: -4px;
font-size: 22px;
}
#paddingWidget {
min-width: 31px;
max-width: 31px;
}
#scrollerFrame {
min-width: 64px;
max-width: 64px;
}
#scrollerFrame>QToolButton {
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_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:disabled {
image: url(:/tabbar/icons/scrolltab_ld_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:hover {
image: url(:/tabbar/icons/scrolltab_lh_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#leftButton:pressed {
image: url(:/tabbar/icons/scrolltab_lp_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton {
image: url(:/tabbar/icons/scrolltab_rn_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:disabled {
image: url(:/tabbar/icons/scrolltab_rd_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:hover {
image: url(:/tabbar/icons/scrolltab_rh_2x.png) center no-repeat;
}
#scrollerFrame>QToolButton#rightButton:pressed {
image: url(:/tabbar/icons/scrolltab_rp_2x.png) center no-repeat;
}
QPushButton#toolButtonDownload {
padding: 12px;
}
@ -96,8 +147,6 @@ QTabBar::tab {
QTabBar::close-button {
image: url(:/res/icons/tab_close_normal_2x.png);
/*border-image: none;*/
/*margin-right:10px;*/
margin-top: -2px;
icon-size: 32px;
}
@ -116,46 +165,9 @@ QTabBar QToolButton,
border-width:2px;
}
QTabBar[scroll=var2] QToolButton::left-arrow,
QTabBar QToolButton::left-arrow {
border-image: url(:/tabbar/icons/scrolltab_ln_2x.png) 0;
/*border-width:12px;*/
border-width:16px 0 16px 2px;
}
QTabBar QToolButton::left-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_ld_2x.png) 0;
}
QTabBar QToolButton::left-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_lh_2x.png) 0;
}
QTabBar QToolButton::left-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_lp_2x.png) 0;
}
QTabBar[scroll=var2] QToolButton::right-arrow,
QTabBar QToolButton::right-arrow {
border-image: url(:/tabbar/icons/scrolltab_rn_2x.png) 0;
/*border-width:12px;*/
border-width:16px 0 16px 26px;
}
QTabBar QToolButton::right-arrow:disabled {
border-image: url(:/tabbar/icons/scrolltab_rd_2x.png) 0;
}
QTabBar QToolButton::right-arrow:hover {
border-image: url(:/tabbar/icons/scrolltab_rh_2x.png) 0;
}
QTabBar QToolButton::right-arrow:pressed {
border-image: url(:/tabbar/icons/scrolltab_rp_2x.png) 0;
}
QTabBar[scroll=var2]::scroller,
QTabBar::scroller {
width:48px;
width: 0px;
}
/* download widget */
@ -206,7 +218,7 @@ QTabBar QToolButton[class=tab-close][state=active]{
background-image:url(:/tabbar/icons/close_active_2x.png);
}
QTabBar QToolButton[class=tab-close]:hover{
border-right:2px solid #fff; /* ??? pixmap offsets on hover for 2px ??? */
border-right:2px solid #fff;
}
QPrintDialog QLabel {

View File

@ -1,16 +1,24 @@
/* styles for a frameless main window */
QTabWidget::pane {background-color: #f1f1f1; border:none;}
QTabWidget::tab-bar {width: auto; height: 28px; left: 112px; }
QTabBar::tab { width:135px; background-color: #f1f1f1; border: 0 none; min-width: 41px; max-width: 135px;
height: 28px; margin: 0 0 0 0; }
QTabWidget::pane {background-color: #f1f1f1; border: none;}
QTabBar::tab {width: 135px; background-color: #f1f1f1; border: 0 none; border-right: 1px solid #a5a5a5; min-width: 41px; max-width: 135px;
height: 28px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
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;}
QTabBar::tab {border-right: 1px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabWidget[active=false] QTabBar::tab:selected {background-color: #f1f1f1;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cecece;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#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: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -1,22 +1,24 @@
QTabWidget::pane {background-color: #f1f1f1; border:none;}
QTabWidget::tab-bar {width: auto; height: 35px; left: 140px; }
QTabWidget::pane {background-color: #f1f1f1; border: none;}
QTabBar::tab {width: 169px; background-color: #f1f1f1; border: 0 none; border-right: 1px solid #a5a5a5; min-width: 51px; max-width: 169px;
height: 35px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
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;}
QTabBar::tab { width:169px; background-color: #f1f1f1; border: 0 none; min-width: 51px; max-width: 169px;
height: 35px; margin: 0 0 0 0; }
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabBar::tab {border-right: 1px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
QTabWidget[active=false] QTabBar::tab:selected {background-color: #f1f1f1;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cecece;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#mainPanel[uitheme=theme-dark] QTabWidget::pane {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #555;}
#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: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: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -1,22 +1,24 @@
QTabWidget::pane {background-color: #f1f1f1; border:none;}
QTabWidget::tab-bar {width: auto; height: 42px; left: 168px; }
QTabWidget::pane {background-color: #f1f1f1; border: none;}
QTabBar::tab {width: 203px; background-color: #f1f1f1; border: 0 none; border-right: 2px solid #a5a5a5; min-width: 62px; max-width: 203px;
height: 42px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
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;}
QTabBar::tab { width:203px; background-color: #f1f1f1; border: 0 none; min-width: 62px; max-width: 203px;
height: 42px; margin: 0 0 0 0; }
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabBar::tab {border-right: 2px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
QTabWidget[active=false] QTabBar::tab:selected {background-color: #f1f1f1;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cecece;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#mainPanel[uitheme=theme-dark] QTabWidget::pane {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #555;}
#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: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: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -1,22 +1,24 @@
QTabWidget::pane {background-color: #f1f1f1; border:none;}
QTabWidget::tab-bar {width: auto; height: 49px; left: 196px; }
QTabWidget::pane {background-color: #f1f1f1; border: none;}
QTabBar::tab {width: 236px; background-color: #f1f1f1; border: 0 none; border-right: 2px solid #a5a5a5; min-width: 72px; max-width: 236px;
height: 49px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
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;}
QTabBar::tab { width:236px; background-color: #f1f1f1; border: 0 none; min-width: 72px; max-width: 236px;
height: 49px; margin: 0 0 0 0; }
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabBar::tab {border-right: 2px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
QTabWidget[active=false] QTabBar::tab:selected {background-color: #f1f1f1;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cecece;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#mainPanel[uitheme=theme-dark] QTabWidget::pane {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #555;}
#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: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: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -1,22 +1,24 @@
QTabWidget::pane {background-color: #f1f1f1; border:none;}
QTabWidget::tab-bar {width: auto; height: 56px; left: 224px; }
QTabWidget::pane {background-color: #f1f1f1; border: none;}
QTabBar::tab {width: 270px; background-color: #f1f1f1; border: 0 none; border-right: 2px solid #a5a5a5; min-width: 82px; max-width: 270px;
height: 56px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
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;}
QTabBar::tab { width:270px; background-color: #f1f1f1; border: 0 none; min-width: 82px; max-width: 270px;
height: 56px; margin: 0 0 0 0; }
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabBar::tab {border-right: 2px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
QTabWidget[active=false] QTabBar::tab:selected {background-color: #f1f1f1;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cecece;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#mainPanel[uitheme=theme-dark] QTabWidget::pane {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected {background-color: #404040;}
#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #555;}
#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: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: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -1,15 +1,27 @@
QTabWidget::pane { border:none; /*border-top: 1px solid #b00; top:-1px;*/}
QTabWidget[empty=true]::pane { top: 28px; }
QTabWidget::tab-bar {width: auto; height: 28px; left: 112px; }
QTabBar::tab { width:135px; background-color: #c2c2c2; border: 0 none; min-width: 41px; max-width: 135px;
height: 28px; margin: 0 0 0 0; }
QTabWidget::pane {border: none;}
QTabBar::tab {width: 135px; background-color: #c2c2c2; border: 0 none; border-right: 1px solid #a5a5a5; min-width: 41px; max-width: 135px;
height: 28px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
QTabBar[active=false]::tab:selected {background-color: #c2c2c2;}
QTabBar[active=true]::tab:selected {background-color:#c2c2c2; border-color:#a5a5a5;}
QTabBar[active=false]::tab:selected:hover {background-color: #cfcfcf;}
QTabBar::tab {border-right: 1px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabWidget[active=false] QTabBar::tab:selected {background-color:#c2c2c2; border-color:#a5a5a5;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cfcfcf;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
#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;}
#scrollerFrame>QToolButton {margin: 0px; border: none; background-color: #c2c2c2;}
#scrollerFrame>QToolButton:hover {background-color: #cecece;}
#scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton {background-color: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -1,15 +1,27 @@
QTabWidget::pane { border:none;/*border-top: 2px solid #b6b6b6; top:-2px;*/}
QTabWidget::tab-bar {width: auto; height: 56px; left: 224px; }
QTabWidget::pane {border: none;}
QTabBar::tab {width: 270px; background-color: #c2c2c2; border: 0 none; border-right: 2px solid #a5a5a5; min-width: 82px; max-width: 270px;
height: 56px; margin: 0 0 0 0;}
QTabBar::tab:hover {background-color: #cecece;}
QTabBar::tab-label {active: #fff; normal: #444;}
QTabBar::tab-icon {width: 15; height: 15;}
QTabBar[active=false]::tab:selected {background-color: #c2c2c2;}
QTabBar[active=true]::tab:selected {background-color: #c2c2c2; border-color: #a5a5a5;}
QTabBar[active=false]::tab:selected:hover {background-color: #cfcfcf;}
QTabBar::tab { width:270px; background-color: #c2c2c2; border: 0 none; min-width: 82px; max-width: 270px;
height: 56px; margin: 0 0 0 0; }
#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}
QTabBar::tab {border-right: 2px solid #a5a5a5;}
QTabBar::tab:hover{background-color: #cecece;}
QTabBar::tab:selected{background-color: #515252;}
QTabBar::tab-label{active:#fff;normal:#444;}
QTabBar::tab-icon{width:15;height:15;}
#mainPanel[uitheme=theme-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}
QTabWidget[active=false] QTabBar::tab:selected {background-color:#c2c2c2; border-color:#a5a5a5;}
QTabWidget[active=false] QTabBar::tab:selected:hover {background-color: #cfcfcf;}
#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;}
#scrollerFrame>QToolButton {margin: 0px; border: none; background-color: #c2c2c2;}
#scrollerFrame>QToolButton:hover {background-color: #cecece;}
#scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton {background-color: #606060;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:hover {background-color: #555;}
#mainPanel[uitheme=theme-dark] #scrollerFrame>QToolButton:pressed {background-color: #b7b7b7;}

View File

@ -43,7 +43,6 @@
#include <QTimer>
#include <regex>
#include "ctabbar.h"
#include "ctabstyle.h"
#include "casctabdata.h"
#include "common/Types.h"
@ -61,15 +60,6 @@
using namespace std;
const QString g_dark_theme_stylesheet =
"#mainPanel[uitheme=theme-dark] QTabWidget::pane {background-color: #404040;}"
"#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:selected {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-classic-light] QTabBar::tab {border-right-color:#cbcbcb;}"
"#mainPanel[uitheme=theme-light] QTabBar::tab {border-right-color:#dfdfdf;}"
"#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab {background-color: #404040;}"
"#mainPanel[uitheme=theme-dark] QTabWidget[active=false] QTabBar::tab:hover{background-color: #555;}";
/*
@ -136,8 +126,11 @@ COpenOptions::COpenOptions(QString _name_, AscEditorType _srctype_) :
auto createTabPanel(QWidget * parent, CTabPanel * panel = nullptr) -> QWidget * {
QWidget * panelwidget = new QWidget(parent);
panelwidget->setLayout(new QGridLayout);
panelwidget->layout()->setContentsMargins(0,0,0,0);
panelwidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QGridLayout *layout = new QGridLayout(panelwidget);
layout->setSpacing(0);
layout->setContentsMargins(0,0,0,0);
panelwidget->setLayout(layout);
panelwidget->layout()->addWidget(panel ? panel : new CTabPanel);
return panelwidget;
@ -147,42 +140,39 @@ auto panelfromwidget(QWidget * panelwidget) -> CTabPanel * {
return panelwidget->children().count() ? static_cast<CTabPanel *>(panelwidget->findChild<CTabPanel*>()) : nullptr;
}
CAscTabWidget::CAscTabWidget(QWidget *parent)
CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar, QPushButton *_pButtonMain)
: QTabWidget(parent)
, CScalingWrapper(parent)
, m_pMainButton(NULL)
, m_pMainButton(_pButtonMain)
, m_dataFullScreen(0)
, m_widthParams({{100, 135, 9}, 68, 3, 0, WINDOW_TITLE_MIN_WIDTH, 140, 0})
, m_defWidthParams(m_widthParams)
, m_isCustomStyle(true)
, m_tabIconSize(11, 11)
, m_pBar(_pBar)
{
CTabBar * tabs = new CTabBar(this);
tabs->setObjectName("asc_editors_tabbar");
tabs->setTabTextColor(QPalette::Active, QColor(51, 51, 51));
tabs->setTabTextColor(QPalette::Inactive, QColor(51, 51, 51));
setTabBar(tabs);
QTabWidget* _pBaseTabWidget = static_cast<QTabWidget*>(this);
_pBaseTabWidget->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));
// tabBar()->setStyle(new CTabStyle);
// tabBar()->setFixedWidth(450);
tabBar()->setMovable(true);
tabBar()->setExpanding(false);
setTabsClosable(true);
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, &QTabWidget::currentChanged, [=](){
QObject::connect(this, &CAscTabWidget::currentChanged, this, [=]() {
updateIcons();
setFocusedView();
_dropedindex = -1;
});
QObject::connect(tabs, &CTabBar::tabUndock, [=](int index, bool * accept){
QObject::connect(m_pBar, &CTabBar::tabUndock, this, [=](int index, bool * accept) {
if (index == _dropedindex) return;
const CTabPanel * _panel = panel(index);
@ -195,13 +185,24 @@ CAscTabWidget::CAscTabWidget(QWidget *parent)
_dropedindex = index;
*accept = true;
QTimer::singleShot(10,[=](){
if ( widget(index) )
QTimer::singleShot(10, this, [=]() {
if (widget(index)) {
m_pBar->removeTab(index);
widget(index)->deleteLater();
}
});
}
}
});
QObject::connect(m_pBar, &CTabBar::tabBarClicked, this, [=](int index) {
this->setCurrentIndex(index);
});
QObject::connect(m_pBar, &CTabBar::onCurrentChangedByWhell, this, [=](int index) {
this->setCurrentIndex(index);
});
QObject::connect(m_pBar, &CTabBar::tabMoved, this, [=](int from, int to) {
_pBaseTabWidget->tabBar()->moveTab(from, to);
});
}
CTabPanel * CAscTabWidget::panel(int index) const
@ -210,6 +211,11 @@ CTabPanel * CAscTabWidget::panel(int index) const
return _w->children().count() ? static_cast<CTabPanel *>(_w->findChild<CTabPanel*>()) : nullptr;
}
CTabBar *CAscTabWidget::tabBar() const
{
return m_pBar;
}
int CAscTabWidget::addEditor(const COpenOptions& opts)
{
if ( opts.url.isEmpty() && opts.srctype != etNewFile )
@ -228,7 +234,6 @@ int CAscTabWidget::addEditor(const COpenOptions& opts)
QWidget * panelwidget = createTabPanel(this);
CTabPanel * pView = panelfromwidget(panelwidget);
pView->setGeometry(0,0, size().width(), size().height() - tabBar()->height());
pView->initAsEditor();
int tab_index = -1;
@ -259,8 +264,10 @@ int CAscTabWidget::addEditor(const COpenOptions& opts)
pView->setData(data);
tab_index = addTab(panelwidget, data->title());
tabBar()->setTabToolTip(tab_index, data->title());
((CTabBar *)tabBar())->tabStartLoading(tab_index);
m_pBar->addTab(data->title());
m_pBar->setTabToolTip(tab_index, data->title());
m_pBar->tabStartLoading(tab_index);
m_pBar->setCurrentIndex(tab_index);
//TODO: test for safe remove
// applyDocumentChanging(id_view, opts.type);
@ -367,7 +374,6 @@ int CAscTabWidget::addPortal(const QString& url, const QString& name, const QStr
QWidget * panelwidget = createTabPanel(this);
CTabPanel * pView = panelfromwidget(panelwidget);
pView->setGeometry(0,0, size().width(), size().height() - tabBar()->height());
pView->initAsSimple();
pView->cef()->SetExternalCloud(provider.toStdWString());
pView->cef()->load((_url + entrypage + args).toStdWString());
@ -381,9 +387,11 @@ int CAscTabWidget::addPortal(const QString& url, const QString& name, const QStr
int tab_index = -1;
tab_index = insertTab(tab_index, panelwidget, portal);
tabBar()->setTabToolTip(tab_index, _url);
((CTabBar *)tabBar())->setTabTheme(tab_index, CTabBar::LightTab);
((CTabBar *)tabBar())->tabStartLoading(tab_index);
m_pBar->insertTab(tab_index, portal);
m_pBar->setTabToolTip(tab_index, _url);
m_pBar->setTabTheme(tab_index, CTabBar::LightTab);
m_pBar->tabStartLoading(tab_index);
m_pBar->setCurrentIndex(tab_index);
// updateTabIcon(tabIndexByView(id));
@ -398,7 +406,6 @@ int CAscTabWidget::addOAuthPortal(const QString& portal, const QString& type, co
QWidget * panelwidget = createTabPanel(this);
CTabPanel * pView = panelfromwidget(panelwidget);
pView->setGeometry(0,0, size().width(), size().height() - tabBar()->height());
pView->initAsSimple();
if ( type == "sso" ) {
@ -421,9 +428,11 @@ int CAscTabWidget::addOAuthPortal(const QString& portal, const QString& type, co
int tab_index = -1;
tab_index = insertTab(tab_index, panelwidget, _portal);
tabBar()->setTabToolTip(tab_index, portal);
((CTabBar *)tabBar())->setTabTheme(tab_index, CTabBar::LightTab);
((CTabBar *)tabBar())->tabStartLoading(tab_index);
m_pBar->insertTab(tab_index, _portal);
m_pBar->setTabToolTip(tab_index, portal);
m_pBar->setTabTheme(tab_index, CTabBar::LightTab);
m_pBar->tabStartLoading(tab_index);
m_pBar->setCurrentIndex(tab_index);
return tab_index;
}
@ -433,98 +442,31 @@ int CAscTabWidget::insertPanel(QWidget * panel, int index)
int tabindex = -1;
CTabPanel * _panel = dynamic_cast<CTabPanel *>(panel);
Q_ASSERT(_panel != nullptr);
if ( _panel ) {
const CAscTabData * tabdata = _panel->data();
QWidget * panelwidget = createTabPanel(this, _panel);
tabindex = insertTab(index, panelwidget, tabdata->title());
tabBar()->setTabToolTip(tabindex, tabdata->title() );
m_pBar->insertTab(index, tabdata->title());
m_pBar->setTabToolTip(tabindex, tabdata->title());
m_pBar->setCurrentIndex(tabindex);
}
return tabindex;
}
void CAscTabWidget::resizeEvent(QResizeEvent* e)
{
Q_UNUSED(e);
adjustTabsSize();
// if (e) {
// int w = e->size().width(),
// h = e->size().height() - tabBar()->height();
// CTabPanel * view = nullptr;
// for (int i(count()); i > 0;) {
// if (--i != currentIndex()) {
// view = panel(i);
// if (view) {
//// view->cef()->resizeEvent(w, h);
// view->resize(w,h);
// }
// }
// }
// }
}
void CAscTabWidget::tabInserted(int index)
{
adjustTabsSize();
emit editorInserted(index, count());
}
void CAscTabWidget::tabRemoved(int index)
{
adjustTabsSize();
emit editorRemoved(index, count());
}
void CAscTabWidget::adjustTabsSize()
{
// int nMin = 41 * g_dpi_ratio; // min tab width
// int nMax = 135 * g_dpi_ratio; // max tab width
// int nFirst = 44 * g_dpi_ratio; // main button's width
// int nStartOffset = 5 * g_dpi_ratio; // offset from main button
// int nBetweenApp = 5 * g_dpi_ratio; //
// int nButtonW = 16 * g_dpi_ratio; // tool button width
// int nEndOffset = 140 * g_dpi_ratio; // space for a caption
int nTabBarWidth = 0,
nTabWidth = m_widthParams.tab.max,
nCountTabs = tabBar()->count();
if (nCountTabs != 0) {
int nControlWidth = parentWidget()->width();
nTabBarWidth = m_isCustomStyle ?
nControlWidth
- m_widthParams.main_button_width - m_widthParams.main_button_span
- m_widthParams.title_width - m_widthParams.tools_width - m_widthParams.custom_offset :
nControlWidth - m_widthParams.main_button_width;
// int nTabWidth = (nTabBarWidth - /*(2+2)*/10 * nCountTabs) / nCountTabs; // magic (2+2)
// if (nTabWidth > m_widthParams.tab.max) nTabWidth = m_widthParams.tab.max;
// if (nTabWidth < m_widthParams.tab.min) nTabWidth = m_widthParams.tab.min;
int nMinTabBarWidth = (nTabWidth + /*(2+2)*/(10 * scaling()/*?*/)) * nCountTabs;
if (nTabBarWidth > nMinTabBarWidth) nTabBarWidth = nMinTabBarWidth;
}
#if 1
QString cssStyle = styleSheet();
cssStyle
.replace(QRegExp("QTabWidget::tab-bar\\s?\\{\\s?width\\:\\s?(\\-?\\d+px|auto)", Qt::CaseInsensitive),
QString("QTabWidget::tab-bar { width: %1px").arg(nTabBarWidth));
// .replace(QRegExp("QTabBar::tab\\s?\\{\\s?width\\:\\s?\\d+px", Qt::CaseInsensitive),
// QString("QTabBar::tab { width: %1px").arg(nTabWidth));
QTabWidget::setStyleSheet(cssStyle);
#else
tabBar()->setFixedWidth(nTabBarWidth);
#endif
}
void CAscTabWidget::setCustomWindowParams(bool iscustom)
{
m_isCustomStyle = iscustom;
@ -585,16 +527,15 @@ void CAscTabWidget::updateTabIcon(int index)
}
QString icon_name = is_active ? m_mapTabIcons.at(tab_type).second : m_mapTabIcons.at(tab_type).first;
CTabBar & tabbar = *static_cast<CTabBar *>(tabBar());
tabbar.setTabIcon(index, QIcon(icon_name));
m_pBar->setTabIcon(index, QIcon(icon_name));
// ((CTabBar *)tabBar())->changeTabTheme(index, _theme);
tabbar.setTabTheme(index, tab_theme);
m_pBar->setTabTheme(index, tab_theme);
if ( index == currentIndex() ) {
tabbar.setActiveTabColor(active_tab_color);
m_pBar->setActiveTabColor(active_tab_color);
// ((CTabBar *)tabBar())->setUseTabCustomPalette( !(tab_type == etPortal || tab_type == etUndefined) );
tabbar.setTabTextColor(QPalette::Active, AscAppManager::themes().isColorDark(active_tab_color) ?
m_pBar->setTabTextColor(QPalette::Active, AscAppManager::themes().isColorDark(active_tab_color) ?
ui_theme.color(CTheme::ColorRole::ecrTextPressed) : ui_theme.color(CTheme::ColorRole::ecrTabSimpleActiveText));
}
@ -639,6 +580,7 @@ void CAscTabWidget::reloadTabIcons()
void CAscTabWidget::editorCloseRequest(int index)
{
m_pBar->removeTab(index);
panel(index)->data()->close();
}
@ -724,7 +666,7 @@ int CAscTabWidget::openCloudDocument(COpenOptions& opts, bool select, bool force
if (opts.id > 0 && !forcenew) {
tabIndex = tabIndexByView(opts.id);
if (!(tabIndex < 0))
setCurrentIndex(tabIndex);
m_pBar->setCurrentIndex(tabIndex);
} else {
opts.name = tr("Document");
// opts.type = etUndefined;
@ -733,7 +675,7 @@ int CAscTabWidget::openCloudDocument(COpenOptions& opts, bool select, bool force
updateIcons();
if (select && !(tabIndex < 0))
tabBar()->setCurrentIndex(tabIndex);
m_pBar->setCurrentIndex(tabIndex);
}
return tabIndex;
@ -761,7 +703,7 @@ int CAscTabWidget::openLocalDocument(const COpenOptions& options, bool select, b
}
if (select && !(tabIndex < 0))
tabBar()->setCurrentIndex(tabIndex);
m_pBar->setCurrentIndex(tabIndex);
/* TODO: rise message if index < 0 */
@ -817,7 +759,7 @@ void CAscTabWidget::closePortal(const wstring& url, bool editors)
if (editors) {
const CAscTabData * doc;
for (int i = tabBar()->count(); i-- > 0; ) {
for (int i = m_pBar->count(); i-- > 0; ) {
doc = panel(i)->data();
if (doc->viewType() == cvwtEditor &&
@ -841,8 +783,8 @@ void CAscTabWidget::applyDocumentChanging(int viewId, const QString& name, const
doc->setUrl( Utils::replaceBackslash(_path) );
}
tabBar()->setTabText(tabIndex, doc->title());
tabBar()->setTabToolTip(tabIndex, path.isEmpty() ? doc->title() : path);
m_pBar->setTabText(tabIndex, doc->title());
m_pBar->setTabToolTip(tabIndex, path.isEmpty() ? doc->title() : path);
}
}
@ -860,8 +802,8 @@ void CAscTabWidget::applyDocumentChanging(int viewId, bool state)
if (doc->hasChanges() != state && (!doc->closed() || state)) {
doc->setChanged(state);
tabBar()->setTabText(tabIndex, doc->title());
tabBar()->setTabToolTip(tabIndex, doc->title());
m_pBar->setTabText(tabIndex, doc->title());
m_pBar->setTabToolTip(tabIndex, doc->title());
}
}
}
@ -886,14 +828,14 @@ void CAscTabWidget::applyDocumentChanging(int id, int type)
return;
} else
if ( type == DOCUMENT_CHANGED_LOADING_FINISH ) {
((CTabBar *)tabBar())->setTabLoading(tabIndex, false);
m_pBar->setTabLoading(tabIndex, false);
panel(tabIndex)->applyLoader("hide");
return;
} else
if ( type == DOCUMENT_CHANGED_PAGE_LOAD_FINISH ) {
if ( !panel(tabIndex)->data()->eventLoadSupported() ) {
((CTabBar *)tabBar())->setTabLoading(tabIndex, false);
m_pBar->setTabLoading(tabIndex, false);
panel(tabIndex)->applyLoader("hide");
}
@ -901,7 +843,6 @@ void CAscTabWidget::applyDocumentChanging(int id, int type)
}
}
if ( !(tabIndex < 0) ) {
panel(tabIndex)->data()->setContentType(AscEditorType(type));
@ -914,7 +855,6 @@ void CAscTabWidget::applyDocumentChanging(int id, int type)
}
updateTabIcon(tabIndexByView(id));
tabBar()->style()->polish(tabBar());
}
void CAscTabWidget::setEditorOptions(int id, const wstring& option)
@ -967,24 +907,22 @@ void CAscTabWidget::setFocusedView(int index)
void CAscTabWidget::activate(bool a)
{
this->setHidden(!a);
if (property("active").toBool() != a) {
setProperty("active", a);
style()->polish(tabBar());
this->setProperty("active", a);
m_pBar->setProperty("active", a);
}
QString strVal = a ? "normal" : "active";
if (m_pMainButton != NULL && m_pMainButton->property("class") != strVal) {
m_pMainButton->setProperty("class", strVal);
m_pMainButton->style()->polish(m_pMainButton);
m_pMainButton->update();
}
updateTabIcon(currentIndex());
((CTabBar*)tabBar())->activate(a);
((CTabBar*)tabBar())->customColors().setCurrentColorGroup(
a ? QPalette::Normal : QPalette::Disabled );
tabBar()->repaint();
m_pBar->activate(a);
m_pBar->customColors().setCurrentColorGroup(a ? QPalette::Normal : QPalette::Disabled );
m_pBar->repaint();
}
bool CAscTabWidget::isActiveWidget()
@ -997,7 +935,7 @@ int CAscTabWidget::modifiedCount()
int mod_count = 0;
const CAscTabData * doc;
for (int i = tabBar()->count(); i-- > 0; ) {
for (int i = m_pBar->count(); i-- > 0; ) {
doc = panel(i)->data();
doc->hasChanges() && mod_count++;
}
@ -1068,7 +1006,7 @@ MapEditors CAscTabWidget::modified(const QString& portalname)
QMap<int, QString> mapModified;
wstring portal = portalname.toStdWString();
const CAscTabData * doc;
for (int i(tabBar()->count()); i-- > 0; i++) {
for (int i(m_pBar->count()); i-- > 0; i++) {
doc = panel(i)->data();
if (doc->isViewType(cvwtEditor) &&
@ -1086,7 +1024,7 @@ int CAscTabWidget::findModified(const QString& portalname)
{
wstring portal = portalname.toStdWString();
const CAscTabData * doc;
for (int i(tabBar()->count()); i-- > 0; ) {
for (int i(m_pBar->count()); i-- > 0; ) {
doc = panel(i)->data();
if ( !doc->closed() && doc->isViewType(cvwtEditor) &&
@ -1106,7 +1044,7 @@ int CAscTabWidget::findFragmented(const QString& portalname)
wstring portal = portalname.toStdWString();
const CAscTabData * doc;
const CTabPanel * cefpanel;
for (int i(tabBar()->count()); i-- > 0; ) {
for (int i(m_pBar->count()); i-- > 0; ) {
cefpanel = panel(i);
doc = cefpanel->data();
if ( !doc->closed() && doc->isViewType(cvwtEditor) &&
@ -1224,6 +1162,7 @@ void CAscTabWidget::updateScaling(double 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);
@ -1233,12 +1172,12 @@ void CAscTabWidget::updateScaling(double f)
else
m_widthParams.tools_width = m_widthParams.title_width = 0;
adjustTabsSize();
m_pBar->updateScaling(f);
}
void CAscTabWidget::setStyleSheet(const QString& stylesheet)
{
QTabWidget::setStyleSheet(stylesheet + g_dark_theme_stylesheet);
QTabWidget::setStyleSheet(stylesheet);
auto _string_to_color = [](const QString& str) -> QColor {
int r = -1, g = -1, b = -1;
@ -1283,12 +1222,10 @@ void CAscTabWidget::applyUITheme(const std::wstring& theme)
{
reloadTabIcons();
updateIcons();
CTabBar & _tabbar = *(static_cast<CTabBar *>(tabBar()));
// _tabbar.setTabTextColor(QPalette::Active, AscAppManager::themes().color(theme, CThemes::ColorRole::ecrTextPressed));
_tabbar.setTabTextColor(QPalette::Inactive, AscAppManager::themes().current().color(CTheme::ColorRole::ecrTextNormal));
_tabbar.setUIThemeType(!AscAppManager::themes().current().isDark());
_tabbar.style()->polish(&_tabbar);
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);
style()->polish(this);
QColor back_color = AscAppManager::themes().current().color(CTheme::ColorRole::ecrWindowBackground);

View File

@ -37,7 +37,7 @@
//#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTabBar>
#include <QtWidgets/QPushButton>
#include "ctabbarwrapper.h"
#include "qcefview.h"
#include "cscalingwrapper.h"
#include "ctabpanel.h"
@ -129,6 +129,7 @@ private:
bool m_isCustomStyle;
CTabIconSet m_mapTabIcons;
QSize m_tabIconSize;
CTabBar *m_pBar;
signals:
// void sendAddEditor();
@ -137,9 +138,10 @@ signals:
void editorRemoved(int, int);
public:
CAscTabWidget(QWidget *parent = 0);
CAscTabWidget(QWidget *parent = nullptr, CTabBar *_pBar = nullptr, QPushButton *_pButtonMain = nullptr);
CTabPanel * panel(int) const;
CTabBar *tabBar() const;
// int addEditor(QString strName, AscEditorType etType = etDocument, std::wstring strUrl = L"");
int addEditor(const COpenOptions&);
@ -158,7 +160,6 @@ public:
void updateScaling(double) override;
protected:
void resizeEvent(QResizeEvent* e) override;
void tabInserted(int index) override;
void tabRemoved(int index) override;
void closeEditor(int, bool, bool);
@ -187,7 +188,6 @@ public:
int findProcessed() const;
bool isProcessed(int index) const;
void adjustTabsSize();
void activate(bool);
bool isActiveWidget();
@ -219,4 +219,3 @@ public slots:
};
#endif // ASCTABWIDGET

View File

@ -238,8 +238,8 @@ namespace CEditorTools
panel->setData(data);
if ( !rect.isEmpty() )
panel->setGeometry(rect);
//if ( !rect.isEmpty() )
//panel->setGeometry(rect);
} else {
delete panel, panel = nullptr;
}

View File

@ -99,41 +99,31 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, double dpi_ratio)
{
setObjectName("mainPanel");
setProperty("uitheme", QString::fromStdWString(AscAppManager::themes().current().id()));
m_pMainGridLayout = new QGridLayout(this);
m_pMainGridLayout->setSpacing(0);
m_pMainGridLayout->setObjectName(QString::fromUtf8("mainGridLayout"));
m_pMainGridLayout->setContentsMargins(0, 0, 0, 0);
setLayout(m_pMainGridLayout);
QGridLayout *mainGridLayout = new QGridLayout();
mainGridLayout->setSpacing( 0 );
mainGridLayout->setMargin( 0 );
setLayout( mainGridLayout );
// Central widget
QWidget *centralWidget = new QWidget( this );
centralWidget->setObjectName("centralWidget");
centralWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
QPalette palette;
m_pTabs = new CAscTabWidget(centralWidget);
m_pTabs->setGeometry(0, 0, centralWidget->width(), centralWidget->height());
m_pTabs->activate(false);
m_pTabs->applyUITheme(AscAppManager::themes().current().id());
connect(m_pTabs, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
connect(m_pTabs, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)));
connect(m_pTabs, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabCloseRequest(int)));
connect(m_pTabs, &CAscTabWidget::closeAppRequest, this, &CMainPanel::onAppCloseRequest);
connect(m_pTabs, &CAscTabWidget::editorInserted, bind(&CMainPanel::onTabsCountChanged, this, _2, _1, 1));
connect(m_pTabs, &CAscTabWidget::editorRemoved, bind(&CMainPanel::onTabsCountChanged, this, _2, _1, -1));
// Set custom TabBar
m_pTabBarWrapper = new CTabBarWrapper(this);
m_pTabBarWrapper->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
m_pMainGridLayout->addWidget(m_pTabBarWrapper, 0, 1, 1, 1);
// QSize wide_btn_size(29*g_dpi_ratio, TOOLBTN_HEIGHT*g_dpi_ratio);
QPalette palette;
#ifdef __linux__
m_boxTitleBtns = new CX11Caption(centralWidget);
m_boxTitleBtns = new CX11Caption(this);
#else
m_boxTitleBtns = new QWidget(centralWidget);
m_boxTitleBtns = new QWidget(this);
#endif
m_boxTitleBtns->setObjectName("CX11Caption");
m_boxTitleBtns->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_pMainGridLayout->addWidget(m_boxTitleBtns, 0, 2, 1, 1);
QHBoxLayout * layoutBtns = new QHBoxLayout(m_boxTitleBtns);
#ifdef __DONT_WRITE_IN_APP_TITLE
QLabel * label = new QLabel;
QLabel * label = new QLabel(m_boxTitleBtns);
#else
QLabel * label = new QLabel(APP_TITLE);
#endif
@ -145,9 +135,11 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, double dpi_ratio)
layoutBtns->addWidget(label);
// Main
m_pButtonMain = new CSVGPushButton(centralWidget);
m_pButtonMain = new CSVGPushButton(this);
m_pButtonMain->setObjectName( "toolButtonMain" );
m_pButtonMain->setProperty("class", "active");
m_pButtonMain->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
m_pMainGridLayout->addWidget(m_pButtonMain, 0, 0, 1, 1);
QObject::connect(m_pButtonMain, SIGNAL(clicked()), this, SLOT(pushButtonMainClicked()));
if (isCustomWindow) {
@ -163,15 +155,15 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, double dpi_ratio)
};
// Minimize
m_pButtonMinimize = _creatToolButton("toolButtonMinimize", centralWidget);
m_pButtonMinimize = _creatToolButton("toolButtonMinimize", this);
QObject::connect(m_pButtonMinimize, &QPushButton::clicked, this, &CMainPanel::pushButtonMinimizeClicked);
// Maximize
m_pButtonMaximize = _creatToolButton("toolButtonMaximize", centralWidget);
m_pButtonMaximize = _creatToolButton("toolButtonMaximize", this);
QObject::connect(m_pButtonMaximize, &QPushButton::clicked, this, &CMainPanel::pushButtonMaximizeClicked);
// Close
m_pButtonClose = _creatToolButton("toolButtonClose", centralWidget);
m_pButtonClose = _creatToolButton("toolButtonClose", this);
QObject::connect(m_pButtonClose, &QPushButton::clicked, this, &CMainPanel::pushButtonCloseClicked);
layoutBtns->addWidget(m_pButtonMinimize);
@ -179,14 +171,14 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, double dpi_ratio)
layoutBtns->addWidget(m_pButtonClose);
#ifdef __linux__
mainGridLayout->setMargin( CX11Decoration::customWindowBorderWith() * dpi_ratio );
m_pMainGridLayout->setMargin( CX11Decoration::customWindowBorderWith() * dpi_ratio );
connect(m_boxTitleBtns, SIGNAL(mouseDoubleClicked()), this, SLOT(pushButtonMaximizeClicked()));
#endif
} else {
// m_pButtonMain->setProperty("theme", "light");
QLinearGradient gradient(centralWidget->rect().topLeft(), QPoint(centralWidget->rect().left(), 29));
QLinearGradient gradient(this->rect().topLeft(), QPoint(this->rect().left(), 29));
gradient.setColorAt(0, QColor("#eee"));
gradient.setColorAt(1, QColor("#e4e4e4"));
@ -196,13 +188,22 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, double dpi_ratio)
}
// m_pTabs->setAutoFillBackground(true);
// Set TabWidget
m_pTabs = new CAscTabWidget(this, tabBar(), m_pButtonMain);
m_pTabs->setObjectName(QString::fromUtf8("ascTabWidget"));
m_pMainGridLayout->addWidget(m_pTabs, 1, 0, 1, 4);
m_pTabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_pTabs->activate(false);
m_pTabs->applyUITheme(AscAppManager::themes().current().id());
connect(tabBar(), 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, &CAscTabWidget::closeAppRequest, this, &CMainPanel::onAppCloseRequest);
connect(m_pTabs, &CAscTabWidget::editorInserted, bind(&CMainPanel::onTabsCountChanged, this, _2, _1, 1));
connect(m_pTabs, &CAscTabWidget::editorRemoved, bind(&CMainPanel::onTabsCountChanged, this, _2, _1, -1));
m_pTabs->setPalette(palette);
m_pTabs->setCustomWindowParams(isCustomWindow);
m_pTabs->m_pMainButton = m_pButtonMain;
mainGridLayout->addWidget( centralWidget );
// RecalculatePlaces();
}
void CMainPanel::attachStartPanel(QCefView * const view)
@ -212,43 +213,13 @@ void CMainPanel::attachStartPanel(QCefView * const view)
view->setMouseTracking(m_pButtonMain->hasMouseTracking());
#endif
QWidget * centralwidget = layout()->itemAt(0)->widget();
view->setParent(centralwidget);
m_pMainWidget->setParent(this);
m_pMainGridLayout->addWidget(m_pMainWidget, 2, 0, 1, 4);
m_pMainWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
if ( !m_pTabs->isActiveWidget() )
view->show();
}
void CMainPanel::RecalculatePlaces()
{
int cbw = 0;
#ifdef __linux
QWidget * cw = findChild<QWidget *>("centralWidget");
int windowW = cw->width(),
windowH = cw->height(),
#else
int windowW = width(),
windowH = height(),
#endif
captionH = int(TITLE_HEIGHT * scaling()),
btnMainWidth = int(BUTTON_MAIN_WIDTH * scaling());
m_pTabs->setGeometry(cbw, cbw, windowW, windowH);
int docCaptionW = windowW - m_pTabs->tabBar()->width() - btnMainWidth;
int contentH = windowH - captionH;
if (docCaptionW < 1)
docCaptionW = 1;
if (contentH < 1)
contentH = 1;
m_boxTitleBtns->setFixedSize(docCaptionW, int(TOOLBTN_HEIGHT * scaling()));
m_boxTitleBtns->move(windowW - m_boxTitleBtns->width() + cbw, cbw);
if ( m_pMainWidget )
m_pMainWidget->setGeometry(cbw, captionH + cbw, windowW, contentH);
m_pMainWidget->show();
}
#ifdef __linux
@ -260,7 +231,6 @@ QWidget * CMainPanel::getTitleWidget()
void CMainPanel::setMouseTracking(bool enable)
{
QWidget::setMouseTracking(enable);
findChild<QWidget *>("centralWidget")->setMouseTracking(enable);
findChild<QLabel *>("labelAppTitle")->setMouseTracking(enable);
m_boxTitleBtns->setMouseTracking(enable);
@ -361,12 +331,6 @@ void CMainPanel::focus() {
}
}
void CMainPanel::resizeEvent(QResizeEvent * event)
{
QWidget::resizeEvent(event);
RecalculatePlaces();
}
void CMainPanel::onTabClicked(int index)
{
Q_UNUSED(index)
@ -386,10 +350,10 @@ void CMainPanel::onTabsCountChanged(int count, int i, int d)
}
if ( d < 0 ) {
RecalculatePlaces();
//RecalculatePlaces();
} else
QTimer::singleShot(200, [=]{
RecalculatePlaces();
//RecalculatePlaces();
});
}
@ -406,7 +370,7 @@ void CMainPanel::onEditorAllowedClose(int uid)
_view->deleteLater();
m_pTabs->removeTab(_index);
m_pTabs->adjustTabsSize();
//m_pTabs->adjustTabsSize();
if ( !m_pTabs->count() ) {
m_pTabs->setProperty("empty", true);
m_pTabs->style()->polish(m_pTabs);
@ -1216,6 +1180,8 @@ void CMainPanel::applyTheme(const std::wstring& theme)
}
// m_pTabs->style()->polish(m_pTabs);
m_boxTitleBtns->style()->polish(m_boxTitleBtns);
m_pTabBarWrapper->style()->polish(m_pTabBarWrapper);
m_pButtonMain->style()->polish(m_pButtonMain);
if ( m_pButtonMinimize ) {
m_pButtonMinimize->style()->polish(m_pButtonMinimize);
@ -1225,8 +1191,8 @@ void CMainPanel::applyTheme(const std::wstring& theme)
m_pTabs->applyUITheme(theme);
QWidget * centralwidget = layout()->itemAt(0)->widget();
centralwidget->style()->polish(centralwidget);
//QWidget * centralwidget = layout()->itemAt(0)->widget();
//centralwidget->style()->polish(centralwidget);
style()->polish(this);
update();
@ -1259,7 +1225,8 @@ void CMainPanel::updateScaling(double dpiratio)
m_pButtonClose->setFixedSize(small_btn_size);
}
m_pButtonMain->setGeometry(0, 0, int(BUTTON_MAIN_WIDTH * dpiratio), int(TITLE_HEIGHT * dpiratio));
//m_pButtonMain->setGeometry(0, 0, int(BUTTON_MAIN_WIDTH * dpiratio), int(TITLE_HEIGHT * dpiratio));
m_pButtonMain->setFixedSize(int(BUTTON_MAIN_WIDTH * dpiratio), int(TITLE_HEIGHT * dpiratio));
QString _tabs_stylesheets = dpiratio > 1.75 ? ":/sep-styles/tabbar@2x" :
dpiratio > 1.5 ? ":/sep-styles/tabbar@1.75x" :
@ -1275,7 +1242,9 @@ void CMainPanel::updateScaling(double dpiratio)
QFile styleFile(_tabs_stylesheets);
styleFile.open( QFile::ReadOnly );
m_pTabs->setStyleSheet(QString(styleFile.readAll()));
const QString _style = QString(styleFile.readAll());
m_pTabBarWrapper->applyTheme(_style);
m_pTabs->setStyleSheet(_style);
m_pTabs->updateScaling(dpiratio);
styleFile.close();
@ -1303,8 +1272,8 @@ void CMainPanel::updateScaling(double dpiratio)
// m_pTabs->setTabIcons(icons);
m_pTabs->reloadTabIcons();
if ( m_mainWindowState == Qt::WindowMaximized )
RecalculatePlaces();
//if ( m_mainWindowState == Qt::WindowMaximized )
//RecalculatePlaces();
}
void CMainPanel::setScreenScalingFactor(double s)
@ -1345,3 +1314,8 @@ bool CMainPanel::holdUrl(const QString& url, AscEditorType type) const
}
CAscTabWidget * CMainPanel::tabWidget(){return m_pTabs;}
CTabBar *CMainPanel::tabBar()
{
return m_pTabBarWrapper->tabBar();
}

View File

@ -44,6 +44,7 @@
#include "ccefeventstransformer.h"
#include "cscalingwrapper.h"
#include "csvgpushbutton.h"
#include <math.h>
struct printdata;
@ -72,7 +73,7 @@ public:
int tabCloseRequest(int index = -1);
void toggleButtonMain(bool, bool delay = false);
CAscTabWidget * tabWidget();
CTabBar *tabBar();
virtual void applyTheme(const std::wstring&);
virtual void updateScaling(double);
@ -88,12 +89,7 @@ protected:
private:
// bool nativeEvent(const QByteArray &, void *msg, long *result);
// void mousePressEvent( QMouseEvent *event );
void resizeEvent(QResizeEvent* event);
// bool eventFilter(QObject *obj, QEvent *event);
int trySaveDocument(int);
void RecalculatePlaces();
signals:
// void downloadEvent(NSEditorApi::CAscDownloadFileInfo *);
@ -151,6 +147,7 @@ public slots:
void onWebTitleChanged(int, std::wstring json){}
protected:
CTabBarWrapper* m_pTabBarWrapper;
CAscTabWidget * m_pTabs;
CSVGPushButton* m_pButtonMain;
bool m_isCustomWindow;
@ -159,6 +156,7 @@ private:
std::wstring m_sDownloadName;
QWidget* m_pMainWidget = nullptr;
QGridLayout* m_pMainGridLayout;
QPushButton* m_pButtonMinimize = nullptr;
QPushButton* m_pButtonMaximize = nullptr;

View File

@ -31,8 +31,7 @@ int CMainWindowBase::attachEditor(QWidget * panel, int index)
if ( !(_index < 0) ) {
_pMainPanel->toggleButtonMain(false);
QTabBar * tabs = _pMainPanel->tabWidget()->tabBar();
tabs->setCurrentIndex(_index);
_pMainPanel->tabWidget()->setCurrentIndex(_index);
// if ( false ) {
// QApplication::sendEvent( tabs,

View File

@ -234,7 +234,9 @@ void QTabBarPrivate::Tab::TabBarAnimation::updateState(QAbstractAnimation::State
CTabBar::CTabBar(QWidget * parent)
: QTabBar(parent)
, CScalingWrapper(parent)
, m_scrollPos(0)
{
hide();
setDrawBase(false);
if (Utils::getScreenDpiRatio(
@ -251,10 +253,39 @@ CTabBar::~CTabBar()
}
void CTabBar::initCustomScroll(QFrame *_pScrollerFrame,
QToolButton *_pLeftButton,
QToolButton *_pRightButton)
{
// Bypassing the bug with tab scroller
m_pScrollerFrame = _pScrollerFrame;
m_pLeftButton = _pLeftButton;
m_pRightButton = _pRightButton;
m_pScrollerFrame->show();
m_pScrollerFrame->raise();
m_pLeftButton->show();
m_pLeftButton->raise();
m_pRightButton->show();
m_pRightButton->raise();
m_pScrollerFrame->setVisible(false);
connect(m_pLeftButton, &QToolButton::clicked, this, [=](){
Q_D(QTabBar);
d->leftB->click();
m_scrollPos = d->scrollOffset;
changeCustomScrollerState();
});
connect(m_pRightButton, &QToolButton::clicked, this, [=](){
Q_D(QTabBar);
d->rightB->click();
m_scrollPos = d->scrollOffset;
changeCustomScrollerState();
}); // End bypassing the bug
}
void CTabBar::mouseMoveEvent(QMouseEvent * event)
{
Q_D(QTabBar);
this->setCursor(QCursor(Qt::ArrowCursor));
if (verticalTabs(d->shape)) {
QTabBar::mouseMoveEvent(event);
return;
@ -351,6 +382,12 @@ void CTabBar::mouseReleaseEvent(QMouseEvent * e)
releaseMouse();
}
void CTabBar::wheelEvent(QWheelEvent *event)
{
QTabBar::wheelEvent(event);
emit onCurrentChangedByWhell(currentIndex());
}
void CTabBar::drawTabCaption(QPainter * p, const QString& s, const QStyleOptionTab& t)
{
if ( m_usePalette ) {
@ -572,11 +609,14 @@ void CTabBar::paintEvent(QPaintEvent * event)
}
#endif
if ( scaling() > 1 ) {
/* qtabbar scroller doesn't apply big width */
d->leftB->setGeometry(d->rightB->geometry().adjusted(0,0,-24,0));
d->leftB->raise();
}
}
void CTabBar::resizeEvent(QResizeEvent *event)
{
QTabBar::resizeEvent(event);
Q_D(QTabBar);
m_scrollPos = d->scrollOffset;
changeCustomScrollerState();
}
void CTabBar::fillTabColor(QPainter * p, const QStyleOptionTab& tab, uint index, const QColor& color)
@ -638,6 +678,14 @@ void CTabBar::tabInserted(int index)
void CTabBar::onCurrentChanged(int index)
{
Q_D(QTabBar);
m_scrollPos = d->scrollOffset;
if (this->count() == 0) {
this->hide();
} else if (this->isHidden()) {
this->show();
}
QWidget * b = TAB_BTNCLOSE(m_current);
// if ( tabData(m_current).isNull() )
{
@ -659,6 +707,31 @@ void CTabBar::onCurrentChanged(int index)
}
m_current = index;
changeCustomScrollerState();
}
void CTabBar::changeCustomScrollerState()
{
// Bypassing the bug with tab scroller
Q_D(QTabBar);
if (m_pScrollerFrame && m_pLeftButton && m_pRightButton) {
if (d->leftB->isVisible()) {
m_pScrollerFrame->setVisible(true);
} else {
m_pScrollerFrame->setVisible(false);
}
if (d->leftB->isEnabled()) {
m_pLeftButton->setEnabled(true);
} else {
m_pLeftButton->setEnabled(false);
}
if (d->rightB->isEnabled()) {
m_pRightButton->setEnabled(true);
} else {
m_pRightButton->setEnabled(false);
}
}
// End bypassing the bug
}
void CTabBar::tabRemoved(int index)
@ -761,6 +834,36 @@ void CTabBar::setTabTheme(int index, TabTheme theme)
void CTabBar::setUIThemeType(bool islight)
{
m_isUIThemeDark = !islight;
if (m_pLeftButton && m_pRightButton) {
m_pLeftButton->style()->polish(m_pLeftButton);
m_pRightButton->style()->polish(m_pRightButton);
}
QTimer::singleShot(20, this, [=]() {
Q_D(QTabBar);
if (d->scrollOffset != m_scrollPos) {
const int tabWidth = this->tabSizeHint(0).width();
if (m_scrollPos % tabWidth == 0) {
for (int i = 0; i < count(); i++) {
if (!d->rightB->isEnabled()) break;
d->rightB->click();
}
for (int i = 0; i < count(); i++) {
if (d->scrollOffset == m_scrollPos) break;
d->leftB->click();
}
} else {
for (int i = 0; i < count(); i++) {
if (!d->leftB->isEnabled()) break;
d->leftB->click();
}
for (int i = 0; i < count(); i++) {
if (d->scrollOffset == m_scrollPos) break;
d->rightB->click();
}
}
}
});
}
void CTabBar::setActiveTabColor(const QString& color)

View File

@ -34,8 +34,15 @@
#define CTABBAR_H
#include <QTabBar>
#include <QToolButton>
#include <QFrame>
#include <QHBoxLayout>
#include <QPushButton>
#include <QTimer>
#include <QWheelEvent>
#include "cscalingwrapper.h"
#include <math.h>
//class CTabBarPrivate;
class CTabBar : public QTabBar, public CScalingWrapper
@ -43,7 +50,7 @@ class CTabBar : public QTabBar, public CScalingWrapper
Q_OBJECT
public:
explicit CTabBar(QWidget * parent = 0);
explicit CTabBar(QWidget * parent = nullptr);
virtual ~CTabBar();
void setTabTextColor(QPalette::ColorGroup, const QColor&);
@ -66,13 +73,16 @@ public:
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&);
@ -97,9 +107,15 @@ private:
signals:
void tabUndock(int, bool *);
void onCurrentChangedByWhell(int index);
private:
Q_DECLARE_PRIVATE(QTabBar)
int m_scrollPos;
QFrame *m_pScrollerFrame;
QToolButton *m_pLeftButton,
*m_pRightButton;
void changeCustomScrollerState();
};
#endif // CTABBAR_H

View File

@ -0,0 +1,94 @@
#include "ctabbarwrapper.h"
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(this);
#ifdef Q_OS_WIN
_pTabLayout->setSpacing(32);
#else
_pTabLayout->setSpacing(0);
#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

@ -0,0 +1,34 @@
#ifndef CTABBARWRAPPER_H
#define CTABBARWRAPPER_H
#include <QFrame>
#include <QGridLayout>
#include <QToolButton>
#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

@ -20,11 +20,11 @@ CTabPanel::CTabPanel(QWidget *parent)
: QWidget(parent)
, m_pViewer(AscAppManager::createViewer(this))
{
// QGridLayout * _layout = new QGridLayout(this);
// setLayout(_layout);
// _layout->setMargin(0);
// _layout->addWidget(m_pViewer);
QGridLayout * _layout = new QGridLayout(this);
setLayout(_layout);
_layout->setSpacing(0);
_layout->setContentsMargins(0,0,0,0);
_layout->addWidget(m_pViewer);
m_pViewer->SetBackgroundCefColor(244, 244, 244);
}
@ -87,19 +87,19 @@ void CTabPanel::initAsEditor()
# endif
m_pLoader = new QCefView(this);
m_pLoader->setGeometry(0,0, width(), height());
//m_pLoader->setGeometry(0,0, width(), height());
m_pLoader->Create(&AscAppManager::getInstance(), cvwtSimple);
m_pLoader->GetCefView()->load(_loader_path.toStdWString());
m_pViewer->hide();
#endif
m_pViewer->Create(&AscAppManager::getInstance(), cvwtEditor);
m_pViewer->Create(&AscAppManager::getInstance(), cvwtEditor);
}
void CTabPanel::initAsSimple()
{
m_pViewer->Create(&AscAppManager::getInstance(), cvwtSimple);
m_pViewer->Create(&AscAppManager::getInstance(), cvwtSimple);
}
void CTabPanel::openLocalFile(const std::wstring& path, int format, const std::wstring& params)
@ -132,15 +132,16 @@ bool CTabPanel::openRecentFile(int id)
return static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->OpenRecentFile(id);
}
void CTabPanel::resizeEvent(QResizeEvent *event)
/*void CTabPanel::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
m_pViewer->resize(event->size());
}
}*/
void CTabPanel::showEvent(QShowEvent *)
/*void CTabPanel::showEvent(QShowEvent *)
{
// cef()->resizeEvent();
}
}*/
void CTabPanel::paintEvent(QPaintEvent *)
{
@ -150,7 +151,7 @@ void CTabPanel::paintEvent(QPaintEvent *)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void CTabPanel::timerEvent(QTimerEvent *)
/*void CTabPanel::timerEvent(QTimerEvent *)
{
if ( m_startSize == m_lastSize ) {
cef()->resizeEvent();
@ -160,14 +161,14 @@ void CTabPanel::timerEvent(QTimerEvent *)
} else {
m_startSize = m_lastSize;
}
}
}*/
void CTabPanel::closeEvent(QCloseEvent *event)
{
emit closePanel(event);
}
void CTabPanel::resize(int w, int h)
/*void CTabPanel::resize(int w, int h)
{
if ( m_idTimerResize == 0 ) {
m_startSize = QSize(w, h);
@ -175,7 +176,7 @@ void CTabPanel::resize(int w, int h)
}
m_lastSize = QSize(w, h);
}
}*/
void CTabPanel::applyLoader(const QString& cmd, const QString& args)
{
@ -193,7 +194,7 @@ void CTabPanel::showFullScreen()
{
QWidget::setWindowTitle(data()->title());
QWidget::showFullScreen();
m_pViewer->setGeometry(QRect(0,0,width(),height()));
//m_pViewer->setGeometry(QRect(0,0,width(),height()));
}
void CTabPanel::showNormal()

View File

@ -35,16 +35,16 @@ public:
void applyLoader(const QString& cmd, const QString& args = QString());
void resize(int w, int h);
void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);
//void resize(int w, int h);
//void resizeEvent(QResizeEvent *event);
//void showEvent(QShowEvent *event);
bool prettyTitle() { return m_prettyTitle; }
void setPrettyTitle(bool v) { m_prettyTitle = v; }
void setBackground(const QColor&);
protected:
void timerEvent(QTimerEvent *event);
//void timerEvent(QTimerEvent *event);
void paintEvent(QPaintEvent *event);
void closeEvent(QCloseEvent *event);