Browse Source

themes: fix QTabBar's padding

Le Tan 8 years ago
parent
commit
7b8c522a53

+ 1 - 1
src/resources/themes/v_moonlight/v_moonlight.qss

@@ -739,7 +739,7 @@ QTabBar::tab {
     border: none;
     border-top: 2px solid transparent;
     border-right: 1px solid @tabbar_border;
-    padding: 2px;
+    padding: 2px 0px 2px 0px;
 }
 
 QTabBar::tab:selected {

+ 1 - 1
src/resources/themes/v_pure/v_pure.qss

@@ -743,7 +743,7 @@ QTabBar::tab {
     border: none;
     border-top: 2px solid transparent;
     border-right: 1px solid @tabbar_border;
-    padding: 2px;
+    padding: 2px 0px 2px 0px;
 }
 
 QTabBar::tab:selected {

+ 1 - 1
src/resources/themes/v_white/v_white.qss

@@ -628,7 +628,7 @@ QTabBar::tab {
     background: @tabbar_bg;
     border: none;
     border-right: 1px solid @tabbar_border;
-    padding: 2px;
+    padding: 2px 0px 2px 0px;
 }
 
 QTabBar::tab:selected {

+ 8 - 2
src/veditwindow.cpp

@@ -1027,10 +1027,16 @@ bool VEditWindow::showOpenedFileList()
 
 bool VEditWindow::activateTab(int p_sequence)
 {
-    if (p_sequence < c_tabSequenceBase || p_sequence >= (c_tabSequenceBase + count())) {
+    if (p_sequence < c_tabSequenceBase
+        || p_sequence >= (c_tabSequenceBase + count())) {
         return false;
     }
-    setCurrentIndex(p_sequence - c_tabSequenceBase);
+
+    int idx = p_sequence - c_tabSequenceBase;
+    setCurrentIndex(idx);
+    // Always need to focus to this tab to meet the requirement of Captain mode.
+    getTab(idx)->focusTab();
+
     return true;
 }
 

+ 2 - 0
src/veditwindow.h

@@ -66,7 +66,9 @@ public:
     void focusNextTab(bool p_right);
     // Return true if the file list is shown.
     bool showOpenedFileList();
+
     bool activateTab(int p_sequence);
+
     // Switch to previous activated tab.
     bool alternateTab();