Browse Source

bug-fix: update status after edit tab got focus

Le Tan 8 years ago
parent
commit
5aa5864ced
4 changed files with 7 additions and 3 deletions
  1. 3 0
      src/vedittab.cpp
  2. 2 2
      src/veditwindow.cpp
  3. 1 0
      src/veditwindow.h
  4. 1 1
      src/vmainwindow.cpp

+ 3 - 0
src/vedittab.cpp

@@ -25,6 +25,7 @@ void VEditTab::focusTab()
 {
     focusChild();
     emit getFocused();
+    updateStatus();
 }
 
 bool VEditTab::isEditMode() const
@@ -49,8 +50,10 @@ void VEditTab::handleFocusChanged(QWidget * /* p_old */, QWidget *p_now)
         focusChild();
 
         emit getFocused();
+        updateStatus();
     } else if (isAncestorOf(p_now)) {
         emit getFocused();
+        updateStatus();
     }
 }
 

+ 2 - 2
src/veditwindow.cpp

@@ -265,8 +265,8 @@ int VEditWindow::insertEditTab(int p_index, VFile *p_file, QWidget *p_page)
 {
     int idx = insertTab(p_index,
                         p_page,
-                        generateTabText(p_index, p_file));
-    setTabToolTip(idx, generateTooltip(p_file));
+                        p_file->getName());
+    updateTabInfo(idx);
     return idx;
 }
 

+ 1 - 0
src/veditwindow.h

@@ -153,6 +153,7 @@ private:
     // and move the tab to the new split.
     void moveTabOneSplit(int p_tabIdx, bool p_right);
 
+    // Update info of tab @p_idx according to the state of the editor and file.
     void updateTabInfo(int p_idx);
 
     // Update the sequence number of all the tabs.

+ 1 - 1
src/vmainwindow.cpp

@@ -1155,7 +1155,7 @@ void VMainWindow::initEditMenu()
 void VMainWindow::initDockWindows()
 {
     toolDock = new QDockWidget(tr("Tools"), this);
-    toolDock->setObjectName("tools_dock");
+    toolDock->setObjectName("ToolsDock");
     toolDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
     toolBox = new QToolBox(this);